Skip to content

Commit

Permalink
add topologySpreadConstraint to proxy deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
NEwa-05 authored May 2, 2023
1 parent 258fe3f commit 6694f7a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
2 changes: 1 addition & 1 deletion traefikee/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: traefikee
version: 1.11.0
version: 1.12.0
appVersion: v2.10.1
# Because of https://github.com/helm/helm/issues/3810 the pre-release version suffix has to be define.
# This allows the installation on Kubernetes cluster with a pre-release version (e.g. v1.19.9-gke.1900)
Expand Down
7 changes: 7 additions & 0 deletions traefikee/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.proxy.topologySpreadConstraints }}
{{- if (semverCompare "<1.19.0-0" .Capabilities.KubeVersion.Version) }}
{{- fail "ERROR: topologySpreadConstraints are supported only on kubernetes >= v1.19" -}}
{{- end }}
topologySpreadConstraints:
{{- tpl (toYaml .Values.proxy.topologySpreadConstraints) . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
28 changes: 27 additions & 1 deletion traefikee/tests/proxy_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,33 @@ tests:
limits:
cpu: "300m"
memory: "150Mi"

- it: should not set topologySpreadConstraints by default
asserts:
- isNull:
path: spec.template.spec.topologySpreadConstraints
- it: should set topologySpreadConstraints
set:
proxy:
topologySpreadConstraints:
- labelSelector:
matchLabels:
app: traefikee
component: proxies
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
asserts:
- isSubset:
path: spec.template.spec
content:
topologySpreadConstraints:
- labelSelector:
matchLabels:
app: traefikee
component: proxies
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
---
suite: proxy service test
templates:
Expand Down
10 changes: 10 additions & 0 deletions traefikee/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ proxy:
# minAvailable: 1
# maxUnavailable: 1
# terminationGracePeriodSeconds: 30
# # This example topologySpreadConstraints forces the scheduler to put traefikee proxy pods
# # on nodes where no other traefikee pods are scheduled.
# topologySpreadConstraints:
# - labelSelector:
# matchLabels:
# app: traefikee
# component: proxies
# maxSkew: 1
# topologyKey: kubernetes.io/hostname
# whenUnsatisfiable: DoNotSchedule

# priorityClassName will be set on all pods.
priorityClassName: ""
Expand Down

0 comments on commit 6694f7a

Please sign in to comment.