org.cdk8s.plus.Deployment Maven / Gradle / Ivy
Show all versions of cdk8s-plus Show documentation
package org.cdk8s.plus;
/**
* A Deployment provides declarative updates for Pods and ReplicaSets.
*
* You describe a desired state in a Deployment, and the Deployment Controller changes the actual
* state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove
* existing Deployments and adopt all their resources with new Deployments.
*
*
*
* Note: Do not manage ReplicaSets owned by a Deployment. Consider opening an issue in the main Kubernetes repository if your use case is not covered below.
*
*
*
*
Use Case
*
* The following are typical use cases for Deployments:
*
*
* - Create a Deployment to rollout a ReplicaSet. The ReplicaSet creates Pods in the background.
* Check the status of the rollout to see if it succeeds or not.
* - Declare the new state of the Pods by updating the PodTemplateSpec of the Deployment.
* A new ReplicaSet is created and the Deployment manages moving the Pods from the old ReplicaSet to the new one at a controlled rate.
* Each new ReplicaSet updates the revision of the Deployment.
* - Rollback to an earlier Deployment revision if the current state of the Deployment is not stable.
* Each rollback updates the revision of the Deployment.
* - Scale up the Deployment to facilitate more load.
* - Pause the Deployment to apply multiple fixes to its PodTemplateSpec and then resume it to start a new rollout.
* - Use the status of the Deployment as an indicator that a rollout has stuck.
* - Clean up older ReplicaSets that you don't need anymore.
*
*
* EXPERIMENTAL
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.7.0 (build 179a3a5)", date = "2020-06-29T13:29:38.487Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus.$Module.class, fqn = "cdk8s-plus.Deployment")
public class Deployment extends org.cdk8s.plus.Resource {
protected Deployment(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Deployment(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* EXPERIMENTAL
*
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Deployment(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable org.cdk8s.plus.DeploymentProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* EXPERIMENTAL
*
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Deployment(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* Expose a deployment via a service.
*
* This is equivalent to running kubectl expose deployment <deployment-name>
.
*
* EXPERIMENTAL
*
* @param options - Options. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus.Service expose(final @org.jetbrains.annotations.NotNull org.cdk8s.plus.ExposeOptions options) {
return this.jsiiCall("expose", org.cdk8s.plus.Service.class, new Object[] { java.util.Objects.requireNonNull(options, "options is required") });
}
/**
* The underlying cdk8s API object.
*
* EXPERIMENTAL
*
* @see base.Resource.apiObject
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull org.cdk8s.ApiObject getApiObject() {
return this.jsiiGet("apiObject", org.cdk8s.ApiObject.class);
}
/**
* Provides access to the underlying spec.
*
* You can use this field to apply post instantiation mutations
* to the spec.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus.DeploymentSpecDefinition getSpec() {
return this.jsiiGet("spec", org.cdk8s.plus.DeploymentSpecDefinition.class);
}
/**
* A fluent builder for {@link org.cdk8s.plus.Deployment}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* EXPERIMENTAL
*
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private org.cdk8s.plus.DeploymentProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* Metadata that all persisted resources must have, which includes all objects users must create.
*
* EXPERIMENTAL
*
* @return {@code this}
* @param metadata Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metadata(final org.cdk8s.ApiObjectMetadata metadata) {
this.props().metadata(metadata);
return this;
}
/**
* The spec of the deployment.
*
* Use deployment.spec
to apply post instatiation mutations.
*
* Default: - An empty spec will be created.
*
* EXPERIMENTAL
*
* @return {@code this}
* @param spec The spec of the deployment. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder spec(final org.cdk8s.plus.DeploymentSpec spec) {
this.props().spec(spec);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus.Deployment}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public org.cdk8s.plus.Deployment build() {
return new org.cdk8s.plus.Deployment(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus.DeploymentProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus.DeploymentProps.Builder();
}
return this.props;
}
}
}