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(); }
private void ensureSecret(String name, DeploymentData deploymentData) { openShiftClient.secrets().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withStringData(deploymentData.getSecret()) .done(); }
.withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withNewSpec()
.withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withNewSpec() .addToLabels("integration", name) .addToLabels(COMPONENT_LABEL, "integration") .addToLabels(deploymentData.getLabels()) .addToAnnotations(deploymentData.getAnnotations()) .addToAnnotations("prometheus.io/scrape", "true") .addToAnnotations("prometheus.io/port", "9779")
.withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withStringData(deploymentData.getSecret()) .build(); .withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withNewSpec() .addToLabels("integration", name) .addToLabels(OpenShiftServiceImpl.COMPONENT_LABEL, "integration") .addToLabels(deploymentData.getLabels()) .addToAnnotations(deploymentData.getAnnotations()) .addToAnnotations("prometheus.io/scrape", "true") .addToAnnotations("prometheus.io/port", "9779")
private DeploymentData createDeploymentData(Integration integration, IntegrationDeployment integrationDeployment) { Properties applicationProperties = projectGenerator.generateApplicationProperties(integration); String username = integrationDeployment.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, Integer.toString(integrationDeployment.getVersion())) .addLabel(OpenShiftService.USERNAME_LABEL, Labels.sanitize(username)) .addAnnotation(OpenShiftService.INTEGRATION_NAME_ANNOTATION, integration.getName()) .addAnnotation(OpenShiftService.INTEGRATION_ID_ANNOTATION, integrationDeployment.getIntegrationId().get()) .addAnnotation(OpenShiftService.DEPLOYMENT_VERSION_ANNOTATION, Integer.toString(integrationDeployment.getVersion())) .addSecretEntry("application.properties", propsToString(applicationProperties)) .build(); }