github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/thanos/templates/query/hpa.yaml (about)

     1  {{- $query := (include "thanos.query.values" . | fromYaml) -}}
     2  {{- if and $query.enabled $query.autoscaling.enabled }}
     3  apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
     4  kind: HorizontalPodAutoscaler
     5  metadata:
     6    name: {{ include "common.names.fullname" . }}-query
     7    namespace: {{ .Release.Namespace | quote }}
     8    labels: {{- include "common.labels.standard" . | nindent 4 }}
     9      app.kubernetes.io/component: query
    10      {{- if .Values.commonLabels }}
    11      {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    12      {{- end }}
    13    {{- if .Values.commonAnnotations }}
    14    annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    15    {{- end }}
    16  spec:
    17    scaleTargetRef:
    18      apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
    19      kind: Deployment
    20      name: {{ include "common.names.fullname" . }}-query
    21    minReplicas: {{ $query.autoscaling.minReplicas }}
    22    maxReplicas: {{ $query.autoscaling.maxReplicas }}
    23    metrics:
    24      {{- if $query.autoscaling.targetMemory }}
    25      - type: Resource
    26        resource:
    27          name: memory
    28          {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
    29          targetAverageUtilization: {{ $query.autoscaling.targetMemory }}
    30          {{- else }}
    31          target:
    32            type: Utilization
    33            averageUtilization: {{ $query.autoscaling.targetMemory }}
    34          {{- end }}
    35      {{- end }}
    36      {{- if $query.autoscaling.targetCPU }}
    37      - type: Resource
    38        resource:
    39          name: cpu
    40          {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
    41          targetAverageUtilization: {{ $query.autoscaling.targetCPU }}
    42          {{- else }}
    43          target:
    44            type: Utilization
    45            averageUtilization: {{ $query.autoscaling.targetCPU }}
    46          {{- end }}
    47      {{- end }}
    48  {{- end }}