hpa.yaml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {{- if .Values.autoscaling.enabled }}
  2. {{- $apiVersions := .Capabilities.APIVersions -}}
  3. {{- if $apiVersions.Has "autoscaling/v2" }}
  4. apiVersion: autoscaling/v2
  5. kind: HorizontalPodAutoscaler
  6. metadata:
  7. name: {{ template "docker-registry.fullname" . }}
  8. labels:
  9. app: {{ template "docker-registry.name" . }}
  10. chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
  11. release: {{ .Release.Name }}
  12. heritage: {{ .Release.Service }}
  13. spec:
  14. scaleTargetRef:
  15. apiVersion: apps/v1
  16. kind: Deployment
  17. name: {{ template "docker-registry.fullname" . }}
  18. minReplicas: {{ .Values.autoscaling.minReplicas }}
  19. maxReplicas: {{ .Values.autoscaling.maxReplicas }}
  20. metrics:
  21. {{- with .Values.autoscaling.targetCPUUtilizationPercentage }}
  22. - type: Resource
  23. resource:
  24. name: cpu
  25. target:
  26. type: Utilization
  27. averageUtilization: {{ . }}
  28. {{- end }}
  29. {{- with .Values.autoscaling.targetMemoryUtilizationPercentage }}
  30. - type: Resource
  31. resource:
  32. name: memory
  33. target:
  34. type: Utilization
  35. averageUtilization: {{ . }}
  36. {{- end }}
  37. {{- with .Values.autoscaling.behavior }}
  38. behavior:
  39. {{- toYaml . | nindent 4 }}
  40. {{- end }}
  41. {{- end }}
  42. {{- end }}