@Generated(value="jsii-pacmak/1.34.0 (build 9b72778)", date="2021-09-21T00:27:37.462Z") @Stability(value=Stable) public class Deployment extends Resource implements IPodTemplate
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.
The following are typical use cases for Deployments:
| Modifier and Type | Class and Description |
|---|---|
static class |
Deployment.Builder
A fluent builder for
Deployment. |
software.amazon.jsii.JsiiObject.InitializationModeIPodTemplate.Jsii$Default, IPodTemplate.Jsii$ProxyIResource.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
Deployment(software.constructs.Construct scope,
String id) |
|
Deployment(software.constructs.Construct scope,
String id,
DeploymentProps props) |
protected |
Deployment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Deployment(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Container |
addContainer(ContainerProps container)
Add a container to the pod.
|
void |
addVolume(Volume volume)
Add a volume to the pod.
|
Service |
expose(Number port)
Expose a deployment via a service.
|
Service |
expose(Number port,
ExposeOptions options)
Expose a deployment via a service.
|
protected org.cdk8s.ApiObject |
getApiObject()
The underlying cdk8s API object.
|
List<Container> |
getContainers()
The containers belonging to the pod.
|
Map<String,String> |
getLabelSelector()
The labels this deployment will match against in order to select pods.
|
org.cdk8s.ApiObjectMetadataDefinition |
getPodMetadata()
Provides read/write access to the underlying pod metadata of the resource.
|
Number |
getReplicas()
Number of desired pods.
|
RestartPolicy |
getRestartPolicy()
Restart policy for all containers within the pod.
|
IServiceAccount |
getServiceAccount()
The service account used to run this pod.
|
List<Volume> |
getVolumes()
The volumes associated with this pod.
|
void |
selectByLabel(String key,
String value)
Configure a label selector to this deployment.
|
getMetadata, getNameonPrepare, onSynthesize, onValidate, toStringjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Deployment(software.amazon.jsii.JsiiObjectRef objRef)
protected Deployment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Deployment(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
DeploymentProps props)
scope - This parameter is required.id - This parameter is required.props - @Stability(value=Stable)
public Deployment(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Stable) @NotNull public Container addContainer(@NotNull ContainerProps container)
addContainer in interface IPodSpeccontainer - This parameter is required.@Stability(value=Stable)
public void addVolume(@NotNull
Volume volume)
@Stability(value=Stable) @NotNull public Service expose(@NotNull Number port, @Nullable ExposeOptions options)
This is equivalent to running kubectl expose deployment <deployment-name>.
port - The port number the service will bind to. This parameter is required.options - Options to determine details of the service and port exposed.@Stability(value=Stable) @NotNull public Service expose(@NotNull Number port)
This is equivalent to running kubectl expose deployment <deployment-name>.
port - The port number the service will bind to. This parameter is required.@Stability(value=Stable)
public void selectByLabel(@NotNull
String key,
@NotNull
String value)
Pods that have the label will be selected by deployments configured with this spec.
key - - The label key. This parameter is required.value - - The label value. This parameter is required.@Stability(value=Stable) @NotNull protected org.cdk8s.ApiObject getApiObject()
getApiObject in class Resourcebase.Resource.apiObject@Stability(value=Stable) @NotNull public List<Container> getContainers()
Use addContainer to add containers.
getContainers in interface IPodSpec@Stability(value=Stable) @NotNull public Map<String,String> getLabelSelector()
Returns a a copy. Use selectByLabel() to add labels.
@Stability(value=Stable) @NotNull public org.cdk8s.ApiObjectMetadataDefinition getPodMetadata()
getPodMetadata in interface IPodTemplate@Stability(value=Stable) @NotNull public Number getReplicas()
@Stability(value=Stable) @NotNull public List<Volume> getVolumes()
Use addVolume to add volumes.
getVolumes in interface IPodSpec@Stability(value=Stable) @Nullable public RestartPolicy getRestartPolicy()
getRestartPolicy in interface IPodSpec@Stability(value=Stable) @Nullable public IServiceAccount getServiceAccount()
getServiceAccount in interface IPodSpecCopyright © 2021. All rights reserved.