Package org.cdk8s.plus24.k8s
Class HorizontalPodAutoscalerSpecV2.Builder
- java.lang.Object
-
- org.cdk8s.plus24.k8s.HorizontalPodAutoscalerSpecV2.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<HorizontalPodAutoscalerSpecV2>
- Enclosing interface:
- HorizontalPodAutoscalerSpecV2
@Stability(Stable) public static final class HorizontalPodAutoscalerSpecV2.Builder extends Object implements software.amazon.jsii.Builder<HorizontalPodAutoscalerSpecV2>
A builder forHorizontalPodAutoscalerSpecV2
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HorizontalPodAutoscalerSpecV2.Builder
behavior(HorizontalPodAutoscalerBehaviorV2 behavior)
Sets the value ofHorizontalPodAutoscalerSpecV2.getBehavior()
HorizontalPodAutoscalerSpecV2
build()
Builds the configured instance.HorizontalPodAutoscalerSpecV2.Builder
maxReplicas(Number maxReplicas)
Sets the value ofHorizontalPodAutoscalerSpecV2.getMaxReplicas()
HorizontalPodAutoscalerSpecV2.Builder
metrics(List<? extends MetricSpecV2> metrics)
Sets the value ofHorizontalPodAutoscalerSpecV2.getMetrics()
HorizontalPodAutoscalerSpecV2.Builder
minReplicas(Number minReplicas)
Sets the value ofHorizontalPodAutoscalerSpecV2.getMinReplicas()
HorizontalPodAutoscalerSpecV2.Builder
scaleTargetRef(CrossVersionObjectReferenceV2 scaleTargetRef)
Sets the value ofHorizontalPodAutoscalerSpecV2.getScaleTargetRef()
-
-
-
Method Detail
-
maxReplicas
@Stability(Stable) public HorizontalPodAutoscalerSpecV2.Builder maxReplicas(Number maxReplicas)
Sets the value ofHorizontalPodAutoscalerSpecV2.getMaxReplicas()
- Parameters:
maxReplicas
- maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. This parameter is required. It cannot be less that minReplicas.- Returns:
this
-
scaleTargetRef
@Stability(Stable) public HorizontalPodAutoscalerSpecV2.Builder scaleTargetRef(CrossVersionObjectReferenceV2 scaleTargetRef)
Sets the value ofHorizontalPodAutoscalerSpecV2.getScaleTargetRef()
- Parameters:
scaleTargetRef
- scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count. This parameter is required.- Returns:
this
-
behavior
@Stability(Stable) public HorizontalPodAutoscalerSpecV2.Builder behavior(HorizontalPodAutoscalerBehaviorV2 behavior)
Sets the value ofHorizontalPodAutoscalerSpecV2.getBehavior()
- Parameters:
behavior
- behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used.- Returns:
this
-
metrics
@Stability(Stable) public HorizontalPodAutoscalerSpecV2.Builder metrics(List<? extends MetricSpecV2> metrics)
Sets the value ofHorizontalPodAutoscalerSpecV2.getMetrics()
- Parameters:
metrics
- metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.- Returns:
this
-
minReplicas
@Stability(Stable) public HorizontalPodAutoscalerSpecV2.Builder minReplicas(Number minReplicas)
Sets the value ofHorizontalPodAutoscalerSpecV2.getMinReplicas()
- Parameters:
minReplicas
- minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.- Returns:
this
-
build
@Stability(Stable) public HorizontalPodAutoscalerSpecV2 build()
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<HorizontalPodAutoscalerSpecV2>
- Returns:
- a new instance of
HorizontalPodAutoscalerSpecV2
- Throws:
NullPointerException
- if any required attribute was not provided
-
-