|
|
@@ -1,7 +1,7 @@
|
|
|
package cn.seecoder.paas.service.facade.k8s.model;
|
|
|
|
|
|
import cn.seecoder.paas.util.LoggerUtil;
|
|
|
-import io.fabric8.kubernetes.api.model.networking.v1beta1.IngressTLS;
|
|
|
+import io.fabric8.kubernetes.api.model.networking.v1.IngressTLS;
|
|
|
import io.kubernetes.client.custom.IntOrString;
|
|
|
import io.kubernetes.client.openapi.models.*;
|
|
|
import io.kubernetes.client.proto.V1beta1Extensions;
|
|
|
@@ -29,14 +29,11 @@ public class Ingress extends K8sAbstractObject<ExtensionsV1beta1Ingress> {
|
|
|
|
|
|
public static final String DEFAULT_REWRITE_PATH = "/";
|
|
|
|
|
|
- public static final String SSL_REDIRECT = "nginx.ingress.kubernetes.io/ssl-redirect";
|
|
|
-
|
|
|
//重定向的路径,默认为根路径
|
|
|
private static final String redirectPath = DEFAULT_REWRITE_PATH;
|
|
|
|
|
|
- private List<IngressTls> tls = new ArrayList<>();
|
|
|
+ private List<IngressTLS> tls = new ArrayList<>();
|
|
|
|
|
|
- /*Ingress能暴露HTTP和HTTPS协议口,目前暂不支持HTTPS协议*/
|
|
|
private List<IngressRule> httpRules = new ArrayList<>();
|
|
|
|
|
|
public Ingress(ExtensionsV1beta1Ingress extensionsV1beta1Ingress) {
|
|
|
@@ -52,11 +49,9 @@ public class Ingress extends K8sAbstractObject<ExtensionsV1beta1Ingress> {
|
|
|
if (exTls != null && !exTls.isEmpty()) {
|
|
|
tls = exTls.stream()
|
|
|
.filter(Objects::nonNull)
|
|
|
- .map(IngressTls::new)
|
|
|
+ .map(IngressTLS::new)
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
- System.out.println("tls hosts:");
|
|
|
- System.out.println(tls.get(0).hosts);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -171,18 +166,17 @@ public class Ingress extends K8sAbstractObject<ExtensionsV1beta1Ingress> {
|
|
|
@AllArgsConstructor
|
|
|
@EqualsAndHashCode
|
|
|
@Builder
|
|
|
- public static class IngressTls implements K8sObjectTransformer<ExtensionsV1beta1IngressTLS> {
|
|
|
+ public static class IngressTLS implements K8sObjectTransformer<ExtensionsV1beta1IngressTLS> {
|
|
|
|
|
|
- private List<String> hosts;
|
|
|
+ private List<String> hosts = new ArrayList<>();
|
|
|
|
|
|
private String secretName;
|
|
|
|
|
|
- public IngressTls(List<String> hosts) {
|
|
|
+ public IngressTLS(List<String> hosts) {
|
|
|
this.hosts = hosts;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public IngressTls(ExtensionsV1beta1IngressTLS extensionsV1beta1IngressTLS) {
|
|
|
+ public IngressTLS(ExtensionsV1beta1IngressTLS extensionsV1beta1IngressTLS) {
|
|
|
this.hosts = extensionsV1beta1IngressTLS.getHosts();
|
|
|
this.secretName = extensionsV1beta1IngressTLS.getSecretName();
|
|
|
}
|
|
|
@@ -199,7 +193,7 @@ public class Ingress extends K8sAbstractObject<ExtensionsV1beta1Ingress> {
|
|
|
|
|
|
private List<ExtensionsV1beta1IngressTLS> toExtensionsV1beta1IngressTLS() {
|
|
|
return tls.stream()
|
|
|
- .map(IngressTls::toK8sObject)
|
|
|
+ .map(IngressTLS::toK8sObject)
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
}
|