diff --git a/operations/helm/charts/grafana-agent/CHANGELOG.md b/operations/helm/charts/grafana-agent/CHANGELOG.md index 70b612d74572..29e61162cb8c 100644 --- a/operations/helm/charts/grafana-agent/CHANGELOG.md +++ b/operations/helm/charts/grafana-agent/CHANGELOG.md @@ -14,6 +14,8 @@ Unreleased - Update `rbac` to include necessary rules for the `otelcol.processor.k8sattributes` component. (@rlankfo) +- Allow setting behavior for horizontal pod autoscaler. (@captncraig) + 0.29.0 (2023-11-30) ------------------- diff --git a/operations/helm/charts/grafana-agent/README.md b/operations/helm/charts/grafana-agent/README.md index 1839e56ed202..abb37e2dfb83 100644 --- a/operations/helm/charts/grafana-agent/README.md +++ b/operations/helm/charts/grafana-agent/README.md @@ -70,6 +70,7 @@ use the older mode (called "static mode"), set the `agent.mode` value to | configReloader.resources | object | `{"requests":{"cpu":"1m","memory":"5Mi"}}` | Resource requests and limits to apply to the config reloader container. | | configReloader.securityContext | object | `{}` | Security context to apply to the Grafana configReloader container. | | controller.affinity | object | `{}` | Affinity configuration for pods. | +| controller.autoscaling.behavior | object | `{}` | Behavior section of the HPA spec. Used if you want to customize scale up or down behavior from the defaults. | | controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. | | controller.autoscaling.maxReplicas | int | `5` | The upper limit for the number of replicas to which the autoscaler can scale up. | | controller.autoscaling.minReplicas | int | `1` | The lower limit for the number of replicas to which the autoscaler can scale down. | diff --git a/operations/helm/charts/grafana-agent/ci/create-statefulset-autoscaling-values.yaml b/operations/helm/charts/grafana-agent/ci/create-statefulset-autoscaling-values.yaml index 89b51fc31c78..29aead487ad9 100644 --- a/operations/helm/charts/grafana-agent/ci/create-statefulset-autoscaling-values.yaml +++ b/operations/helm/charts/grafana-agent/ci/create-statefulset-autoscaling-values.yaml @@ -3,6 +3,9 @@ controller: type: statefulset autoscaling: enabled: true + behavior: + scaleDown: + selectPolicy: Disabled agent: resources: requests: diff --git a/operations/helm/charts/grafana-agent/templates/hpa.yaml b/operations/helm/charts/grafana-agent/templates/hpa.yaml index 9b1ea3736821..ed387070d476 100644 --- a/operations/helm/charts/grafana-agent/templates/hpa.yaml +++ b/operations/helm/charts/grafana-agent/templates/hpa.yaml @@ -22,6 +22,10 @@ spec: apiVersion: apps/v1 kind: {{ .Values.controller.type }} name: {{ include "grafana-agent.fullname" . }} + {{- with .Values.controller.autoscaling.behavior }} + behavior: + {{- toYaml . | nindent 4 }} + {{- end }} {{- with .Values.controller.autoscaling }} minReplicas: {{ .minReplicas }} maxReplicas: {{ .maxReplicas }} diff --git a/operations/helm/charts/grafana-agent/values.yaml b/operations/helm/charts/grafana-agent/values.yaml index 7b80e68618e6..ebbebac84512 100644 --- a/operations/helm/charts/grafana-agent/values.yaml +++ b/operations/helm/charts/grafana-agent/values.yaml @@ -200,6 +200,8 @@ controller: targetCPUUtilizationPercentage: 0 # -- Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. targetMemoryUtilizationPercentage: 80 + # -- Behavior section of the HPA spec. Used if you want to customize scale up or down behavior from the defaults. + behavior: {} # -- Affinity configuration for pods. affinity: {} diff --git a/operations/helm/tests/create-statefulset-autoscaling/grafana-agent/templates/hpa.yaml b/operations/helm/tests/create-statefulset-autoscaling/grafana-agent/templates/hpa.yaml index e2277ceb7fda..29ee1c052c39 100644 --- a/operations/helm/tests/create-statefulset-autoscaling/grafana-agent/templates/hpa.yaml +++ b/operations/helm/tests/create-statefulset-autoscaling/grafana-agent/templates/hpa.yaml @@ -15,6 +15,9 @@ spec: apiVersion: apps/v1 kind: statefulset name: grafana-agent + behavior: + scaleDown: + selectPolicy: Disabled minReplicas: 1 maxReplicas: 5 metrics: