Skip to content

Commit 2d2a982

Browse files
committed
topologySpreadConstraints also need tpl function
Like `affinity`, `topologySpreadConstraints` also need tpl function to rendering its value. for example: ```yaml topologySpreadConstraints: - maxSkew: 1 topologyKey: "topology.kubernetes.io/zone" whenUnsatisfiable: ScheduleAnyway labelSelector: matchLabels: app.kubernetes.io/name: '{{ include "qdrant.name" . }}' ```
1 parent 712214a commit 2d2a982

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

charts/qdrant/templates/statefulset.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ spec:
211211
{{- end }}
212212
{{- with .Values.topologySpreadConstraints}}
213213
topologySpreadConstraints:
214-
{{- toYaml . | nindent 8 }}
214+
{{- tpl (toYaml .) $ | nindent 8 }}
215215
{{- end }}
216216
serviceAccountName: {{ include "qdrant.fullname" . }}
217217
volumes:

test/qdrant_topology-spread-constraints_test.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ func TestTopologySpreadConstraints(t *testing.T) {
2525

2626
options := &helm.Options{
2727
SetJsonValues: map[string]string{
28-
"topologySpreadConstraints": `[{"maxSkew":1,"topologyKey":"kubernetes.io/hostname","whenUnsatisfiable":"DoNotSchedule","labelSelector":{"matchLabels":{"app":"qdrant"}}}]`,
28+
"topologySpreadConstraints": `
29+
[
30+
{
31+
"maxSkew": 1,
32+
"topologyKey": "topology.kubernetes.io/zone",
33+
"labelSelector": {
34+
"matchLabels": {
35+
"app.kubernetes.io/name": "{{ include \"qdrant.name\" . }}"
36+
}
37+
},
38+
"whenUnsatisfiable": "DoNotSchedule"
39+
}
40+
]`,
2941
},
3042
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
3143
}

0 commit comments

Comments
 (0)