controller-hpa.yaml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {{- if and .Values.controller.autoscaling.enabled (or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both")) -}}
  2. {{- if not .Values.controller.keda.enabled }}
  3. apiVersion: autoscaling/v2beta2
  4. kind: HorizontalPodAutoscaler
  5. metadata:
  6. annotations:
  7. {{- with .Values.controller.autoscaling.annotations }}
  8. {{- toYaml . | trimSuffix "\n" | nindent 4 }}
  9. {{- end }}
  10. labels:
  11. {{- include "ingress-nginx.labels" . | nindent 4 }}
  12. app.kubernetes.io/component: controller
  13. {{- with .Values.controller.labels }}
  14. {{- toYaml . | nindent 4 }}
  15. {{- end }}
  16. name: {{ include "ingress-nginx.controller.fullname" . }}
  17. namespace: {{ .Release.Namespace }}
  18. spec:
  19. scaleTargetRef:
  20. apiVersion: apps/v1
  21. kind: Deployment
  22. name: {{ include "ingress-nginx.controller.fullname" . }}
  23. minReplicas: {{ .Values.controller.autoscaling.minReplicas }}
  24. maxReplicas: {{ .Values.controller.autoscaling.maxReplicas }}
  25. metrics:
  26. {{- with .Values.controller.autoscaling.targetMemoryUtilizationPercentage }}
  27. - type: Resource
  28. resource:
  29. name: memory
  30. target:
  31. type: Utilization
  32. averageUtilization: {{ . }}
  33. {{- end }}
  34. {{- with .Values.controller.autoscaling.targetCPUUtilizationPercentage }}
  35. - type: Resource
  36. resource:
  37. name: cpu
  38. target:
  39. type: Utilization
  40. averageUtilization: {{ . }}
  41. {{- end }}
  42. {{- with .Values.controller.autoscalingTemplate }}
  43. {{- toYaml . | nindent 2 }}
  44. {{- end }}
  45. {{- with .Values.controller.autoscaling.behavior }}
  46. behavior:
  47. {{- toYaml . | nindent 4 }}
  48. {{- end }}
  49. {{- end }}
  50. {{- end }}