use of io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder in project flink-kubernetes-operator by apache.
the class IngressUtils method getIngressRule.
private static IngressRule getIngressRule(ObjectMeta objectMeta, FlinkDeploymentSpec spec, Configuration effectiveConfig) {
final String clusterId = objectMeta.getName();
final int restPort = effectiveConfig.getInteger(RestOptions.PORT);
URL ingressUrl = getIngressUrl(spec.getIngress().getTemplate(), objectMeta.getName(), objectMeta.getNamespace());
IngressRuleBuilder ingressRuleBuilder = new IngressRuleBuilder();
ingressRuleBuilder.withHttp(new HTTPIngressRuleValueBuilder().addNewPath().withPathType("ImplementationSpecific").withNewBackend().withNewService().withName(clusterId + REST_SVC_NAME_SUFFIX).withNewPort().withNumber(restPort).endPort().endService().endBackend().endPath().build());
if (!StringUtils.isBlank(ingressUrl.getHost())) {
ingressRuleBuilder.withHost(ingressUrl.getHost());
}
if (!StringUtils.isBlank(ingressUrl.getPath())) {
ingressRuleBuilder.editHttp().editFirstPath().withPath(ingressUrl.getPath()).endPath().endHttp();
}
return ingressRuleBuilder.build();
}
use of io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KubernetesNetworkingService method buildIngress.
private Ingress buildIngress(BridgeIngress bridgeIngress, Service service) {
Ingress ingress = templateProvider.loadBridgeIngressKubernetesIngressTemplate(bridgeIngress);
IngressBackend ingressBackend = new IngressBackendBuilder().withService(new IngressServiceBackendBuilder().withName(service.getMetadata().getName()).withPort(new ServiceBackendPortBuilder().withNumber(service.getSpec().getPorts().get(0).getPort()).build()).build()).build();
HTTPIngressPath httpIngressPath = new HTTPIngressPathBuilder().withBackend(ingressBackend).withPath("/" + service.getMetadata().getName() + PATH_REGEX).withPathType("Prefix").build();
IngressRule ingressRule = new IngressRuleBuilder().withHttp(new HTTPIngressRuleValueBuilder().withPaths(httpIngressPath).build()).build();
IngressSpec ingressSpec = new IngressSpecBuilder().withRules(ingressRule).build();
ingress.setSpec(ingressSpec);
return ingress;
}
use of io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder in project jkube by eclipse.
the class NetworkingV1IngressGenerator method getIngressRuleFromXmlConfig.
private static IngressRule getIngressRuleFromXmlConfig(IngressRuleConfig ingressRuleConfig) {
IngressRuleBuilder ingressRuleBuilder = new IngressRuleBuilder();
if (ingressRuleConfig.getHost() != null) {
ingressRuleBuilder.withHost(ingressRuleConfig.getHost());
}
if (ingressRuleConfig.getPaths() != null && !ingressRuleConfig.getPaths().isEmpty()) {
HTTPIngressRuleValueBuilder httpIngressPathBuilder = new HTTPIngressRuleValueBuilder();
for (IngressRulePathConfig ingressRulePathConfig : ingressRuleConfig.getPaths()) {
httpIngressPathBuilder.addToPaths(getHTTPIngressPath(ingressRulePathConfig));
}
ingressRuleBuilder.withHttp(httpIngressPathBuilder.build());
}
return ingressRuleBuilder.build();
}
use of io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder in project cmcc-operator by T-Systems-MMS.
the class NginxIngressBuilder method build.
@Override
public Collection<? extends HasMetadata> build() {
ObjectMeta metadata = targetState.getResourceMetadataFor(name);
metadata.getAnnotations().putAll(annotations);
List<HTTPIngressPath> httpPaths = paths.stream().map(path -> withPath(new HTTPIngressPathBuilder(), path).withBackend(new IngressBackendBuilder().withService(new IngressServiceBackendBuilder().withName(path.getService()).withPort(new ServiceBackendPort("http", null)).build()).build()).build()).collect(Collectors.toList());
return Collections.singletonList(new io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder().withMetadata(metadata).withSpec(new IngressSpecBuilder().withIngressClassName("nginx").withTls(new IngressTLSBuilder().withHosts(hostname).build()).withRules(new IngressRuleBuilder().withHost(hostname).withHttp(new HTTPIngressRuleValueBuilder().withPaths(httpPaths).build()).build()).build()).build());
}
use of io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KubernetesNetworkingService method buildIngress.
private Ingress buildIngress(BridgeIngress bridgeIngress, Service service) {
Ingress ingress = templateProvider.loadBridgeIngressKubernetesIngressTemplate(bridgeIngress);
IngressBackend ingressBackend = new IngressBackendBuilder().withService(new IngressServiceBackendBuilder().withName(service.getMetadata().getName()).withPort(new ServiceBackendPortBuilder().withNumber(service.getSpec().getPorts().get(0).getPort()).build()).build()).build();
HTTPIngressPath httpIngressPath = new HTTPIngressPathBuilder().withBackend(ingressBackend).withPath("/" + service.getMetadata().getName() + PATH_REGEX).withPathType("Prefix").build();
IngressRule ingressRule = new IngressRuleBuilder().withHttp(new HTTPIngressRuleValueBuilder().withPaths(httpIngressPath).build()).build();
IngressSpec ingressSpec = new IngressSpecBuilder().withRules(ingressRule).build();
ingress.setSpec(ingressSpec);
return ingress;
}
Aggregations