github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/ingress-nginx/templates/controller-hpa.yaml (about)

     1  {{- if and .Values.controller.autoscaling.enabled (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) -}}
     2  {{- if not .Values.controller.keda.enabled }}
     3  
     4  apiVersion: {{ ternary "autoscaling/v2" "autoscaling/v2beta2" (semverCompare ">=1.23.0-0" .Capabilities.KubeVersion.Version) }}
     5  kind: HorizontalPodAutoscaler
     6  metadata:
     7    annotations:
     8    {{- with .Values.controller.autoscaling.annotations }}
     9    {{- toYaml . | trimSuffix "\n" | nindent 4 }}
    10    {{- end }}
    11    labels:
    12      {{- include "ingress-nginx.labels" . | nindent 4 }}
    13      app.kubernetes.io/component: controller
    14      {{- with .Values.controller.labels }}
    15      {{- toYaml . | nindent 4 }}
    16      {{- end }}
    17    name: {{ include "ingress-nginx.controller.fullname" . }}
    18    namespace: {{ .Release.Namespace }}
    19  spec:
    20    scaleTargetRef:
    21      apiVersion: apps/v1
    22      kind: Deployment
    23      name: {{ include "ingress-nginx.controller.fullname" . }}
    24    minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
    25    maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
    26    metrics:
    27    {{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
    28    - type: Resource
    29      resource:
    30        name: memory
    31        target:
    32          type: Utilization
    33          averageUtilization: {{ . }}
    34    {{- end }}
    35    {{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
    36    - type: Resource
    37      resource:
    38        name: cpu
    39        target:
    40          type: Utilization
    41          averageUtilization: {{ . }}
    42    {{- end }}
    43    {{- with .Values.controller.autoscalingTemplate }}
    44    {{- toYaml . | nindent 2 }}
    45    {{- end }}
    46    {{- with .Values.controller.autoscaling.behavior }}
    47    behavior:
    48      {{- toYaml . | nindent 4 }}
    49    {{- end }}
    50  {{- end }}
    51  {{- end }}
    52