{{- if .Values.deployment.autoscaling.enabled }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: {{- if .Release.Namespace }} namespace: {{ .Release.Namespace }} {{- end }} name: {{ include "hydra.fullname" . }} labels: {{- include "hydra.labels" . | nindent 4 }} spec: {{- with .Values.deployment.autoscaling.behavior }} behavior: {{- toYaml . | nindent 4 }} {{- end }} scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include "hydra.fullname" . }} minReplicas: {{ .Values.deployment.autoscaling.minReplicas }} maxReplicas: {{ .Values.deployment.autoscaling.maxReplicas }} metrics: {{- with .Values.deployment.autoscaling.targetMemory }} - type: Resource resource: name: memory target: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.deployment.autoscaling.targetCPU}} - type: Resource resource: name: cpu target: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}