private String getLabel(IntegrationDeployment integrationDeployment) { return String.format("Integration [%s]", Names.sanitize(integrationDeployment.getName())); }
private boolean isBuildStarted(IntegrationDeployment integrationDeployment) { return openShiftService().isBuildStarted(integrationDeployment.getName()); }
private boolean isReady(IntegrationDeployment integrationDeployment) { return openShiftService().isDeploymentReady(integrationDeployment.getName()); }
public boolean isRunning(IntegrationDeployment integrationDeployment) { return openShiftService().isScaled(integrationDeployment.getName(), 1); }
@Override public StateUpdate execute(IntegrationDeployment integrationDeployment) { IntegrationDeploymentState currentState = !openShiftService().exists(integrationDeployment.getName()) || openShiftService().delete(integrationDeployment.getName()) ? IntegrationDeploymentState.Undeployed : IntegrationDeploymentState.Pending; logInfo(integrationDeployment,"Deleted"); return new StateUpdate(currentState); }
private void build(IntegrationDeployment integrationDeployment, DeploymentData data) throws IOException { InputStream tarInputStream = createProjectFiles(integrationDeployment); logInfo(integrationDeployment, "Created project files and starting build"); openShiftService().build(integrationDeployment.getName(), data, tarInputStream); }
private void deploy(IntegrationDeployment integration, DeploymentData data) throws IOException { logInfo(integration, "Starting deployment"); openShiftService().deploy(integration.getName(), data); logInfo(integration, "Deployment done"); }
@Override public StateUpdate execute(IntegrationDeployment integrationDeployment) { try { openShiftService().scale(integrationDeployment.getName(), 0); logInfo(integrationDeployment,"Deactivated"); } catch (KubernetesClientException e) { // Ignore 404 errors, means the deployment does not exist for us // to scale down if( e.getCode() != 404 ) { throw e; } } IntegrationDeploymentState currentState = openShiftService().isScaled(integrationDeployment.getName(), 0) ? IntegrationDeploymentState.Inactive : IntegrationDeploymentState.Pending; return new StateUpdate(currentState); }