istio.io/istio@v0.0.0-20240520182934-d79c90f27776/manifests/charts/gateway/templates/hpa.yaml (about)

     1  {{- if and (.Values.autoscaling.enabled) (eq .Values.kind "Deployment") }}
     2  apiVersion: autoscaling/v2
     3  kind: HorizontalPodAutoscaler
     4  metadata:
     5    name: {{ include "gateway.name" . }}
     6    namespace: {{ .Release.Namespace }}
     7    labels:
     8      {{- include "gateway.labels" . | nindent 4 }}
     9    annotations:
    10      {{- .Values.annotations | toYaml | nindent 4 }}
    11  spec:
    12    scaleTargetRef:
    13      apiVersion: apps/v1
    14      kind: {{ .Values.kind | default "Deployment" }}
    15      name: {{ include "gateway.name" . }}
    16    minReplicas: {{ .Values.autoscaling.minReplicas }}
    17    maxReplicas: {{ .Values.autoscaling.maxReplicas }}
    18    metrics:
    19      {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
    20      - type: Resource
    21        resource:
    22          name: cpu
    23          target:
    24            averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
    25            type: Utilization
    26      {{- end }}
    27      {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
    28      - type: Resource
    29        resource:
    30          name: memory
    31          target:
    32            averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
    33            type: Utilization
    34      {{- end }}
    35    {{- if .Values.autoscaling.autoscaleBehavior }}
    36    behavior: {{ toYaml .Values.autoscaling.autoscaleBehavior | nindent 4 }}
    37    {{- end }}
    38  {{- end }}