1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- {{- if and .Values.replica.autoscaling.enabled .Values.sentinel.enabled }}
- apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
- kind: HorizontalPodAutoscaler
- metadata:
- name: {{ printf "%s-node" (include "common.names.fullname" .) }}
- namespace: {{ .Release.Namespace | quote }}
- labels: {{- include "common.labels.standard" . | nindent 4 }}
- app.kubernetes.io/component: replica
- {{- if .Values.commonLabels }}
- {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
- {{- end }}
- {{- if .Values.commonAnnotations }}
- annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
- {{- end }}
- spec:
- scaleTargetRef:
- apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
- kind: StatefulSet
- name: {{ printf "%s-node" (include "common.names.fullname" .) }}
- minReplicas: {{ .Values.replica.autoscaling.minReplicas }}
- maxReplicas: {{ .Values.replica.autoscaling.maxReplicas }}
- metrics:
- {{- if .Values.replica.autoscaling.targetMemory }}
- - type: Resource
- resource:
- name: memory
- {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
- targetAverageUtilization: {{ .Values.replica.autoscaling.targetMemory }}
- {{- else }}
- target:
- type: Utilization
- averageUtilization: {{ .Values.replica.autoscaling.targetMemory }}
- {{- end }}
- {{- end }}
- {{- if .Values.replica.autoscaling.targetCPU }}
- - type: Resource
- resource:
- name: cpu
- {{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
- targetAverageUtilization: {{ .Values.replica.autoscaling.targetCPU }}
- {{- else }}
- target:
- type: Utilization
- averageUtilization: {{ .Values.replica.autoscaling.targetCPU }}
- {{- end }}
- {{- end }}
- {{- end }}
|