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"));
String integrationId = integrationDeployment.getIntegrationId().orElseThrow(() -> new IllegalStateException("IntegrationDeployment should have an integrationId"));
String version = Integer.toString(integrationDeployment.getVersion());
final Builder deploymentDataBuilder = DeploymentData.builder()
.withVersion(integrationDeployment.getVersion())
.addLabel(OpenShiftService.INTEGRATION_ID_LABEL, Labels.validate(integrationId))
.addLabel(OpenShiftService.DEPLOYMENT_VERSION_LABEL, version)
.addLabel(OpenShiftService.USERNAME_LABEL, Labels.sanitize(username))
.addAnnotation(OpenShiftService.INTEGRATION_NAME_ANNOTATION, integration.getName())
.addAnnotation(OpenShiftService.INTEGRATION_ID_LABEL, integrationId)
.addAnnotation(OpenShiftService.DEPLOYMENT_VERSION_LABEL, version)
.addSecretEntry("application.properties", propsToString(applicationProperties));
integration.getConfiguredProperties().forEach((k, v) -> deploymentDataBuilder.addProperty(k, v));
DeploymentData data = deploymentDataBuilder.build();
if (this.customizers != null && !this.customizers.isEmpty()) {
for (DeploymentDataCustomizer customizer : customizers) {
data = customizer.customize(data, integrationDeployment);
}
}
return data;
}