Skip to content

Commit d6434c6

Browse files
authored
Allow setting affinity for replicated deployment (#227)
1 parent 05fb840 commit d6434c6

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

.github/workflows/main.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,26 @@ jobs:
162162
fi
163163
164164
165+
cat << EOF > test-values.yaml
166+
affinity:
167+
nodeAffinity:
168+
requiredDuringSchedulingIgnoredDuringExecution:
169+
nodeSelectorTerms:
170+
- matchExpressions:
171+
- key: production/node-pool
172+
operator: In
173+
values:
174+
- replicated-sdk
175+
EOF
176+
177+
output=$(helm template oci://ttl.sh/automated-${{ github.run_id }}/replicated --version 0.0.0 --values test-values.yaml)
178+
179+
if ! echo $output | grep -q 'affinity:'; then
180+
printf "user-set affinity should exist:\n\n%s\n\n" "$output"
181+
exit 1
182+
fi
183+
184+
165185
cat << EOF > test-values.yaml
166186
statusInformers: []
167187
EOF

chart/templates/replicated-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ spec:
4141
tolerations:
4242
{{- toYaml . | nindent 8 }}
4343
{{- end }}
44+
{{- with .Values.affinity }}
45+
affinity:
46+
{{- toYaml . | nindent 8 }}
47+
{{- end }}
4448
{{- if $podSecurityContext.enabled }}
4549
securityContext: {{- omit $podSecurityContext "enabled" | toYaml | nindent 8 }}
4650
{{- end }}

chart/values.yaml.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ replicatedID: ""
7777
appID: ""
7878

7979
tolerations: []
80+
81+
affinity: ~

0 commit comments

Comments
 (0)