@Override public StateUpdate execute(IntegrationDeployment integrationDeployment) { try { Thread.sleep(waitMillis); return new StateUpdate(state); } catch (InterruptedException e) { return null; } } }
if (update!=null) { if (LOG.isInfoEnabled()) { LOG.info("{} : Setting status to {}{}", getLabel(integrationDeployment), update.getState(), (update.getStatusMessage() != null ? " (" + update.getStatusMessage() + ")" : "")); if (update.getState() == IntegrationDeploymentState.Undeployed) { dataManager.delete(IntegrationDeployment.class, integrationDeploymentId); } else { .createFrom(current) .currentState(update.getState()) .stepsDone(update.getStepsPerformed()) .createdDate(IntegrationDeploymentState.Active.equals(update.getState()) ? now : integrationDeployment.getCreatedDate()) .lastUpdated(new Date()) .build();
LOG.info("{} : Setting status to {}{}", getLabel(integrationDeployment), update.getState(), Optional.ofNullable(update.getStatusMessage()).map(x->" ("+x+")").orElse("")); .statusMessage(Optional.ofNullable(update.getStatusMessage())) .currentState(update.getState()) .stepsDone(update.getStepsPerformed()) .updatedAt(System.currentTimeMillis()) .build());
@Override public StateUpdate execute(IntegrationDeployment integrationDeployment) { try { Thread.sleep(waitMillis); return new StateUpdate(state); } catch (InterruptedException e) { return null; } } }
@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); }
if (userIntegrations >= maxIntegrationsPerUser) { return new StateUpdate(IntegrationDeploymentState.Unpublished, "User has currently " + userIntegrations + " integrations, while the maximum allowed number is " + maxIntegrationsPerUser + "."); if (userDeployments >= maxDeploymentsPerUser) { return new StateUpdate(IntegrationDeploymentState.Unpublished, "User has currently " + userDeployments + " deployments, while the maximum allowed number is " + maxDeploymentsPerUser + "."); return new StateUpdate(IntegrationDeploymentState.Error, stepPerformer.getStepsPerformed(), "Error"); logError(integrationDeployment, "[ERROR] Activation failure", e); return new StateUpdate(IntegrationDeploymentState.Pending, e.getMessage()); logInfo(integrationDeployment, "[ACTIVATED] bc. integration is running with 1 pod"); updateDeploymentState(integrationDeployment, IntegrationDeploymentState.Published); return new StateUpdate(IntegrationDeploymentState.Published); logInfo(integrationDeployment, "[PENDING] [" + stepPerformer.getStepsPerformed() + "]"); return new StateUpdate(IntegrationDeploymentState.Pending, stepPerformer.getStepsPerformed());
if (userIntegrations >= maxIntegrationsPerUser) { return new StateUpdate(IntegrationDeploymentState.Inactive, "User has currently " + userIntegrations + " integrations, while the maximum allowed number is " + maxIntegrationsPerUser + "."); if (userDeployments >= maxDeploymentsPerUser) { return new StateUpdate(IntegrationDeploymentState.Inactive, "User has currently " + userDeployments + " deployments, while the maximum allowed number is " + maxDeploymentsPerUser + "."); logError(integrationDeployment, "[ERROR] Activation failure"); return new StateUpdate(IntegrationDeploymentState.Pending, e.getMessage()); logInfo(integrationDeployment, "[ACTIVATED] bc. integration is running with 1 pod"); updateIntegration(integrationDeployment, IntegrationDeploymentState.Active); return new StateUpdate(IntegrationDeploymentState.Active); logInfo(integrationDeployment, "[PENDING] [" + stepPerformer.getStepsPerformed() + "]"); return new StateUpdate(IntegrationDeploymentState.Pending, stepPerformer.getStepsPerformed());
@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); }
@Override public StateUpdate execute(IntegrationDeployment integrationDeployment) { IntegrationDeploymentState currentState = !openShiftService().exists(integrationDeployment.getSpec().getName()) || openShiftService().delete(integrationDeployment.getSpec().getName()) ? IntegrationDeploymentState.Unpublished : IntegrationDeploymentState.Pending; if (currentState == IntegrationDeploymentState.Unpublished) { logInfo(integrationDeployment,"Deleted"); IntegrationDeployment updated = new IntegrationDeployment.Builder().createFrom(integrationDeployment).addAllStepsDone(Collections.emptyList()).build(); dataManager.update(updated); } return new StateUpdate(currentState); }