use of io.kubernetes.client.openapi.models.V1DeploymentStatus in project plugins by qlangtech.
the class FlinkK8SClusterManager method getRCDeployment.
@Override
public RcDeployment getRCDeployment() {
RcDeployment deployment = new RcDeployment();
K8sImage k8sImage = this.getK8SImage();
ApiClient apiClient = k8sImage.createApiClient();
AppsV1Api appsApi = new AppsV1Api(apiClient);
CoreV1Api coreApi = new CoreV1Api(apiClient);
// String name, String namespace, String pretty, Boolean exact, Boolean export
try {
V1Deployment deploy = appsApi.readNamespacedDeployment(this.clusterId, k8sImage.getNamespace(), "true", null, null);
K8SController.fillSpecInfo(deployment, deploy.getSpec().getReplicas(), deploy.getSpec().getTemplate());
V1DeploymentStatus status = deploy.getStatus();
RcDeployment.ReplicationControllerStatus deploymentStatus = new RcDeployment.ReplicationControllerStatus();
deploymentStatus.setAvailableReplicas(status.getAvailableReplicas());
deploymentStatus.setFullyLabeledReplicas(0);
deploymentStatus.setObservedGeneration(status.getObservedGeneration());
deploymentStatus.setReadyReplicas(status.getReadyReplicas());
deploymentStatus.setReplicas(status.getReplicas());
deployment.setStatus(deploymentStatus);
K8SController.fillCreateTimestamp(deployment, deploy.getMetadata());
K8SController.fillPods(coreApi, k8sImage, deployment, new TargetResName(this.clusterId));
} catch (ApiException e) {
throw K8sExceptionUtils.convert(this.clusterId, e);
}
return deployment;
}
Aggregations