diff --git a/charts/simple-app/CHANGELOG.md b/charts/simple-app/CHANGELOG.md index 3c8ab7b..c114e01 100644 --- a/charts/simple-app/CHANGELOG.md +++ b/charts/simple-app/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.13.0 + +* Add `spreadServiceAcrossNodes` setting + # 0.12.0, 0.12.1 * Add `monitoringCoreos` setting for prometheus-operator managed metrics diff --git a/charts/simple-app/Chart.yaml b/charts/simple-app/Chart.yaml index e226bc3..6737762 100644 --- a/charts/simple-app/Chart.yaml +++ b/charts/simple-app/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: "0.12.1" +version: "0.13.0" # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/simple-app/templates/deployment.yaml b/charts/simple-app/templates/deployment.yaml index 1f93fc2..dcc1368 100644 --- a/charts/simple-app/templates/deployment.yaml +++ b/charts/simple-app/templates/deployment.yaml @@ -131,3 +131,13 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.spreadServiceAcrossNodes }} + topologySpreadConstraints: + - labelSelector: + matchLabels: + {{- include "simple-app.selectorLabels" . | nindent 12 }} + maxSkew: 1 + topologyKey: "kubernetes.io/hostname" + nodeTaintsPolicy: Honor + whenUnsatisfiable: ScheduleAnyway + {{- end }} diff --git a/charts/simple-app/tests/simple_test.yaml b/charts/simple-app/tests/simple_test.yaml index dec399f..7aa0be9 100644 --- a/charts/simple-app/tests/simple_test.yaml +++ b/charts/simple-app/tests/simple_test.yaml @@ -308,3 +308,22 @@ tests: - equal: path: metadata.name value: simple + + - it: Spread service across nodes + template: deployment.yaml + set: + spreadServiceAcrossNodes: true + asserts: + - isKind: + of: Deployment + - equal: + path: spec.template.spec.topologySpreadConstraints + value: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + nodeTaintsPolicy: Honor + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + app.kubernetes.io/instance: simple + app.kubernetes.io/name: simple-app diff --git a/charts/simple-app/values.schema.json b/charts/simple-app/values.schema.json index 7d39fbf..1aae96e 100644 --- a/charts/simple-app/values.schema.json +++ b/charts/simple-app/values.schema.json @@ -196,6 +196,9 @@ "affinity": { "type": "object" }, + "spreadServiceAcrossNodes": { + "type": "boolean" + }, "gke": { "type": "object", "properties": { diff --git a/charts/simple-app/values.yaml b/charts/simple-app/values.yaml index 5e15d04..2f62c7c 100644 --- a/charts/simple-app/values.yaml +++ b/charts/simple-app/values.yaml @@ -178,6 +178,9 @@ tolerations: [] affinity: {} +# If set, create topologySpreadConstraints to spread the pods across nodes +spreadServiceAcrossNodes: false + # Settings specific to GKE deployment gke: # If enabled and gateway.enabled is true, creates GCPBackendPolicy and