use of com.liveperson.ephemerals.provider.kubernetes.wait.KubernetesDeploymentEndpointWaiter in project ephemerals by LivePersonInc.
the class KubernetesDeploymentHandler method deploy.
@Override
public DeploymentEndpoints deploy(Deployment deployment) {
// Create service on KubernetesServiceBuilder cluster
Service service = kubernetesDeploymentStrategy.service(deployment);
kubernetesClient.services().inNamespace(kubernetesClient.getNamespace()).create(service);
// Create pods and replication controller
ReplicationController replicationController = kubernetesDeploymentStrategy.replicationController(deployment);
kubernetesClient.replicationControllers().inNamespace(kubernetesClient.getNamespace()).create(replicationController);
// Wait for deployment to finish by polling KubernetesServiceBuilder and waiting for 'FINISHED' status
KubernetesDeploymentStatusWaiter deploymentStatusWaiter = new KubernetesDeploymentStatusWaiter(kubernetesClient, deployment, DeploymentStatus.FINISHED);
try {
deploymentStatusWaiter.start();
} catch (TimeoutException e) {
throw new DeploymentException(e);
}
DeploymentEndpoints endpoints = new DeploymentEndpoints();
for (DeploymentPort deploymentPort : deployment.getDeploymentUnit().getPorts()) {
KubernetesDeploymentEndpointWaiter kubernetesDeploymentEndpointWaiter = new KubernetesDeploymentEndpointWaiter(kubernetesClient, deployment, deploymentPort);
try {
kubernetesDeploymentEndpointWaiter.start();
endpoints.add(kubernetesDeploymentEndpointWaiter.getEndpoint());
} catch (TimeoutException e) {
throw new DeploymentException(e);
}
}
return endpoints;
}
Aggregations