charts/dial-core/templates/hpa.yaml (49 lines of code) (raw):
{{- if .Values.autoscaling.hpa.enabled }}
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "dialCore.names.fullname" . }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{ include "dialCore.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.autoscaling.hpa.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.autoscaling.hpa.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.autoscaling.hpa.behavior }}
behavior:
{{- toYaml .Values.autoscaling.hpa.behavior | nindent 4 }}
{{- end }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "dialCore.names.fullname" . }}
minReplicas: {{ .Values.autoscaling.hpa.minReplicas }}
maxReplicas: {{ .Values.autoscaling.hpa.maxReplicas }}
metrics:
{{- if .Values.autoscaling.hpa.targetMemory }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.hpa.targetMemory }}
{{- end }}
{{- if .Values.autoscaling.hpa.targetCPU }}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.hpa.targetCPU }}
{{- end }}
{{- if .Values.autoscaling.hpa.customRules -}}
{{- toYaml .Values.autoscaling.hpa.customRules | nindent 4 }}
{{- end -}}
{{- end }}