From 00cb90f2c7bca5211fb3374df17be8c63325a9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Can=C3=A9vet?= Date: Fri, 3 Nov 2023 14:23:53 +0100 Subject: [PATCH] feat: add controller annotations (#5649) --- operations/helm/charts/grafana-agent/CHANGELOG.md | 1 + operations/helm/charts/grafana-agent/README.md | 1 + .../charts/grafana-agent/templates/controllers/daemonset.yaml | 4 ++++ .../grafana-agent/templates/controllers/deployment.yaml | 4 ++++ .../grafana-agent/templates/controllers/statefulset.yaml | 4 ++++ operations/helm/charts/grafana-agent/values.yaml | 3 +++ operations/helm/ct.yaml | 1 - 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/operations/helm/charts/grafana-agent/CHANGELOG.md b/operations/helm/charts/grafana-agent/CHANGELOG.md index 54974857e874..b5197eadc370 100644 --- a/operations/helm/charts/grafana-agent/CHANGELOG.md +++ b/operations/helm/charts/grafana-agent/CHANGELOG.md @@ -13,6 +13,7 @@ Unreleased ### Enhancements - Expose the `ui-path-prefix` flag on the Helm chart (@mlcdf) +- Expose controller `extraAnnotations` on the Helm chart (@mcanevet) 0.27.1 (2023-10-26) ---------- diff --git a/operations/helm/charts/grafana-agent/README.md b/operations/helm/charts/grafana-agent/README.md index 8f384f4fe977..ccb539ff0e36 100644 --- a/operations/helm/charts/grafana-agent/README.md +++ b/operations/helm/charts/grafana-agent/README.md @@ -77,6 +77,7 @@ use the older mode (called "static mode"), set the `agent.mode` value to | controller.autoscaling.targetMemoryUtilizationPercentage | int | `80` | 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. | | controller.dnsPolicy | string | `"ClusterFirst"` | Configures the DNS policy for the pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy | | controller.enableStatefulSetAutoDeletePVC | bool | `false` | Whether to enable automatic deletion of stale PVCs due to a scale down operation, when controller.type is 'statefulset'. | +| controller.extraAnnotations | object | `{}` | Annotations to add to controller. | | controller.hostNetwork | bool | `false` | Configures Pods to use the host network. When set to true, the ports that will be used must be specified. | | controller.hostPID | bool | `false` | Configures Pods to use the host PID namespace. | | controller.initContainers | list | `[]` | | diff --git a/operations/helm/charts/grafana-agent/templates/controllers/daemonset.yaml b/operations/helm/charts/grafana-agent/templates/controllers/daemonset.yaml index 8e8023ba194e..4eb29780a241 100644 --- a/operations/helm/charts/grafana-agent/templates/controllers/daemonset.yaml +++ b/operations/helm/charts/grafana-agent/templates/controllers/daemonset.yaml @@ -5,6 +5,10 @@ metadata: name: {{ include "grafana-agent.fullname" . }} labels: {{- include "grafana-agent.labels" . | nindent 4 }} + {{- with .Values.controller.extraAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: {{- if ge (int .Capabilities.KubeVersion.Minor) 22 }} minReadySeconds: 10 diff --git a/operations/helm/charts/grafana-agent/templates/controllers/deployment.yaml b/operations/helm/charts/grafana-agent/templates/controllers/deployment.yaml index 2172bde3e914..7cc900bc1c8f 100644 --- a/operations/helm/charts/grafana-agent/templates/controllers/deployment.yaml +++ b/operations/helm/charts/grafana-agent/templates/controllers/deployment.yaml @@ -5,6 +5,10 @@ metadata: name: {{ include "grafana-agent.fullname" . }} labels: {{- include "grafana-agent.labels" . | nindent 4 }} + {{- with .Values.controller.extraAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: {{- if not .Values.controller.autoscaling.enabled }} replicas: {{ .Values.controller.replicas }} diff --git a/operations/helm/charts/grafana-agent/templates/controllers/statefulset.yaml b/operations/helm/charts/grafana-agent/templates/controllers/statefulset.yaml index 264aeed79548..c4ef55024a22 100644 --- a/operations/helm/charts/grafana-agent/templates/controllers/statefulset.yaml +++ b/operations/helm/charts/grafana-agent/templates/controllers/statefulset.yaml @@ -5,6 +5,10 @@ metadata: name: {{ include "grafana-agent.fullname" . }} labels: {{- include "grafana-agent.labels" . | nindent 4 }} + {{- with .Values.controller.extraAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: {{- if not .Values.controller.autoscaling.enabled }} replicas: {{ .Values.controller.replicas }} diff --git a/operations/helm/charts/grafana-agent/values.yaml b/operations/helm/charts/grafana-agent/values.yaml index 7070ba4d717a..7b80e68618e6 100644 --- a/operations/helm/charts/grafana-agent/values.yaml +++ b/operations/helm/charts/grafana-agent/values.yaml @@ -152,6 +152,9 @@ controller: # -- Number of pods to deploy. Ignored when controller.type is 'daemonset'. replicas: 1 + # -- Annotations to add to controller. + extraAnnotations: {} + # -- Whether to deploy pods in parallel. Only used when controller.type is # 'statefulset'. parallelRollout: true diff --git a/operations/helm/ct.yaml b/operations/helm/ct.yaml index 721ffc482304..4b57c7f89bcb 100644 --- a/operations/helm/ct.yaml +++ b/operations/helm/ct.yaml @@ -2,6 +2,5 @@ remote: origin target-branch: main chart-dirs: - operations/helm/charts -helm-extra-args: --timeout 600s validate-maintainers: false check-version-increment: false # Don't require every change to be released