public void run() { DeploymentConfig deployment = operation.getMandatory(); if (observedGeneration <= deployment.getStatus().getObservedGeneration()) { countDownLatch.countDown(); } } };
public void run() { try { DeploymentConfig deploymentConfig = get(); //If the rs is gone, we shouldn't wait. if (deploymentConfig == null) { if (count == 0) { queue.put(true); return; } else { queue.put(new IllegalStateException("Can't wait for DeploymentConfig: " + checkName(getItem()) + " in namespace: " + checkName(getItem()) + " to scale. Resource is no longer available.")); return; } } replicasRef.set(deploymentConfig.getStatus().getReplicas()); int currentReplicas = deploymentConfig.getStatus().getReplicas() != null ? deploymentConfig.getStatus().getReplicas() : 0; if (deploymentConfig.getStatus().getObservedGeneration() >= deploymentConfig.getMetadata().getGeneration() && Objects.equals(deploymentConfig.getSpec().getReplicas(), currentReplicas)) { queue.put(true); } else { LOG.debug("Only {}/{} pods scheduled for DeploymentConfig: {} in namespace: {} seconds so waiting...", deploymentConfig.getStatus().getReplicas(), deploymentConfig.getSpec().getReplicas(), deploymentConfig.getMetadata().getName(), namespace); } } catch (Throwable t) { LOG.error("Error while waiting for Deployment to be scaled.", t); } } };
@Override public boolean reap() { DeploymentConfig deployment = operation.cascading(false).edit().editSpec().withReplicas(0).endSpec().done(); //TODO: These checks shouldn't be used as they are not realistic. We just use them to support mock/crud tests. Need to find a cleaner way to do so. if (deployment.getStatus() != null) { waitForObservedGeneration(deployment.getStatus().getObservedGeneration()); } //We are deleting the DC before reaping the replication controller, because the RC's won't go otherwise. Boolean reaped = operation.cascading(false).delete(); // Waiting for the DC to be completely deleted before removing the replication controller (error in Openshift 3.9) waitForDeletion(); Map<String, String> selector = new HashMap<>(); selector.put(DEPLOYMENT_CONFIG_REF, deployment.getMetadata().getName()); if (selector != null && !selector.isEmpty()) { Boolean deleted = new ReplicationControllerOperationsImpl(client, operation.getConfig(), operation.getNamespace()) .withLabels(selector) .delete(); } return reaped; }
public void run() { DeploymentConfig deployment = operation.getMandatory(); if (observedGeneration <= deployment.getStatus().getObservedGeneration()) { countDownLatch.countDown(); } } };
public void run() { try { DeploymentConfig deploymentConfig = get(); //If the rs is gone, we shouldn't wait. if (deploymentConfig == null) { if (count == 0) { queue.put(true); return; } else { queue.put(new IllegalStateException("Can't wait for DeploymentConfig: " + checkName(getItem()) + " in namespace: " + checkName(getItem()) + " to scale. Resource is no longer available.")); return; } } replicasRef.set(deploymentConfig.getStatus().getReplicas()); int currentReplicas = deploymentConfig.getStatus().getReplicas() != null ? deploymentConfig.getStatus().getReplicas() : 0; if (deploymentConfig.getStatus().getObservedGeneration() >= deploymentConfig.getMetadata().getGeneration() && Objects.equals(deploymentConfig.getSpec().getReplicas(), currentReplicas)) { queue.put(true); } else { LOG.debug("Only {}/{} pods scheduled for DeploymentConfig: {} in namespace: {} seconds so waiting...", deploymentConfig.getStatus().getReplicas(), deploymentConfig.getSpec().getReplicas(), deploymentConfig.getMetadata().getName(), namespace); } } catch (Throwable t) { LOG.error("Error while waiting for Deployment to be scaled.", t); } } };
@Override public boolean reap() { DeploymentConfig deployment = operation.cascading(false).edit().editSpec().withReplicas(0).endSpec().done(); //TODO: These checks shouldn't be used as they are not realistic. We just use them to support mock/crud tests. Need to find a cleaner way to do so. if (deployment.getStatus() != null) { waitForObservedGeneration(deployment.getStatus().getObservedGeneration()); } //We are deleting the DC before reaping the replication controller, because the RC's won't go otherwise. Boolean reaped = operation.cascading(false).delete(); // Waiting for the DC to be completely deleted before removing the replication controller (error in Openshift 3.9) waitForDeletion(); Map<String, String> selector = new HashMap<>(); selector.put(DEPLOYMENT_CONFIG_REF, deployment.getMetadata().getName()); if (selector != null && !selector.isEmpty()) { Boolean deleted = new ReplicationControllerOperationsImpl(client, operation.getConfig(), operation.getNamespace()) .withLabels(selector) .delete(); } return reaped; }
public DeploymentConfigStatusBuilder(DeploymentConfigStatus instance,Boolean validationEnabled){ this.fluent = this; this.withAvailableReplicas(instance.getAvailableReplicas()); this.withDetails(instance.getDetails()); this.withLatestVersion(instance.getLatestVersion()); this.withObservedGeneration(instance.getObservedGeneration()); this.withReplicas(instance.getReplicas()); this.withUnavailableReplicas(instance.getUnavailableReplicas()); this.withUpdatedReplicas(instance.getUpdatedReplicas()); this.validationEnabled = validationEnabled; }
public DeploymentConfigStatusFluentImpl(DeploymentConfigStatus instance){ this.withAvailableReplicas(instance.getAvailableReplicas()); this.withDetails(instance.getDetails()); this.withLatestVersion(instance.getLatestVersion()); this.withObservedGeneration(instance.getObservedGeneration()); this.withReplicas(instance.getReplicas()); this.withUnavailableReplicas(instance.getUnavailableReplicas()); this.withUpdatedReplicas(instance.getUpdatedReplicas()); }
public DeploymentConfigStatusBuilder(DeploymentConfigStatusFluent<?> fluent,DeploymentConfigStatus instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withAvailableReplicas(instance.getAvailableReplicas()); fluent.withDetails(instance.getDetails()); fluent.withLatestVersion(instance.getLatestVersion()); fluent.withObservedGeneration(instance.getObservedGeneration()); fluent.withReplicas(instance.getReplicas()); fluent.withUnavailableReplicas(instance.getUnavailableReplicas()); fluent.withUpdatedReplicas(instance.getUpdatedReplicas()); this.validationEnabled = validationEnabled; } public DeploymentConfigStatusBuilder(DeploymentConfigStatus instance){