From 303e3530cb869207264f4c56f762fed81ac8610e Mon Sep 17 00:00:00 2001 From: Andrew Kallistros Date: Wed, 1 Nov 2023 13:21:27 +0200 Subject: [PATCH] Helm: Allow topologySpreadConstraints (#11086) **What this PR does / why we need it**: Allow topologySpreadConstraints for read, write, backend and gateway statefulsets/deployments. **Which issue(s) this PR fixes**: Fixes #11081 **Special notes for your reviewer**: **Checklist** - [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [x] Documentation added - [ ] Tests updated - [x] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [x] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](https://github.com/grafana/loki/commit/d10549e3ece02120974929894ee333d07755d213) - [x] If the change is deprecating or removing a configuration option, update the `deprecated-config.yaml` and `deleted-config.yaml` files respectively in the `tools/deprecated-config-checker` directory. [Example PR](https://github.com/grafana/loki/pull/10840/commits/0d4416a4b03739583349934b96f272fb4f685d15) --------- Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com> --- CHANGELOG.md | 1 + docs/sources/setup/install/helm/reference.md | 36 +++++++++++++++++++ production/helm/loki/CHANGELOG.md | 5 +++ production/helm/loki/Chart.yaml | 2 +- production/helm/loki/README.md | 2 +- .../backend/statefulset-backend.yaml | 4 +++ .../templates/gateway/deployment-gateway.yaml | 4 +++ .../loki/templates/read/statefulset-read.yaml | 4 +++ .../templates/write/statefulset-write.yaml | 4 +++ production/helm/loki/values.yaml | 8 +++++ 10 files changed, 68 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d5010e9638..d214934e978f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ##### Enhancements +* [11086](https://github.com/grafana/loki/pull/11086) **kandrew5**: Helm: Allow topologySpreadConstraints * [11003](https://github.com/grafana/loki/pull/11003) **MichelHollands**: Add the `metrics-namespace` flag to change the namespace of metrics currently using cortex as namespace. * [10096](https://github.com/grafana/loki/pull/10096) **aschleck**: Storage: Allow setting a constant prefix for all created keys * [11038](https://github.com/grafana/loki/pull/11038) **kavirajk**: Remove already deprecated `store.max-look-back-period`. diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index 6ec6797fdc48..a3516706f594 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -366,6 +366,15 @@ null
 []
 
+ + + + backend.topologySpreadConstraints + list + Topology Spread Constraints for backend pods +
+[]
+
@@ -1445,6 +1454,15 @@ null
 []
 
+ + + + gateway.topologySpreadConstraints + list + Topology Spread Constraints for gateway pods +
+[]
+
@@ -3448,6 +3466,15 @@ null
 []
 
+ + + + read.topologySpreadConstraints + list + Topology Spread Constraints for read pods +
+[]
+
@@ -4748,6 +4775,15 @@ null
 []
 
+ + + + write.topologySpreadConstraints + list + Topology Spread Constraints for write pods +
+[]
+
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index addc9f555029..da96d49237a8 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,11 @@ 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.) +## 5.36.1 + +- [FEATURE] Allow topology spread constraints for Loki + + ## 5.36.0 - [CHANGE] Changed version of Loki to 2.9.2 diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index 1e514c2f45a8..992cd3cd0228 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 in simple, scalable mode type: application appVersion: 2.9.2 -version: 5.36.0 +version: 5.36.1 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 4ae9db8a236d..f917146e3dd2 100644 --- a/production/helm/loki/README.md +++ b/production/helm/loki/README.md @@ -1,6 +1,6 @@ # loki -![Version: 5.36.0](https://img.shields.io/badge/Version-5.36.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.2](https://img.shields.io/badge/AppVersion-2.9.2-informational?style=flat-square) +![Version: 5.36.1](https://img.shields.io/badge/Version-5.36.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.2](https://img.shields.io/badge/AppVersion-2.9.2-informational?style=flat-square) Helm chart for Grafana Loki in simple, scalable mode diff --git a/production/helm/loki/templates/backend/statefulset-backend.yaml b/production/helm/loki/templates/backend/statefulset-backend.yaml index 26022c04ffe0..0bdef7e8e777 100644 --- a/production/helm/loki/templates/backend/statefulset-backend.yaml +++ b/production/helm/loki/templates/backend/statefulset-backend.yaml @@ -215,6 +215,10 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.backend.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.backend.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/production/helm/loki/templates/gateway/deployment-gateway.yaml b/production/helm/loki/templates/gateway/deployment-gateway.yaml index de6321b76486..5605f9287d20 100644 --- a/production/helm/loki/templates/gateway/deployment-gateway.yaml +++ b/production/helm/loki/templates/gateway/deployment-gateway.yaml @@ -108,6 +108,10 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.gateway.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.gateway.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/production/helm/loki/templates/read/statefulset-read.yaml b/production/helm/loki/templates/read/statefulset-read.yaml index a9213e7f9879..3b0d91d926a3 100644 --- a/production/helm/loki/templates/read/statefulset-read.yaml +++ b/production/helm/loki/templates/read/statefulset-read.yaml @@ -131,6 +131,10 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.read.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.read.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/production/helm/loki/templates/write/statefulset-write.yaml b/production/helm/loki/templates/write/statefulset-write.yaml index 79aed8ddd314..fdbc2f04d20b 100644 --- a/production/helm/loki/templates/write/statefulset-write.yaml +++ b/production/helm/loki/templates/write/statefulset-write.yaml @@ -150,6 +150,10 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.write.topologySpreadConstraints }} + topologySpreadConstraints: + {{- toYaml . | nindent 8 }} + {{- end }} {{- with .Values.write.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index eada3863e2a8..c09791a84ac7 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -800,6 +800,8 @@ write: dnsConfig: {} # -- Node selector for write pods nodeSelector: {} + # -- Topology Spread Constraints for write pods + topologySpreadConstraints: [] # -- Tolerations for write pods tolerations: [] # -- The default is to deploy all pods in parallel. @@ -976,6 +978,8 @@ read: dnsConfig: {} # -- Node selector for read pods nodeSelector: {} + # -- Topology Spread Constraints for read pods + topologySpreadConstraints: [] # -- Tolerations for read pods tolerations: [] # -- The default is to deploy all pods in parallel. @@ -1077,6 +1081,8 @@ backend: dnsConfig: {} # -- Node selector for backend pods nodeSelector: {} + # -- Topology Spread Constraints for backend pods + topologySpreadConstraints: [] # -- Tolerations for backend pods tolerations: [] # -- The default is to deploy all pods in parallel. @@ -1333,6 +1339,8 @@ gateway: dnsConfig: {} # -- Node selector for gateway pods nodeSelector: {} + # -- Topology Spread Constraints for gateway pods + topologySpreadConstraints: [] # -- Tolerations for gateway pods tolerations: [] # Gateway service configuration