{{- if .Values.autoscaling.enabled }} {{- $apiVersions := .Capabilities.APIVersions -}} {{- if not ($apiVersions.Has "autoscaling/v2") }} apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: {{ template "docker-registry.fullname" . }} labels: app: {{ template "docker-registry.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ template "docker-registry.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} targetCPUUtilizationPercentage: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} {{- end }} {{- end }}