pub trait StatefulSetExt: ResourceBuilder {
Show 17 methods
// Required methods
fn new(name: impl ToString) -> Self;
fn with_labels(
name: impl ToString,
labels: impl IntoIterator<Item = (impl ToString, impl ToString)>,
) -> Self;
fn spec(self, spec: StatefulSetSpec) -> Self;
fn replicas(self, replicas: i32) -> Self;
fn min_ready_seconds(self, seconds: i32) -> Self;
fn selector(self, selector: LabelSelector) -> Self;
fn match_labels(
self,
match_labels: impl IntoIterator<Item = (impl ToString, impl ToString)>,
) -> Self;
fn service_name(self, service_name: impl ToString) -> Self;
fn revision_history_limit(self, limit: i32) -> Self;
fn template(self, template: PodTemplateSpec) -> Self;
fn ordinals(self, ordinals: i32) -> Self;
fn update_strategy(self, strategy: StatefulSetUpdateStrategy) -> Self;
fn pod_management_policy(self, policy: impl ToString) -> Self;
fn ordered_ready(self) -> Self;
fn parallel(self) -> Self;
fn volume_claim_templates(
self,
templates: impl IntoIterator<Item = PersistentVolumeClaim>,
) -> Self;
fn persistent_volume_claim_retention_policy(
self,
policy: StatefulSetPersistentVolumeClaimRetentionPolicy,
) -> Self;
}Required Methods§
Sourcefn new(name: impl ToString) -> Self
fn new(name: impl ToString) -> Self
Create a new StatefulSet with the given name.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset");
assert_eq!(statefulset.metadata.name, Some("my-statefulset".to_string()));Sourcefn with_labels(
name: impl ToString,
labels: impl IntoIterator<Item = (impl ToString, impl ToString)>,
) -> Self
fn with_labels( name: impl ToString, labels: impl IntoIterator<Item = (impl ToString, impl ToString)>, ) -> Self
Create a new StatefulSet with the given name and labels.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::with_labels(
"my-statefulset",
[("app", "my-app"), ("version", "v1")]
);Sourcefn spec(self, spec: StatefulSetSpec) -> Self
fn spec(self, spec: StatefulSetSpec) -> Self
Set the spec for the StatefulSet.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let spec = appsv1::StatefulSetSpec::default();
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.spec(spec);Sourcefn replicas(self, replicas: i32) -> Self
fn replicas(self, replicas: i32) -> Self
Set the number of replicas for the StatefulSet.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.replicas(3);Sourcefn min_ready_seconds(self, seconds: i32) -> Self
fn min_ready_seconds(self, seconds: i32) -> Self
Set the minimum ready seconds for the StatefulSet.
Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.min_ready_seconds(30);Sourcefn selector(self, selector: LabelSelector) -> Self
fn selector(self, selector: LabelSelector) -> Self
Set the selector for the StatefulSet.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::metav1;
use k8s_openapi_ext::StatefulSetExt;
let selector = metav1::LabelSelector::default();
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.selector(selector);Sourcefn match_labels(
self,
match_labels: impl IntoIterator<Item = (impl ToString, impl ToString)>,
) -> Self
fn match_labels( self, match_labels: impl IntoIterator<Item = (impl ToString, impl ToString)>, ) -> Self
Set the matchLabels for the StatefulSet’s selector.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.match_labels([("app", "my-app"), ("version", "v1")]);Sourcefn service_name(self, service_name: impl ToString) -> Self
fn service_name(self, service_name: impl ToString) -> Self
Set the service name for the StatefulSet.
The service name is used to govern the StatefulSet and must be the name of an existing headless service.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.service_name("my-headless-service");Sourcefn revision_history_limit(self, limit: i32) -> Self
fn revision_history_limit(self, limit: i32) -> Self
Set the revision history limit for the StatefulSet.
The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.revision_history_limit(5);Sourcefn template(self, template: PodTemplateSpec) -> Self
fn template(self, template: PodTemplateSpec) -> Self
Set the pod template spec for the StatefulSet.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::corev1;
use k8s_openapi_ext::StatefulSetExt;
let template = corev1::PodTemplateSpec::default();
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.template(template);Sourcefn ordinals(self, ordinals: i32) -> Self
fn ordinals(self, ordinals: i32) -> Self
Set the starting ordinal for the StatefulSet.
Controls the starting ordinal number for the StatefulSet pods. By default, pods start from ordinal 0.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.ordinals(1); // Pods will start from ordinal 1Sourcefn update_strategy(self, strategy: StatefulSetUpdateStrategy) -> Self
fn update_strategy(self, strategy: StatefulSetUpdateStrategy) -> Self
Set the update strategy for the StatefulSet.
Update strategy indicates the StatefulSetUpdateStrategy that will be employed to update pods when a revision is made to the template.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let strategy = appsv1::StatefulSetUpdateStrategy::default();
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.update_strategy(strategy);Sourcefn pod_management_policy(self, policy: impl ToString) -> Self
fn pod_management_policy(self, policy: impl ToString) -> Self
Set the pod management policy for the StatefulSet.
Pod management policy controls how pods are created during initial scale up, replacement, or scale down operations.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.pod_management_policy("Parallel");Sourcefn ordered_ready(self) -> Self
fn ordered_ready(self) -> Self
Set the pod management policy to “OrderedReady” (default).
In OrderedReady mode, pods are created, scaled, and deleted in order. Each pod must be Ready before the next one is created or deleted.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.ordered_ready();Sourcefn parallel(self) -> Self
fn parallel(self) -> Self
Set the pod management policy to “Parallel”.
In Parallel mode, pods are created and deleted in parallel, similar to Deployment behavior. Pods can start simultaneously without waiting for others to be Ready.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.parallel();Sourcefn volume_claim_templates(
self,
templates: impl IntoIterator<Item = PersistentVolumeClaim>,
) -> Self
fn volume_claim_templates( self, templates: impl IntoIterator<Item = PersistentVolumeClaim>, ) -> Self
Set the volume claim templates for the StatefulSet.
VolumeClaimTemplates is a list of claims that pods are allowed to reference. The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::corev1;
use k8s_openapi_ext::StatefulSetExt;
let claim = corev1::PersistentVolumeClaim::default();
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.volume_claim_templates([claim]);Sourcefn persistent_volume_claim_retention_policy(
self,
policy: StatefulSetPersistentVolumeClaimRetentionPolicy,
) -> Self
fn persistent_volume_claim_retention_policy( self, policy: StatefulSetPersistentVolumeClaimRetentionPolicy, ) -> Self
Set the persistent volume claim retention policy for the StatefulSet.
PersistentVolumeClaimRetentionPolicy describes the policy used for PVCs created from the StatefulSet VolumeClaimTemplates.
§Examples
use k8s_openapi_ext::appsv1;
use k8s_openapi_ext::StatefulSetExt;
let policy = appsv1::StatefulSetPersistentVolumeClaimRetentionPolicy::default();
let statefulset = appsv1::StatefulSet::new("my-statefulset")
.persistent_volume_claim_retention_policy(policy);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.