Package org.cdk8s.plus25
Class HorizontalPodAutoscaler.Builder
- java.lang.Object
-
- org.cdk8s.plus25.HorizontalPodAutoscaler.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<HorizontalPodAutoscaler>
- Enclosing class:
- HorizontalPodAutoscaler
@Stability(Stable) public static final class HorizontalPodAutoscaler.Builder extends Object implements software.amazon.jsii.Builder<HorizontalPodAutoscaler>
A fluent builder forHorizontalPodAutoscaler.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HorizontalPodAutoscalerbuild()static HorizontalPodAutoscaler.Buildercreate(software.constructs.Construct scope, String id)HorizontalPodAutoscaler.BuildermaxReplicas(Number maxReplicas)The maximum number of replicas that can be scaled up to.HorizontalPodAutoscaler.Buildermetadata(org.cdk8s.ApiObjectMetadata metadata)Metadata that all persisted resources must have, which includes all objects users must create.HorizontalPodAutoscaler.Buildermetrics(List<? extends Metric> metrics)The metric conditions that trigger a scale up or scale down.HorizontalPodAutoscaler.BuilderminReplicas(Number minReplicas)The minimum number of replicas that can be scaled down to.HorizontalPodAutoscaler.BuilderscaleDown(ScalingRules scaleDown)The scaling behavior when scaling down.HorizontalPodAutoscaler.BuilderscaleUp(ScalingRules scaleUp)The scaling behavior when scaling up.HorizontalPodAutoscaler.Buildertarget(IScalable target)The workload to scale up or down.
-
-
-
Method Detail
-
create
@Stability(Stable) public static HorizontalPodAutoscaler.Builder create(software.constructs.Construct scope, String id)
- Parameters:
scope- This parameter is required.id- This parameter is required.- Returns:
- a new instance of
HorizontalPodAutoscaler.Builder.
-
metadata
@Stability(Stable) public HorizontalPodAutoscaler.Builder metadata(org.cdk8s.ApiObjectMetadata metadata)
Metadata that all persisted resources must have, which includes all objects users must create.- Parameters:
metadata- Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.- Returns:
this
-
maxReplicas
@Stability(Stable) public HorizontalPodAutoscaler.Builder maxReplicas(Number maxReplicas)
The maximum number of replicas that can be scaled up to.- Parameters:
maxReplicas- The maximum number of replicas that can be scaled up to. This parameter is required.- Returns:
this
-
target
@Stability(Stable) public HorizontalPodAutoscaler.Builder target(IScalable target)
The workload to scale up or down.Scalable workload types:
- Deployment
- StatefulSet
- Parameters:
target- The workload to scale up or down. This parameter is required.- Returns:
this
-
metrics
@Stability(Stable) public HorizontalPodAutoscaler.Builder metrics(List<? extends Metric> metrics)
The metric conditions that trigger a scale up or scale down.Default: - If metrics are not provided, then the target resource constraints (e.g. cpu limit) will be used as scaling metrics.
- Parameters:
metrics- The metric conditions that trigger a scale up or scale down. This parameter is required.- Returns:
this
-
minReplicas
@Stability(Stable) public HorizontalPodAutoscaler.Builder minReplicas(Number minReplicas)
The minimum number of replicas that can be scaled down to.Can be set to 0 if the alpha feature gate
HPAScaleToZerois enabled and at least one Object or External metric is configured.Default: 1
- Parameters:
minReplicas- The minimum number of replicas that can be scaled down to. This parameter is required.- Returns:
this
-
scaleDown
@Stability(Stable) public HorizontalPodAutoscaler.Builder scaleDown(ScalingRules scaleDown)
The scaling behavior when scaling down.Default: - Scale down to minReplica count with a 5 minute stabilization window.
- Parameters:
scaleDown- The scaling behavior when scaling down. This parameter is required.- Returns:
this
-
scaleUp
@Stability(Stable) public HorizontalPodAutoscaler.Builder scaleUp(ScalingRules scaleUp)
The scaling behavior when scaling up.Default: - Is the higher of: * Increase no more than 4 pods per 60 seconds * Double the number of pods per 60 seconds
- Parameters:
scaleUp- The scaling behavior when scaling up. This parameter is required.- Returns:
this
-
build
@Stability(Stable) public HorizontalPodAutoscaler build()
- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<HorizontalPodAutoscaler>- Returns:
- a newly built instance of
HorizontalPodAutoscaler.
-
-