public DeploymentConfig done(){ return function.apply(builder.build()); }
@Override public void scale(String name, Map<String, String> labels, int desiredReplicas, long amount, TimeUnit timeUnit) throws InterruptedException { String sName = openshiftName(name); getDeploymentsByLabel(labels) .stream() .filter(d -> d.getMetadata().getName().equals(sName)) .map(d -> new DeploymentConfigBuilder(d).editSpec().withReplicas(desiredReplicas).endSpec().build()) .findAny().ifPresent(d -> openShiftClient.deploymentConfigs().createOrReplace(d)); }
@Override public HasMetadata convert(HasMetadata item, boolean trimImageInContainerSpec, boolean enableAutomaticTrigger) { if (item instanceof DeploymentConfig) { DeploymentConfig resource = (DeploymentConfig) item; if (openshiftDeployTimeoutSeconds != null && openshiftDeployTimeoutSeconds > 0) { DeploymentConfigBuilder builder = new DeploymentConfigBuilder(resource); DeploymentConfigFluent.SpecNested<DeploymentConfigBuilder> specBuilder; if (resource.getSpec() != null) { specBuilder = builder.editSpec(); } else { specBuilder = builder.withNewSpec(); } specBuilder.withNewStrategy().withType("Rolling"). withNewRollingParams().withTimeoutSeconds(openshiftDeployTimeoutSeconds).endRollingParams().endStrategy(); specBuilder.endSpec(); return builder.build(); } } return item; } }
return builder.build();
@Override protected DeploymentConfig resource() { return new DeploymentConfigBuilder().withNewMetadata() .withNamespace(NAMESPACE) .withName(RESOURCE_NAME) .endMetadata() .withNewSpec() .withNewTemplate() .withNewSpec() .addToContainers(new ContainerBuilder().withImage("img").build()) .endSpec() .endTemplate() .endSpec().build(); }
.withTemplate(template) .endSpec() .build(); client.deploymentConfigs().inNamespace(namespace).create(deployment); ExitCondition exitCondition = new ExitCondition() {
.withStrategy(updateStrategy) .endSpec() .build(); return dc;
.endSpec() .withNewStatus().withLatestVersion(1L).endStatus() .build();