Class HorizontalPodAutoscaler.Builder

    • Method Detail

      • 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 HPAScaleToZero is 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