Search in sources :

Example 6 with IngressSpecBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder 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;
}
Also used : IngressRuleBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressRuleBuilder) IngressSpec(io.fabric8.kubernetes.api.model.networking.v1.IngressSpec) IngressRule(io.fabric8.kubernetes.api.model.networking.v1.IngressRule) IngressBackendBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBackendBuilder) HTTPIngressRuleValueBuilder(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder) IngressSpecBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder) IngressServiceBackendBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressServiceBackendBuilder) ServiceBackendPortBuilder(io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPortBuilder) BridgeIngress(com.redhat.service.smartevents.shard.operator.resources.BridgeIngress) Ingress(io.fabric8.kubernetes.api.model.networking.v1.Ingress) HTTPIngressPathBuilder(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPathBuilder) HTTPIngressPath(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath) IngressBackend(io.fabric8.kubernetes.api.model.networking.v1.IngressBackend)

Example 7 with IngressSpecBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class OpenshiftNetworkingTestUtils method patchOpenshiftIngressDomain.

private void patchOpenshiftIngressDomain() {
    Ingress openshiftIngress = new IngressBuilder().withMetadata(new ObjectMetaBuilder().withName(OpenshiftNetworkingService.CLUSTER_DOMAIN_RESOURCE_NAME).build()).withSpec(new IngressSpecBuilder().withDomain("apps.openbridge-dev.fdvn.p1.openshiftapps.com").build()).build();
    this.client.config().ingresses().withName(OpenshiftNetworkingService.CLUSTER_DOMAIN_RESOURCE_NAME).create(openshiftIngress);
}
Also used : RouteIngressBuilder(io.fabric8.openshift.api.model.RouteIngressBuilder) IngressBuilder(io.fabric8.openshift.api.model.IngressBuilder) IngressSpecBuilder(io.fabric8.openshift.api.model.IngressSpecBuilder) Ingress(io.fabric8.openshift.api.model.Ingress) RouteIngress(io.fabric8.openshift.api.model.RouteIngress) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder)

Example 8 with IngressSpecBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder 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());
}
Also used : java.util(java.util) TargetState(com.tsystemsmms.cmcc.cmccoperator.targetstate.TargetState) ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) io.fabric8.kubernetes.api.model.networking.v1(io.fabric8.kubernetes.api.model.networking.v1) Collectors(java.util.stream.Collectors) ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta)

Example 9 with IngressSpecBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder 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;
}
Also used : IngressRuleBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressRuleBuilder) IngressSpec(io.fabric8.kubernetes.api.model.networking.v1.IngressSpec) IngressRule(io.fabric8.kubernetes.api.model.networking.v1.IngressRule) IngressBackendBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBackendBuilder) HTTPIngressRuleValueBuilder(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder) IngressSpecBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder) IngressServiceBackendBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressServiceBackendBuilder) ServiceBackendPortBuilder(io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPortBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1.Ingress) BridgeIngress(com.redhat.service.bridge.shard.operator.resources.BridgeIngress) HTTPIngressPathBuilder(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPathBuilder) HTTPIngressPath(io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath) IngressBackend(io.fabric8.kubernetes.api.model.networking.v1.IngressBackend)

Example 10 with IngressSpecBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class OpenshiftNetworkingTestUtils method patchOpenshiftIngressDomain.

private void patchOpenshiftIngressDomain() {
    Ingress openshiftIngress = new IngressBuilder().withMetadata(new ObjectMetaBuilder().withName(OpenshiftNetworkingService.CLUSTER_DOMAIN_RESOURCE_NAME).build()).withSpec(new IngressSpecBuilder().withDomain("apps.openbridge-dev.fdvn.p1.openshiftapps.com").build()).build();
    this.client.config().ingresses().withName(OpenshiftNetworkingService.CLUSTER_DOMAIN_RESOURCE_NAME).create(openshiftIngress);
}
Also used : RouteIngressBuilder(io.fabric8.openshift.api.model.RouteIngressBuilder) IngressBuilder(io.fabric8.openshift.api.model.IngressBuilder) IngressSpecBuilder(io.fabric8.openshift.api.model.IngressSpecBuilder) Ingress(io.fabric8.openshift.api.model.Ingress) RouteIngress(io.fabric8.openshift.api.model.RouteIngress) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder)

Aggregations

ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)5 IngressRule (io.fabric8.kubernetes.api.model.networking.v1.IngressRule)5 IngressSpecBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder)5 HTTPIngressPath (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath)4 HTTPIngressPathBuilder (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPathBuilder)4 HTTPIngressRuleValueBuilder (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValueBuilder)4 IngressBackend (io.fabric8.kubernetes.api.model.networking.v1.IngressBackend)4 IngressBackendBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressBackendBuilder)4 IngressRuleBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressRuleBuilder)4 IngressServiceBackendBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressServiceBackendBuilder)4 IngressSpec (io.fabric8.kubernetes.api.model.networking.v1.IngressSpec)4 ServiceBackendPortBuilder (io.fabric8.kubernetes.api.model.networking.v1.ServiceBackendPortBuilder)4 HashMap (java.util.HashMap)3 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)2 HTTPIngressPathBuilder (io.fabric8.kubernetes.api.model.extensions.HTTPIngressPathBuilder)2 IngressBackendBuilder (io.fabric8.kubernetes.api.model.extensions.IngressBackendBuilder)2 IngressBuilder (io.fabric8.kubernetes.api.model.extensions.IngressBuilder)2 IngressSpecBuilder (io.fabric8.kubernetes.api.model.extensions.IngressSpecBuilder)2 HTTPIngressRuleValue (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressRuleValue)2 IngressBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder)2