hpa.yaml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. {{- if and .Values.autoscaling.enabled (or (eq .Values.mode "deployment") (eq .Values.mode "statefulset")) }}
  2. apiVersion: autoscaling/v2
  3. kind: HorizontalPodAutoscaler
  4. metadata:
  5. name: {{ include "opentelemetry-collector.fullname" . }}
  6. namespace: {{ template "opentelemetry-collector.namespace" . }}
  7. labels:
  8. {{- include "opentelemetry-collector.labels" . | nindent 4 }}
  9. spec:
  10. scaleTargetRef:
  11. apiVersion: apps/v1
  12. kind: {{ include "opentelemetry-collector.hpaKind" . }}
  13. name: {{ include "opentelemetry-collector.fullname" . }}
  14. minReplicas: {{ .Values.autoscaling.minReplicas }}
  15. maxReplicas: {{ .Values.autoscaling.maxReplicas }}
  16. {{- if .Values.autoscaling.behavior }}
  17. behavior:
  18. {{- toYaml .Values.autoscaling.behavior | nindent 4 }}
  19. {{- end }}
  20. metrics:
  21. {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
  22. - type: Resource
  23. resource:
  24. name: memory
  25. target:
  26. type: Utilization
  27. averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
  28. {{- end }}
  29. {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
  30. - type: Resource
  31. resource:
  32. name: cpu
  33. target:
  34. type: Utilization
  35. averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
  36. {{- end }}
  37. {{- end }}