{{- if and .Values.deployment.enabled .Values.deployment.autoscaling.enabled }} apiVersion: {{ if or (.Capabilities.APIVersions.Has "autoscaling/v2/HorizontalPodAutoscaler") (semverCompare ">=1.23" .Capabilities.KubeVersion.Version) -}} autoscaling/v2 {{- else -}} autoscaling/v2beta2 {{- end }} kind: HorizontalPodAutoscaler metadata: name: {{ include "promtail.fullname" . }} namespace: {{ include "promtail.namespaceName" . }} labels: {{- include "promtail.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: {{ include "promtail.fullname" . }} {{- with .Values.deployment.autoscaling }} minReplicas: {{ .minReplicas }} maxReplicas: {{ .maxReplicas }} metrics: {{- with .targetCPUUtilizationPercentage }} - type: Resource resource: name: cpu target: type: Utilization averageUtilization: {{ . }} {{- end }} {{- with .targetMemoryUtilizationPercentage }} - type: Resource resource: name: memory target: type: Utilization averageUtilization: {{ . }} {{- end }} {{- end }} {{- with .Values.deployment.autoscaling.behavior }} behavior: {{- toYaml . | nindent 4 }} {{- end }} {{- end }}