use of io.fabric8.openshift.api.model.DeploymentTriggerPolicyBuilder in project strimzi by strimzi.
the class KafkaConnectS2ICluster method generateDeploymentConfig.
/**
* Generate new DeploymentConfig
*
* @return Source ImageStream resource definition
*/
public DeploymentConfig generateDeploymentConfig() {
Container container = new ContainerBuilder().withName(name).withImage(image).withEnv(getEnvVars()).withPorts(Collections.singletonList(createContainerPort(REST_API_PORT_NAME, REST_API_PORT, "TCP"))).withLivenessProbe(createHttpProbe(healthCheckPath, REST_API_PORT_NAME, healthCheckInitialDelay, healthCheckTimeout)).withReadinessProbe(createHttpProbe(healthCheckPath, REST_API_PORT_NAME, healthCheckInitialDelay, healthCheckTimeout)).build();
DeploymentTriggerPolicy configChangeTrigger = new DeploymentTriggerPolicyBuilder().withType("ConfigChange").build();
DeploymentTriggerPolicy imageChangeTrigger = new DeploymentTriggerPolicyBuilder().withType("ImageChange").withNewImageChangeParams().withAutomatic(true).withContainerNames(name).withNewFrom().withKind("ImageStreamTag").withName(image).endFrom().endImageChangeParams().build();
DeploymentStrategy updateStrategy = new DeploymentStrategyBuilder().withType("Rolling").withNewRollingParams().withMaxSurge(new IntOrString(1)).withMaxUnavailable(new IntOrString(0)).endRollingParams().build();
DeploymentConfig dc = new DeploymentConfigBuilder().withNewMetadata().withName(name).withLabels(getLabelsWithName()).withNamespace(namespace).endMetadata().withNewSpec().withReplicas(replicas).withNewTemplate().withNewMetadata().withLabels(getLabelsWithName()).endMetadata().withNewSpec().withContainers(container).endSpec().endTemplate().withTriggers(configChangeTrigger, imageChangeTrigger).withStrategy(updateStrategy).endSpec().build();
return dc;
}
use of io.fabric8.openshift.api.model.DeploymentTriggerPolicyBuilder in project syndesis-qe by syndesisio.
the class ExternalDatabase method deploy.
@Override
public void deploy() {
OpenShiftUtils.getInstance().deploymentConfigs().createOrReplaceWithNew().withNewMetadata().withName(NAME).withLabels(TestUtils.map("app", NAME)).endMetadata().withNewSpec().withReplicas(1).withNewTemplate().withNewMetadata().withLabels(TestUtils.map("app", NAME)).endMetadata().withNewSpec().withContainers(new ContainerBuilder().withEnv(new EnvVar("POSTGRESQL_DATABASE", "testdb", null), new EnvVar("POSTGRESQL_PASSWORD", "testpassword", null), new EnvVar("POSTGRESQL_USER", "testuser", null)).withPorts(new ContainerPortBuilder().withContainerPort(5432).withProtocol("TCP").build()).withName(NAME).withImage(" ").build()).endSpec().endTemplate().withSelector(TestUtils.map("app", NAME)).withTriggers(new DeploymentTriggerPolicyBuilder().withNewImageChangeParams().withContainerNames(NAME).withFrom(new ObjectReferenceBuilder().withKind("ImageStreamTag").withName("postgresql:12").withNamespace("openshift").build()).withAutomatic(true).endImageChangeParams().withNewType("ImageChange").build()).endSpec().done();
OpenShiftUtils.getInstance().services().createOrReplaceWithNew().withNewMetadata().withName(NAME).withLabels(TestUtils.map("app", NAME)).endMetadata().withNewSpec().addToPorts(new ServicePortBuilder().withNewName("5432-tcp").withNewTargetPort(5432).withNewProtocol("TCP").withPort(5432).build()).addToSelector(TestUtils.map("app", NAME)).endSpec().done();
// create a needed secret with the password
OpenShiftUtils.getInstance().secrets().createOrReplaceWithNew().withNewMetadata().withName("syndesis-global-config").endMetadata().withStringData(TestUtils.map("POSTGRESQL_PASSWORD", "testpassword")).withNewType("Opaque").done();
}
Aggregations