@Override public boolean isBuildFailed(String name) { return checkBuildStatus(name, "Error"); }
public static Builder builder() { return new Builder(); }
@Override public boolean delete(String name) { final String sName = Names.sanitize(name); LOGGER.debug("Delete {}", sName); return removeImageStreams(sName) && removeDeploymentConfig(sName) && removeSecret(sName) && removeBuildConfig(sName); }
private DeploymentData createDeploymentData(Integration integration, IntegrationDeployment integrationDeployment) { Properties applicationProperties = IntegrationSupport.buildApplicationProperties(integrationDeployment, dataManager, encryptionComponent); String username = integration.getUserId().orElseThrow(() -> new IllegalStateException("Couldn't find the user of the integration")); return DeploymentData.builder() .addLabel(OpenShiftService.INTEGRATION_ID_LABEL, Labels.sanitize(integrationDeployment.getIntegrationId().orElseThrow(() -> new IllegalStateException("IntegrationDeployment should have an integrationId")))) .addLabel(OpenShiftService.DEPLOYMENT_ID_LABEL, integrationDeployment.getVersion().orElse(0).toString()) .addLabel(OpenShiftService.USERNAME_LABEL, Labels.sanitize(username)) .addSecretEntry("application.properties", propsToString(applicationProperties)) .build(); }
@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); }
@Bean @ConditionalOnProperty(value = "openshift.enabled", matchIfMissing = true, havingValue = "true") public OpenShiftService openShiftService(NamespacedOpenShiftClient openShiftClient, OpenShiftConfigurationProperties openShiftConfigurationProperties) { return new OpenShiftServiceImpl(openShiftClient, openShiftConfigurationProperties); }
@Override public void build(String name, DeploymentData deploymentData, InputStream tarInputStream) throws IOException { final String sName = Names.sanitize(name); ensureImageStreams(sName); ensureBuildConfig(sName, deploymentData, this.config.getBuilderImageStreamTag(), this.config.getImageStreamNamespace()); openShiftClient.buildConfigs().withName(sName) .instantiateBinary() .fromInputStream(tarInputStream); }
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"); }
private boolean isBuildStarted(IntegrationDeployment integrationDeployment) { return openShiftService().isBuildStarted(integrationDeployment.getName()); }
public boolean isRunning(IntegrationDeployment integrationDeployment) { return openShiftService().isScaled(integrationDeployment.getName(), 1); }
@Override public void deploy(String name, DeploymentData deploymentData) { final String sName = Names.sanitize(name); LOGGER.debug("Deploy {}", sName); ensureDeploymentConfig(sName, deploymentData); ensureSecret(sName, deploymentData); }
private boolean isReady(IntegrationDeployment integrationDeployment) { return openShiftService().isDeploymentReady(integrationDeployment.getName()); }
@Bean @ConditionalOnProperty(value = "openshift.enabled", havingValue = "false") public OpenShiftService openNoOpShiftService() { return new OpenShiftServiceNoOp(); }
private boolean isBuildFailed(IntegrationDeployment integrationDeployment) { return openShiftService().isBuildFailed(integrationDeployment.getSpec().getName()); }
private void build(IntegrationDeployment integration, DeploymentData data) throws IOException { InputStream tarInputStream = createProjectFiles(integration.getSpec()); logInfo(integration, "Created project files and starting build"); openShiftService().build(integration.getSpec().getName(), data, tarInputStream); }
private void deploy(IntegrationDeployment integration, DeploymentData data) throws IOException { logInfo(integration, "Starting deployment"); openShiftService().deploy(integration.getSpec().getName(), data); logInfo(integration, "Deployment done"); }
private boolean isBuildStarted(IntegrationDeployment integrationDeployment) { return openShiftService().isBuildStarted(integrationDeployment.getSpec().getName()); }
public boolean isRunning(IntegrationDeployment integrationDeployment) { return openShiftService().isScaled(integrationDeployment.getSpec().getName(), 1); }
@Override public boolean isBuildStarted(String name) { return checkBuildStatus(name, "Running"); }