Search in sources :

Example 1 with ServiceStatusBuilder

use of io.fabric8.knative.serving.v1.ServiceStatusBuilder in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class KubernetesResourcePatcher method patchReadyService.

public void patchReadyService(String name, String namespace) {
    // Retrieve the service
    Service service = kubernetesClient.services().inNamespace(namespace).withName(name).get();
    // Fail if it has not been deployed yet
    assertThat(service).isNotNull();
    // Patch the service - This is what k8s would do when the resource is deployed and is ready.
    service.setStatus(new ServiceStatusBuilder().withLoadBalancer(new LoadBalancerStatus()).build());
    kubernetesClient.services().inNamespace(namespace).withName(name).replace(service);
}
Also used : ServiceStatusBuilder(io.fabric8.kubernetes.api.model.ServiceStatusBuilder) Service(io.fabric8.kubernetes.api.model.Service) LoadBalancerStatus(io.fabric8.kubernetes.api.model.LoadBalancerStatus)

Example 2 with ServiceStatusBuilder

use of io.fabric8.knative.serving.v1.ServiceStatusBuilder in project flink-mirror by flink-ci.

the class KubernetesClientTestBase method buildExternalServiceWithLoadBalancer.

protected Service buildExternalServiceWithLoadBalancer(@Nullable String hostname, @Nullable String ip) {
    final ServicePort servicePort = new ServicePortBuilder().withName(Constants.REST_PORT_NAME).withPort(REST_PORT).withNewTargetPort(REST_PORT).build();
    final ServiceStatus serviceStatus = new ServiceStatusBuilder().withLoadBalancer(new LoadBalancerStatus(Collections.singletonList(new LoadBalancerIngress(hostname, ip, new ArrayList<>())))).build();
    return buildExternalService(KubernetesConfigOptions.ServiceExposedType.LoadBalancer, servicePort, serviceStatus, false);
}
Also used : ServicePort(io.fabric8.kubernetes.api.model.ServicePort) ServiceStatusBuilder(io.fabric8.kubernetes.api.model.ServiceStatusBuilder) LoadBalancerIngress(io.fabric8.kubernetes.api.model.LoadBalancerIngress) ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) ServiceStatus(io.fabric8.kubernetes.api.model.ServiceStatus) LoadBalancerStatus(io.fabric8.kubernetes.api.model.LoadBalancerStatus)

Example 3 with ServiceStatusBuilder

use of io.fabric8.knative.serving.v1.ServiceStatusBuilder in project flink by apache.

the class KubernetesClientTestBase method buildExternalServiceWithLoadBalancer.

protected Service buildExternalServiceWithLoadBalancer(@Nullable String hostname, @Nullable String ip) {
    final ServicePort servicePort = new ServicePortBuilder().withName(Constants.REST_PORT_NAME).withPort(REST_PORT).withNewTargetPort(REST_PORT).build();
    final ServiceStatus serviceStatus = new ServiceStatusBuilder().withLoadBalancer(new LoadBalancerStatus(Collections.singletonList(new LoadBalancerIngress(hostname, ip, new ArrayList<>())))).build();
    return buildExternalService(KubernetesConfigOptions.ServiceExposedType.LoadBalancer, servicePort, serviceStatus, false);
}
Also used : ServicePort(io.fabric8.kubernetes.api.model.ServicePort) ServiceStatusBuilder(io.fabric8.kubernetes.api.model.ServiceStatusBuilder) LoadBalancerIngress(io.fabric8.kubernetes.api.model.LoadBalancerIngress) ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) ServiceStatus(io.fabric8.kubernetes.api.model.ServiceStatus) LoadBalancerStatus(io.fabric8.kubernetes.api.model.LoadBalancerStatus)

Example 4 with ServiceStatusBuilder

use of io.fabric8.knative.serving.v1.ServiceStatusBuilder in project flink by splunk.

the class KubernetesClientTestBase method buildExternalServiceWithNodePort.

protected Service buildExternalServiceWithNodePort() {
    final ServicePort servicePort = new ServicePortBuilder().withName(Constants.REST_PORT_NAME).withPort(REST_PORT).withNodePort(NODE_PORT).withNewTargetPort(REST_PORT).build();
    final ServiceStatus serviceStatus = new ServiceStatusBuilder().withLoadBalancer(new LoadBalancerStatus(Collections.emptyList())).build();
    return buildExternalService(KubernetesConfigOptions.ServiceExposedType.NodePort, servicePort, serviceStatus, false);
}
Also used : ServicePort(io.fabric8.kubernetes.api.model.ServicePort) ServiceStatusBuilder(io.fabric8.kubernetes.api.model.ServiceStatusBuilder) ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) ServiceStatus(io.fabric8.kubernetes.api.model.ServiceStatus) LoadBalancerStatus(io.fabric8.kubernetes.api.model.LoadBalancerStatus)

Example 5 with ServiceStatusBuilder

use of io.fabric8.knative.serving.v1.ServiceStatusBuilder in project flink by splunk.

the class KubernetesClientTestBase method buildExternalServiceWithLoadBalancer.

protected Service buildExternalServiceWithLoadBalancer(@Nullable String hostname, @Nullable String ip) {
    final ServicePort servicePort = new ServicePortBuilder().withName(Constants.REST_PORT_NAME).withPort(REST_PORT).withNewTargetPort(REST_PORT).build();
    final ServiceStatus serviceStatus = new ServiceStatusBuilder().withLoadBalancer(new LoadBalancerStatus(Collections.singletonList(new LoadBalancerIngress(hostname, ip, new ArrayList<>())))).build();
    return buildExternalService(KubernetesConfigOptions.ServiceExposedType.LoadBalancer, servicePort, serviceStatus, false);
}
Also used : ServicePort(io.fabric8.kubernetes.api.model.ServicePort) ServiceStatusBuilder(io.fabric8.kubernetes.api.model.ServiceStatusBuilder) LoadBalancerIngress(io.fabric8.kubernetes.api.model.LoadBalancerIngress) ServicePortBuilder(io.fabric8.kubernetes.api.model.ServicePortBuilder) ServiceStatus(io.fabric8.kubernetes.api.model.ServiceStatus) LoadBalancerStatus(io.fabric8.kubernetes.api.model.LoadBalancerStatus)

Aggregations

LoadBalancerStatus (io.fabric8.kubernetes.api.model.LoadBalancerStatus)8 ServiceStatusBuilder (io.fabric8.kubernetes.api.model.ServiceStatusBuilder)8 ServicePort (io.fabric8.kubernetes.api.model.ServicePort)6 ServicePortBuilder (io.fabric8.kubernetes.api.model.ServicePortBuilder)6 ServiceStatus (io.fabric8.kubernetes.api.model.ServiceStatus)6 LoadBalancerIngress (io.fabric8.kubernetes.api.model.LoadBalancerIngress)3 Service (io.fabric8.kubernetes.api.model.Service)2 Service (io.fabric8.knative.serving.v1.Service)1 ServiceBuilder (io.fabric8.knative.serving.v1.ServiceBuilder)1 ServiceList (io.fabric8.knative.serving.v1.ServiceList)1 ServiceStatusBuilder (io.fabric8.knative.serving.v1.ServiceStatusBuilder)1 Test (org.junit.jupiter.api.Test)1