From c708ae691ca2d9a26b1c2a4591ed32dbfdd94619 Mon Sep 17 00:00:00 2001 From: Dylan Guedes Date: Mon, 30 Sep 2024 08:49:00 -0300 Subject: [PATCH] feat(helm): Allow setting node attributes to `tokengen` and `provisioner` (#14311) --- docs/sources/setup/install/helm/reference.md | 59 ++++++++++++++++++- production/helm/loki/CHANGELOG.md | 5 ++ production/helm/loki/Chart.yaml | 2 +- production/helm/loki/README.md | 2 +- .../provisioner/job-provisioner.yaml | 12 ++++ .../loki/templates/tokengen/job-tokengen.yaml | 8 +++ production/helm/loki/values.yaml | 10 ++++ 7 files changed, 94 insertions(+), 4 deletions(-) diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index 9add6158f3a6a..4185c5eb31ebf 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -3039,6 +3039,7 @@ null }, "provisioner": { "additionalTenants": [], + "affinity": {}, "annotations": {}, "enabled": true, "env": [], @@ -3051,6 +3052,7 @@ null "tag": null }, "labels": {}, + "nodeSelector": {}, "priorityClassName": null, "provisionedSecretPrefix": null, "securityContext": { @@ -3058,9 +3060,11 @@ null "runAsGroup": 10001, "runAsNonRoot": true, "runAsUser": 10001 - } + }, + "tolerations": [] }, "tokengen": { + "affinity": {}, "annotations": {}, "enabled": true, "env": [], @@ -3069,6 +3073,7 @@ null "extraVolumeMounts": [], "extraVolumes": [], "labels": {}, + "nodeSelector": {}, "priorityClassName": "", "securityContext": { "fsGroup": 10001, @@ -3222,6 +3227,7 @@ null
 {
   "additionalTenants": [],
+  "affinity": {},
   "annotations": {},
   "enabled": true,
   "env": [],
@@ -3234,6 +3240,7 @@ null
     "tag": null
   },
   "labels": {},
+  "nodeSelector": {},
   "priorityClassName": null,
   "provisionedSecretPrefix": null,
   "securityContext": {
@@ -3241,7 +3248,8 @@ null
     "runAsGroup": 10001,
     "runAsNonRoot": true,
     "runAsUser": 10001
-  }
+  },
+  "tolerations": []
 }
 
@@ -3253,6 +3261,15 @@ null
 []
 
+ + + + enterprise.provisioner.affinity + object + Affinity for tokengen Pods +
+{}
+
@@ -3358,6 +3375,15 @@ null
 {}
 
+ + + + enterprise.provisioner.nodeSelector + object + Node selector for tokengen Pods +
+{}
+
@@ -3390,6 +3416,15 @@ null "runAsUser": 10001 } + + + + enterprise.provisioner.tolerations + list + Tolerations for tokengen Pods +
+[]
+
@@ -3398,6 +3433,7 @@ null Configuration for `tokengen` target
 {
+  "affinity": {},
   "annotations": {},
   "enabled": true,
   "env": [],
@@ -3406,6 +3442,7 @@ null
   "extraVolumeMounts": [],
   "extraVolumes": [],
   "labels": {},
+  "nodeSelector": {},
   "priorityClassName": "",
   "securityContext": {
     "fsGroup": 10001,
@@ -3417,6 +3454,15 @@ null
   "tolerations": []
 }
 
+ + + + enterprise.tokengen.affinity + object + Affinity for tokengen Pods +
+{}
+
@@ -3489,6 +3535,15 @@ true
 {}
 
+ + + + enterprise.tokengen.nodeSelector + object + Node selector for tokengen Pods +
+{}
+
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 519755dbec944..2f1ee3541c716 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,9 +13,14 @@ Entries should include a reference to the pull request that introduced the chang [//]: # ( : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.) +## 6.16.0 + +- [ENHANCEMENT] Allow setting nodeSelector, tolerations and affinity to enterprise components (tokengen and provisioner). + ## 6.15.0 - [ENHANCEMENT] Allow setting annotations for memberlist and query-scheduler-discovery services + ## 6.14.1 - [BUGFIX] Fixed Memcached persistence options. diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index 56e48a535e070..69baa3b24ea06 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -3,7 +3,7 @@ name: loki description: Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes. type: application appVersion: 3.1.1 -version: 6.15.0 +version: 6.16.0 home: https://grafana.github.io/helm-charts sources: - https://github.com/grafana/loki diff --git a/production/helm/loki/README.md b/production/helm/loki/README.md index 92008e768d6bc..235c31643d103 100644 --- a/production/helm/loki/README.md +++ b/production/helm/loki/README.md @@ -1,6 +1,6 @@ # loki -![Version: 6.15.0](https://img.shields.io/badge/Version-6.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.1](https://img.shields.io/badge/AppVersion-3.1.1-informational?style=flat-square) +![Version: 6.16.0](https://img.shields.io/badge/Version-6.16.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.1.1](https://img.shields.io/badge/AppVersion-3.1.1-informational?style=flat-square) Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes. diff --git a/production/helm/loki/templates/provisioner/job-provisioner.yaml b/production/helm/loki/templates/provisioner/job-provisioner.yaml index 61fd2be8501ba..5a6bc063715f4 100644 --- a/production/helm/loki/templates/provisioner/job-provisioner.yaml +++ b/production/helm/loki/templates/provisioner/job-provisioner.yaml @@ -123,6 +123,18 @@ spec: {{- end }} - name: bootstrap mountPath: /bootstrap + {{- with .Values.enterprise.provisioner.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.enterprise.provisioner.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.enterprise.provisioner.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} restartPolicy: OnFailure serviceAccount: {{ include "enterprise-logs.provisionerFullname" . }} serviceAccountName: {{ include "enterprise-logs.provisionerFullname" . }} diff --git a/production/helm/loki/templates/tokengen/job-tokengen.yaml b/production/helm/loki/templates/tokengen/job-tokengen.yaml index f9ae7374c2d17..b0950d6f19675 100644 --- a/production/helm/loki/templates/tokengen/job-tokengen.yaml +++ b/production/helm/loki/templates/tokengen/job-tokengen.yaml @@ -110,6 +110,14 @@ spec: restartPolicy: OnFailure serviceAccount: {{ template "enterprise-logs.tokengenFullname" . }} serviceAccountName: {{ template "enterprise-logs.tokengenFullname" . }} + {{- with .Values.enterprise.tokengen.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.enterprise.tokengen.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.enterprise.tokengen.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index a3ee28a805338..3f44de3b3724f 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -540,6 +540,10 @@ enterprise: labels: {} # -- Additional annotations for the `tokengen` Job annotations: {} + # -- Affinity for tokengen Pods + affinity: {} + # -- Node selector for tokengen Pods + nodeSelector: {} # -- Tolerations for tokengen Job tolerations: [] # -- Additional volumes for Pods @@ -575,6 +579,12 @@ enterprise: labels: {} # -- Additional annotations for the `provisioner` Job annotations: {} + # -- Affinity for tokengen Pods + affinity: {} + # -- Node selector for tokengen Pods + nodeSelector: {} + # -- Tolerations for tokengen Pods + tolerations: [] # -- The name of the PriorityClass for provisioner Job priorityClassName: null # -- Run containers as user `enterprise-logs(uid=10001)`