Class Deployment
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- software.constructs.Construct
-
- org.cdk8s.plus24.Resource
-
- org.cdk8s.plus24.AbstractPod
-
- org.cdk8s.plus24.Workload
-
- org.cdk8s.plus24.Deployment
-
- All Implemented Interfaces:
IApiEndpoint
,IApiResource
,INetworkPolicyPeer
,IPodSelector
,IResource
,IScalable
,ISubject
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.72.0 (build 4b8828b)", date="2022-12-22T02:29:49.477Z") @Stability(Stable) public class Deployment extends Workload implements IScalable
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Deployment.Builder
A fluent builder forDeployment
.-
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IApiEndpoint
IApiEndpoint.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IApiResource
IApiResource.Jsii$Default
-
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.INetworkPolicyPeer
INetworkPolicyPeer.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IPodSelector
IPodSelector.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IResource
IResource.Jsii$Default
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.IScalable
IScalable.Jsii$Default, IScalable.Jsii$Proxy
-
Nested classes/interfaces inherited from interface org.cdk8s.plus24.ISubject
ISubject.Jsii$Default
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Deployment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected
Deployment(software.amazon.jsii.JsiiObjectRef objRef)
Deployment(software.constructs.Construct scope, String id)
Deployment(software.constructs.Construct scope, String id, DeploymentProps props)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Ingress
exposeViaIngress(String path)
Expose a deployment via an ingress.Ingress
exposeViaIngress(String path, ExposeDeploymentViaIngressOptions options)
Expose a deployment via an ingress.Service
exposeViaService()
Expose a deployment via a service.Service
exposeViaService(DeploymentExposeViaServiceOptions options)
Expose a deployment via a service.protected org.cdk8s.ApiObject
getApiObject()
The underlying cdk8s API object.Boolean
getHasAutoscaler()
If this is a target of an autoscaler.org.cdk8s.Duration
getMinReady()
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.org.cdk8s.Duration
getProgressDeadline()
The maximum duration for a deployment to make progress before it is considered to be failed.Number
getReplicas()
Number of desired pods.String
getResourceType()
The name of a resource type as it appears in the relevant API endpoint.DeploymentStrategy
getStrategy()
void
markHasAutoscaler()
Called on all IScalable targets when they are associated with an autoscaler.void
setHasAutoscaler(Boolean value)
If this is a target of an autoscaler.ScalingTarget
toScalingTarget()
Return the target spec properties of this Scalable.-
Methods inherited from class org.cdk8s.plus24.Workload
getConnections, getMatchExpressions, getMatchLabels, getPodMetadata, getScheduling, select
-
Methods inherited from class org.cdk8s.plus24.AbstractPod
addContainer, addHostAlias, addInitContainer, addVolume, attachContainer, getAutomountServiceAccountToken, getContainers, getDns, getDockerRegistryAuth, getHostAliases, getInitContainers, getIsolate, getRestartPolicy, getSecurityContext, getServiceAccount, getVolumes, toNetworkPolicyPeerConfig, toPodSelector, toPodSelectorConfig, toSubjectConfiguration
-
Methods inherited from class org.cdk8s.plus24.Resource
asApiResource, asNonApiResource, getApiGroup, getApiVersion, getKind, getMetadata, getName, getPermissions, getResourceName
-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Constructor Detail
-
Deployment
protected Deployment(software.amazon.jsii.JsiiObjectRef objRef)
-
Deployment
protected Deployment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
Deployment
@Stability(Stable) public Deployment(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable DeploymentProps props)
- Parameters:
scope
- This parameter is required.id
- This parameter is required.props
-
-
Deployment
@Stability(Stable) public Deployment(@NotNull software.constructs.Construct scope, @NotNull String id)
- Parameters:
scope
- This parameter is required.id
- This parameter is required.
-
-
Method Detail
-
exposeViaIngress
@Stability(Stable) @NotNull public Ingress exposeViaIngress(@NotNull String path, @Nullable ExposeDeploymentViaIngressOptions options)
Expose a deployment via an ingress.This will first expose the deployment with a service, and then expose the service via an ingress.
- Parameters:
path
- The ingress path to register under. This parameter is required.options
- Additional options.
-
exposeViaIngress
@Stability(Stable) @NotNull public Ingress exposeViaIngress(@NotNull String path)
Expose a deployment via an ingress.This will first expose the deployment with a service, and then expose the service via an ingress.
- Parameters:
path
- The ingress path to register under. This parameter is required.
-
exposeViaService
@Stability(Stable) @NotNull public Service exposeViaService(@Nullable DeploymentExposeViaServiceOptions options)
Expose a deployment via a service.This is equivalent to running
kubectl expose deployment <deployment-name>
.- Parameters:
options
- Options to determine details of the service and port exposed.
-
exposeViaService
@Stability(Stable) @NotNull public Service exposeViaService()
Expose a deployment via a service.This is equivalent to running
kubectl expose deployment <deployment-name>
.
-
markHasAutoscaler
@Stability(Stable) public void markHasAutoscaler()
Called on all IScalable targets when they are associated with an autoscaler.- Specified by:
markHasAutoscaler
in interfaceIScalable
- See Also:
- IScalable.markHasAutoscaler()
-
toScalingTarget
@Stability(Stable) @NotNull public ScalingTarget toScalingTarget()
Return the target spec properties of this Scalable.- Specified by:
toScalingTarget
in interfaceIScalable
- See Also:
- IScalable.toScalingTarget()
-
getApiObject
@Stability(Stable) @NotNull protected org.cdk8s.ApiObject getApiObject()
The underlying cdk8s API object.- Specified by:
getApiObject
in classResource
- See Also:
- base.Resource.apiObject
-
getMinReady
@Stability(Stable) @NotNull public org.cdk8s.Duration getMinReady()
Minimum duration for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
-
getProgressDeadline
@Stability(Stable) @NotNull public org.cdk8s.Duration getProgressDeadline()
The maximum duration for a deployment to make progress before it is considered to be failed.
-
getResourceType
@Stability(Stable) @NotNull public String getResourceType()
The name of a resource type as it appears in the relevant API endpoint.- Specified by:
getResourceType
in interfaceIApiResource
- Specified by:
getResourceType
in classResource
- See Also:
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/#referring-to-resources
-
getStrategy
@Stability(Stable) @NotNull public DeploymentStrategy getStrategy()
-
getReplicas
@Stability(Stable) @Nullable public Number getReplicas()
Number of desired pods.
-
getHasAutoscaler
@Stability(Stable) @NotNull public Boolean getHasAutoscaler()
If this is a target of an autoscaler.- Specified by:
getHasAutoscaler
in interfaceIScalable
-
setHasAutoscaler
@Stability(Stable) public void setHasAutoscaler(@NotNull Boolean value)
If this is a target of an autoscaler.- Specified by:
setHasAutoscaler
in interfaceIScalable
-
-