Class PodDisruptionBudgetSpec.Builder
- java.lang.Object
-
- org.cdk8s.plus28.k8s.PodDisruptionBudgetSpec.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<PodDisruptionBudgetSpec>
- Enclosing interface:
- PodDisruptionBudgetSpec
@Stability(Stable) public static final class PodDisruptionBudgetSpec.Builder extends Object implements software.amazon.jsii.Builder<PodDisruptionBudgetSpec>
A builder forPodDisruptionBudgetSpec
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PodDisruptionBudgetSpecbuild()Builds the configured instance.PodDisruptionBudgetSpec.BuildermaxUnavailable(IntOrString maxUnavailable)Sets the value ofPodDisruptionBudgetSpec.getMaxUnavailable()PodDisruptionBudgetSpec.BuilderminAvailable(IntOrString minAvailable)Sets the value ofPodDisruptionBudgetSpec.getMinAvailable()PodDisruptionBudgetSpec.Builderselector(LabelSelector selector)Sets the value ofPodDisruptionBudgetSpec.getSelector()PodDisruptionBudgetSpec.BuilderunhealthyPodEvictionPolicy(String unhealthyPodEvictionPolicy)Sets the value ofPodDisruptionBudgetSpec.getUnhealthyPodEvictionPolicy()
-
-
-
Method Detail
-
maxUnavailable
@Stability(Stable) public PodDisruptionBudgetSpec.Builder maxUnavailable(IntOrString maxUnavailable)
Sets the value ofPodDisruptionBudgetSpec.getMaxUnavailable()- Parameters:
maxUnavailable- An eviction is allowed if at most "maxUnavailable" pods selected by "selector" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with "minAvailable".- Returns:
this
-
minAvailable
@Stability(Stable) public PodDisruptionBudgetSpec.Builder minAvailable(IntOrString minAvailable)
Sets the value ofPodDisruptionBudgetSpec.getMinAvailable()- Parameters:
minAvailable- An eviction is allowed if at least "minAvailable" pods selected by "selector" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying "100%".- Returns:
this
-
selector
@Stability(Stable) public PodDisruptionBudgetSpec.Builder selector(LabelSelector selector)
Sets the value ofPodDisruptionBudgetSpec.getSelector()- Parameters:
selector- Label query over pods whose evictions are managed by the disruption budget. A null selector will match no pods, while an empty ({}) selector will select all pods within the namespace.- Returns:
this
-
unhealthyPodEvictionPolicy
@Stability(Stable) public PodDisruptionBudgetSpec.Builder unhealthyPodEvictionPolicy(String unhealthyPodEvictionPolicy)
Sets the value ofPodDisruptionBudgetSpec.getUnhealthyPodEvictionPolicy()- Parameters:
unhealthyPodEvictionPolicy- UnhealthyPodEvictionPolicy defines the criteria for when unhealthy pods should be considered for eviction. Current implementation considers healthy pods, as pods that have status.conditions item with type="Ready",status="True".Valid policies are IfHealthyBudget and AlwaysAllow. If no policy is specified, the default behavior will be used, which corresponds to the IfHealthyBudget policy.
IfHealthyBudget policy means that running pods (status.phase="Running"), but not yet healthy can be evicted only if the guarded application is not disrupted (status.currentHealthy is at least equal to status.desiredHealthy). Healthy pods will be subject to the PDB for eviction.
AlwaysAllow policy means that all running pods (status.phase="Running"), but not yet healthy are considered disrupted and can be evicted regardless of whether the criteria in a PDB is met. This means perspective running pods of a disrupted application might not get a chance to become healthy. Healthy pods will be subject to the PDB for eviction.
Additional policies may be added in the future. Clients making eviction decisions should disallow eviction of unhealthy pods if they encounter an unrecognized policy in this field.
This field is beta-level. The eviction API uses this field when the feature gate PDBUnhealthyPodEvictionPolicy is enabled (enabled by default).
- Returns:
this
-
build
@Stability(Stable) public PodDisruptionBudgetSpec build()
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<PodDisruptionBudgetSpec>- Returns:
- a new instance of
PodDisruptionBudgetSpec - Throws:
NullPointerException- if any required attribute was not provided
-
-