private static HasMetadata getIngress()

in flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/IngressUtils.java [91:142]


    private static HasMetadata getIngress(
            ObjectMeta objectMeta,
            FlinkDeploymentSpec spec,
            Configuration effectiveConfig,
            KubernetesClient client) {
        if (ingressInNetworkingV1(client)) {
            return new IngressBuilder()
                    .withNewMetadata()
                    .withLabels(spec.getIngress().getLabels())
                    .withAnnotations(spec.getIngress().getAnnotations())
                    .withName(objectMeta.getName())
                    .withNamespace(objectMeta.getNamespace())
                    .endMetadata()
                    .withNewSpec()
                    .withIngressClassName(spec.getIngress().getClassName())
                    .withTls(spec.getIngress().getTls())
                    .withRules(getIngressRule(objectMeta, spec, effectiveConfig))
                    .endSpec()
                    .build();
        } else {
            List<IngressTLS> ingressTLS =
                    Optional.ofNullable(spec.getIngress().getTls())
                            .map(
                                    list ->
                                            list.stream()
                                                    .map(
                                                            v1Tls -> {
                                                                IngressTLS v1beta1Tls =
                                                                        new IngressTLS();
                                                                v1beta1Tls.setHosts(
                                                                        v1Tls.getHosts());
                                                                v1beta1Tls.setSecretName(
                                                                        v1Tls.getSecretName());
                                                                return v1beta1Tls;
                                                            })
                                                    .collect(Collectors.toList()))
                            .orElse(Collections.emptyList());
            return new io.fabric8.kubernetes.api.model.networking.v1beta1.IngressBuilder()
                    .withNewMetadata()
                    .withAnnotations(spec.getIngress().getAnnotations())
                    .withLabels(spec.getIngress().getLabels())
                    .withName(objectMeta.getName())
                    .withNamespace(objectMeta.getNamespace())
                    .endMetadata()
                    .withNewSpec()
                    .withIngressClassName(spec.getIngress().getClassName())
                    .withTls(ingressTLS)
                    .withRules(getIngressRuleForV1beta1(objectMeta, spec, effectiveConfig))
                    .endSpec()
                    .build();
        }
    }