hpa.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. {{- if .Values.queryFrontend.autoscaling.enabled }}
  2. {{- $apiVersion := include "loki.hpa.apiVersion" . -}}
  3. apiVersion: {{ $apiVersion }}
  4. kind: HorizontalPodAutoscaler
  5. metadata:
  6. name: {{ include "loki.queryFrontendFullname" . }}
  7. namespace: {{ .Release.Namespace }}
  8. labels:
  9. {{- include "loki.queryFrontendLabels" . | nindent 4 }}
  10. spec:
  11. scaleTargetRef:
  12. apiVersion: apps/v1
  13. kind: Deployment
  14. name: {{ include "loki.queryFrontendFullname" . }}
  15. minReplicas: {{ .Values.queryFrontend.autoscaling.minReplicas }}
  16. maxReplicas: {{ .Values.queryFrontend.autoscaling.maxReplicas }}
  17. metrics:
  18. {{- with .Values.queryFrontend.autoscaling.targetMemoryUtilizationPercentage }}
  19. - type: Resource
  20. resource:
  21. name: memory
  22. {{- if (eq $apiVersion "autoscaling/v2") }}
  23. target:
  24. type: Utilization
  25. averageUtilization: {{ . }}
  26. {{- else }}
  27. targetAverageUtilization: {{ . }}
  28. {{- end }}
  29. {{- end }}
  30. {{- with .Values.queryFrontend.autoscaling.targetCPUUtilizationPercentage }}
  31. - type: Resource
  32. resource:
  33. name: cpu
  34. {{- if (eq $apiVersion "autoscaling/v2") }}
  35. target:
  36. type: Utilization
  37. averageUtilization: {{ . }}
  38. {{- else }}
  39. targetAverageUtilization: {{ . }}
  40. {{- end }}
  41. {{- end }}
  42. {{- if .Values.queryFrontend.autoscaling.behavior.enabled }}
  43. behavior:
  44. {{- with .Values.queryFrontend.autoscaling.behavior.scaleDown }}
  45. scaleDown: {{ toYaml . | nindent 6 }}
  46. {{- end }}
  47. {{- with .Values.queryFrontend.autoscaling.behavior.scaleUp }}
  48. scaleUp: {{ toYaml . | nindent 6 }}
  49. {{- end }}
  50. {{- end }}
  51. {{- end }}