diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bdc8b79d..a04b407c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -162,6 +162,26 @@ jobs: fi + cat << EOF > test-values.yaml + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: production/node-pool + operator: In + values: + - replicated-sdk + EOF + + output=$(helm template oci://ttl.sh/automated-${{ github.run_id }}/replicated --version 0.0.0 --values test-values.yaml) + + if ! echo $output | grep -q 'affinity:'; then + printf "user-set affinity should exist:\n\n%s\n\n" "$output" + exit 1 + fi + + cat << EOF > test-values.yaml statusInformers: [] EOF diff --git a/chart/templates/replicated-deployment.yaml b/chart/templates/replicated-deployment.yaml index 6427382d..923fc1a6 100644 --- a/chart/templates/replicated-deployment.yaml +++ b/chart/templates/replicated-deployment.yaml @@ -41,6 +41,10 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} {{- if $podSecurityContext.enabled }} securityContext: {{- omit $podSecurityContext "enabled" | toYaml | nindent 8 }} {{- end }} diff --git a/chart/values.yaml.tmpl b/chart/values.yaml.tmpl index 28c842de..cbca4322 100644 --- a/chart/values.yaml.tmpl +++ b/chart/values.yaml.tmpl @@ -77,3 +77,5 @@ replicatedID: "" appID: "" tolerations: [] + +affinity: ~ \ No newline at end of file