@Generated(value="jsii-pacmak/1.34.0 (build 9b72778)", date="2021-09-24T22:49:58.436Z") @Stability(value=Stable) public class StatefulSet extends Resource implements IPodTemplate
Manages the deployment and scaling of a set of Pods, and provides guarantees about the ordering and uniqueness of these Pods.
Like a Deployment, a StatefulSet manages Pods that are based on an identical container spec. Unlike a Deployment, a StatefulSet maintains a sticky identity for each of their Pods. These pods are created from the same spec, but are not interchangeable: each has a persistent identifier that it maintains across any rescheduling.
If you want to use storage volumes to provide persistence for your workload, you can use a StatefulSet as part of the solution. Although individual Pods in a StatefulSet are susceptible to failure, the persistent Pod identifiers make it easier to match existing volumes to the new Pods that replace any that have failed.
StatefulSets are valuable for applications that require one or more of the following.
| Modifier and Type | Class and Description |
|---|---|
static class |
StatefulSet.Builder
A fluent builder for
StatefulSet. |
software.amazon.jsii.JsiiObject.InitializationModeIPodTemplate.Jsii$Default, IPodTemplate.Jsii$ProxyIResource.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
StatefulSet(software.constructs.Construct scope,
String id,
StatefulSetProps props) |
protected |
StatefulSet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
StatefulSet(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.
|
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 statefulset will match against in order to select pods.
|
PodManagementPolicy |
getPodManagementPolicy()
Management policy to use for the set.
|
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 StatefulSet(software.amazon.jsii.JsiiObjectRef objRef)
protected StatefulSet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public StatefulSet(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
StatefulSetProps props)
scope - This parameter is required.id - This parameter is required.props - 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)
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 PodManagementPolicy getPodManagementPolicy()
@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.