hpa.yaml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. {{- if .Values.hpa.enabled -}}
  2. apiVersion: autoscaling/v2
  3. kind: HorizontalPodAutoscaler
  4. metadata:
  5. name: {{ template "podinfo.fullname" . }}
  6. namespace: {{ include "podinfo.namespace" . }}
  7. labels:
  8. {{- include "podinfo.labels" . | nindent 4 }}
  9. spec:
  10. scaleTargetRef:
  11. apiVersion: apps/v1
  12. kind: Deployment
  13. name: {{ template "podinfo.fullname" . }}
  14. minReplicas: {{ .Values.replicaCount }}
  15. maxReplicas: {{ .Values.hpa.maxReplicas }}
  16. metrics:
  17. {{- if .Values.hpa.cpu }}
  18. - type: Resource
  19. resource:
  20. name: cpu
  21. target:
  22. type: Utilization
  23. averageUtilization: {{ .Values.hpa.cpu }}
  24. {{- end }}
  25. {{- if .Values.hpa.memory }}
  26. - type: Resource
  27. resource:
  28. name: memory
  29. target:
  30. type: AverageValue
  31. averageValue: {{ .Values.hpa.memory }}
  32. {{- end }}
  33. {{- if .Values.hpa.requests }}
  34. - type: Pods
  35. pods:
  36. metric:
  37. name: http_requests
  38. target:
  39. type: AverageValue
  40. averageValue: {{ .Values.hpa.requests }}
  41. {{- end }}
  42. {{- end }}