From 536be45ed70a5e359564e51dddbe1fabdbdc25bd Mon Sep 17 00:00:00 2001 From: Zadkiel Aharonian Date: Mon, 27 Mar 2023 16:33:37 +0200 Subject: [PATCH 1/3] feat: add topologySpreadConstraints --- CHANGELOG.md | 4 ++++ README.md | 1 + application/templates/deployment.yaml | 4 ++++ application/values.yaml | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cefe6b4..854fce92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented here. +### v2.x [unreleased] + +- Feat: Add topologySpreadConstraints [PR-239](https://github.com/stakater/application/pull/239) + ### v2.1.2 && v2.1.3 - Update: Improve enable conditions by adding capabilites, use `_helpers.tpl` properly, Move to common k8s labels and remove other labels [PR-226](https://github.com/stakater/application/pull/226) - Feature: Make `ingress` path configurable [PR-226](https://github.com/stakater/application/pull/226) diff --git a/README.md b/README.md index fff35dd4..d2dca606 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ To uninstall the chart: | deployment.args | Arg for primary container of deployment | `[]` | | deployment.tolerations | Taint tolerations for nodes | `[]` | | deployment.affinity | Affinity for pod/node | `[]` | +| deployment.topologySpreadConstraints| Topology spread constraints definitions | `[]` | | deployment.ports | Ports for primary container | `[]` | | deployment.securityContext | Security Context for the pod | `{}` | | deployment.additionalContainers | Add additional containers besides init and app containers | `[]` | diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 62c8bfd8..cb7763d0 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -92,6 +92,10 @@ spec: {{- if .Values.deployment.affinity }} affinity: {{ toYaml .Values.deployment.affinity | indent 8 -}} + {{- end }} + {{- if .Values.deployment.topologySpreadConstraints }} + topologySpreadConstraints: +{{ toYaml .Values.deployment.topologySpreadConstraints | indent 8 }} {{- end }} {{- if .Values.deployment.imagePullSecrets }} imagePullSecrets: diff --git a/application/values.yaml b/application/values.yaml index 47aeeb9d..12c25edc 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -166,6 +166,27 @@ deployment: # values: # - ssd + # Topology spread constraints + topologySpreadConstraints: + # - maxSkew: 1 + # topologyKey: kubernetes.io/hostname + # whenUnsatisfiable: ScheduleAnyway + # labelSelector: + # matchExpressions: + # - key: disktype + # operator: In + # values: + # - ssd + # - maxSkew: 1 + # topologyKey: topology.kubernetes.io/zone + # whenUnsatisfiable: ScheduleAnyway + # labelSelector: + # matchExpressions: + # - key: disktype + # operator: In + # values: + # - ssd + # Image of the app container image: repository: repository/image-name From 0447f3e8326f3b6b20ff6c9806900ab16066c6b7 Mon Sep 17 00:00:00 2001 From: Zadkiel Aharonian Date: Wed, 29 Mar 2023 12:07:29 +0200 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a172a98..320a5adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,6 @@ All notable changes to this project will be documented here. ### v2.1.7 - Feature: Add topologySpreadConstraints [PR-239](https://github.com/stakater/application/pull/239) -### v2.1.6 -- Fix quote app.kubernetes.io/version label [PR-238](https://github.com/stakater/application/pull/238) - ### v2.1.5 - Fix: Qoute application version label in labels [PR-38](https://github.com/stakater/application/pull/238) From ae637a53c91db2391b02e6b10dd6cdb96e689b98 Mon Sep 17 00:00:00 2001 From: Zadkiel Aharonian Date: Sat, 1 Apr 2023 14:48:47 +0200 Subject: [PATCH 3/3] Update application/templates/deployment.yaml Co-authored-by: d3adb5 --- application/templates/deployment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index cb7763d0..e6673cc6 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -93,9 +93,9 @@ spec: affinity: {{ toYaml .Values.deployment.affinity | indent 8 -}} {{- end }} - {{- if .Values.deployment.topologySpreadConstraints }} + {{- with .Values.deployment.topologySpreadConstraints }} topologySpreadConstraints: -{{ toYaml .Values.deployment.topologySpreadConstraints | indent 8 }} + {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.deployment.imagePullSecrets }} imagePullSecrets: