Skip to content

Commit d075107

Browse files
authored
feat: expose topologySpreadConstraints for distributed deployment (#14853)
1 parent a8f7851 commit d075107

16 files changed

+136
-12
lines changed

‎docs/sources/setup/install/helm/reference.md

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,7 +2695,8 @@ null
26952695
"serviceAnnotations": {},
26962696
"serviceLabels": {},
26972697
"terminationGracePeriodSeconds": 30,
2698-
"tolerations": []
2698+
"tolerations": [],
2699+
"topologySpreadConstraints": []
26992700
}
27002701
</pre>
27012702
</td>
@@ -3015,6 +3016,15 @@ null
30153016
<td><pre lang="json">
30163017
[]
30173018
</pre>
3019+
</td>
3020+
</tr>
3021+
<tr>
3022+
<td>distributor.topologySpreadConstraints</td>
3023+
<td>list</td>
3024+
<td>Topology Spread Constraints for distributor pods</td>
3025+
<td><pre lang="json">
3026+
[]
3027+
</pre>
30183028
</td>
30193029
</tr>
30203030
<tr>
@@ -3658,6 +3668,7 @@ false
36583668
},
36593669
"terminationGracePeriodSeconds": 60,
36603670
"tolerations": [],
3671+
"topologySpreadConstraints": [],
36613672
"useDefaultProxyURLs": true
36623673
}
36633674
</pre>
@@ -3858,6 +3869,15 @@ false
38583869
<td><pre lang="json">
38593870
[]
38603871
</pre>
3872+
</td>
3873+
</tr>
3874+
<tr>
3875+
<td>enterpriseGateway.topologySpreadConstraints</td>
3876+
<td>list</td>
3877+
<td>Topology Spread Constraints for enterprise-gateway pods</td>
3878+
<td><pre lang="json">
3879+
[]
3880+
</pre>
38613881
</td>
38623882
</tr>
38633883
<tr>
@@ -4658,6 +4678,7 @@ null
46584678
"serviceLabels": {},
46594679
"terminationGracePeriodSeconds": 300,
46604680
"tolerations": [],
4681+
"topologySpreadConstraints": [],
46614682
"updateStrategy": {
46624683
"type": "RollingUpdate"
46634684
}
@@ -4944,6 +4965,15 @@ null
49444965
<td><pre lang="json">
49454966
[]
49464967
</pre>
4968+
</td>
4969+
</tr>
4970+
<tr>
4971+
<td>indexGateway.topologySpreadConstraints</td>
4972+
<td>list</td>
4973+
<td>Topology Spread Constraints for index-gateway pods</td>
4974+
<td><pre lang="json">
4975+
[]
4976+
</pre>
49474977
</td>
49484978
</tr>
49494979
<tr>
@@ -7686,7 +7716,8 @@ false
76867716
"serviceAnnotations": {},
76877717
"serviceLabels": {},
76887718
"terminationGracePeriodSeconds": 30,
7689-
"tolerations": []
7719+
"tolerations": [],
7720+
"topologySpreadConstraints": []
76907721
}
76917722
</pre>
76927723
</td>
@@ -8015,6 +8046,15 @@ null
80158046
<td><pre lang="json">
80168047
[]
80178048
</pre>
8049+
</td>
8050+
</tr>
8051+
<tr>
8052+
<td>patternIngester.topologySpreadConstraints</td>
8053+
<td>list</td>
8054+
<td>Topology Spread Constraints for pattern ingester pods</td>
8055+
<td><pre lang="json">
8056+
[]
8057+
</pre>
80188058
</td>
80198059
</tr>
80208060
<tr>
@@ -8541,7 +8581,8 @@ Defaults to allow skew no more then 1 node
85418581
"serviceAnnotations": {},
85428582
"serviceLabels": {},
85438583
"terminationGracePeriodSeconds": 30,
8544-
"tolerations": []
8584+
"tolerations": [],
8585+
"topologySpreadConstraints": []
85458586
}
85468587
</pre>
85478588
</td>
@@ -8852,6 +8893,15 @@ null
88528893
<td><pre lang="json">
88538894
[]
88548895
</pre>
8896+
</td>
8897+
</tr>
8898+
<tr>
8899+
<td>queryFrontend.topologySpreadConstraints</td>
8900+
<td>list</td>
8901+
<td>Topology Spread Constraints for query-frontend pods</td>
8902+
<td><pre lang="json">
8903+
[]
8904+
</pre>
88558905
</td>
88568906
</tr>
88578907
<tr>
@@ -8899,7 +8949,8 @@ null
88998949
"serviceAnnotations": {},
89008950
"serviceLabels": {},
89018951
"terminationGracePeriodSeconds": 30,
8902-
"tolerations": []
8952+
"tolerations": [],
8953+
"topologySpreadConstraints": []
89038954
}
89048955
</pre>
89058956
</td>
@@ -9111,6 +9162,15 @@ null
91119162
<td><pre lang="json">
91129163
[]
91139164
</pre>
9165+
</td>
9166+
</tr>
9167+
<tr>
9168+
<td>queryScheduler.topologySpreadConstraints</td>
9169+
<td>list</td>
9170+
<td>Topology Spread Constraints for query-scheduler pods</td>
9171+
<td><pre lang="json">
9172+
[]
9173+
</pre>
91149174
</td>
91159175
</tr>
91169176
<tr>
@@ -10008,7 +10068,8 @@ null
1000810068
"serviceAnnotations": {},
1000910069
"serviceLabels": {},
1001010070
"terminationGracePeriodSeconds": 300,
10011-
"tolerations": []
10071+
"tolerations": [],
10072+
"topologySpreadConstraints": []
1001210073
}
1001310074
</pre>
1001410075
</td>
@@ -10301,6 +10362,15 @@ null
1030110362
<td><pre lang="json">
1030210363
[]
1030310364
</pre>
10365+
</td>
10366+
</tr>
10367+
<tr>
10368+
<td>ruler.topologySpreadConstraints</td>
10369+
<td>list</td>
10370+
<td>Topology Spread Constraints for ruler pods</td>
10371+
<td><pre lang="json">
10372+
[]
10373+
</pre>
1030410374
</td>
1030510375
</tr>
1030610376
<tr>

‎production/helm/loki/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang
1313

1414
[//]: # (<AUTOMATED_UPDATES_LOCATOR> : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.)
1515

16+
- [ENHANCEMENT] Expose Topology Spread Constraints in Helm chart templates and default values.
17+
1618
## 6.19.0
1719

1820
## 6.18.0

‎production/helm/loki/templates/compactor/statefulset-compactor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ spec:
4848
{{- toYaml . | nindent 8 }}
4949
{{- end }}
5050
spec:
51-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
51+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
5252
{{- with .Values.compactor.topologySpreadConstraints }}
5353
topologySpreadConstraints:
5454
{{- tpl . $ | nindent 8 }}

‎production/helm/loki/templates/distributor/deployment-distributor.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ spec:
4444
{{- toYaml . | nindent 8 }}
4545
{{- end }}
4646
spec:
47+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
48+
{{- with .Values.distributor.topologySpreadConstraints }}
49+
topologySpreadConstraints:
50+
{{- toYaml . | nindent 8 }}
51+
{{- end }}
52+
{{- end }}
4753
serviceAccountName: {{ include "loki.serviceAccountName" . }}
4854
{{- with .Values.imagePullSecrets }}
4955
imagePullSecrets:

‎production/helm/loki/templates/gateway/deployment-gateway-enterprise.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ spec:
3838
{{- toYaml . | nindent 8 }}
3939
{{- end }}
4040
spec:
41+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
42+
{{- with .Values.enterpriseGateway.topologySpreadConstraints }}
43+
topologySpreadConstraints:
44+
{{- toYaml . | nindent 8 }}
45+
{{- end }}
46+
{{- end }}
4147
serviceAccountName: {{ template "loki.serviceAccountName" . }}
4248
{{- if .Values.enterpriseGateway.priorityClassName }}
4349
priorityClassName: {{ .Values.enterpriseGateway.priorityClassName }}
@@ -143,4 +149,4 @@ spec:
143149
{{- if .Values.enterpriseGateway.extraVolumes }}
144150
{{ toYaml .Values.enterpriseGateway.extraVolumes | nindent 8 }}
145151
{{- end }}
146-
{{- end }}
152+
{{- end }}

‎production/helm/loki/templates/index-gateway/statefulset-index-gateway.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ spec:
132132
nodeSelector:
133133
{{- toYaml . | nindent 8 }}
134134
{{- end }}
135+
{{- with .Values.indexGateway.topologySpreadConstraints }}
136+
topologySpreadConstraints:
137+
{{- toYaml . | nindent 8 }}
138+
{{- end }}
135139
{{- with .Values.indexGateway.tolerations }}
136140
tolerations:
137141
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-a.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ spec:
6969
{{- toYaml . | nindent 8 }}
7070
{{- end }}
7171
spec:
72-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
72+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
7373
{{- with .Values.ingester.topologySpreadConstraints }}
7474
topologySpreadConstraints:
7575
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-b.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ spec:
6969
{{- toYaml . | nindent 8 }}
7070
{{- end }}
7171
spec:
72-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
72+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
7373
{{- with .Values.ingester.topologySpreadConstraints }}
7474
topologySpreadConstraints:
7575
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-c.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ spec:
6969
{{- toYaml . | nindent 8 }}
7070
{{- end }}
7171
spec:
72-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
72+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
7373
{{- with .Values.ingester.topologySpreadConstraints }}
7474
topologySpreadConstraints:
7575
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/ingester/statefulset-ingester.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ spec:
5555
{{- toYaml . | nindent 8 }}
5656
{{- end }}
5757
spec:
58-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
58+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
5959
{{- with .Values.ingester.topologySpreadConstraints }}
6060
topologySpreadConstraints:
6161
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/pattern-ingester/statefulset-pattern-ingester.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ spec:
131131
nodeSelector:
132132
{{- toYaml . | nindent 8 }}
133133
{{- end }}
134+
{{- with .Values.patternIngester.topologySpreadConstraints }}
135+
topologySpreadConstraints:
136+
{{- toYaml . | nindent 8 }}
137+
{{- end }}
134138
{{- with .Values.patternIngester.tolerations }}
135139
tolerations:
136140
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/querier/deployment-querier.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
{{- toYaml . | nindent 8 }}
4545
{{- end }}
4646
spec:
47-
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
47+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
4848
{{- with .Values.querier.topologySpreadConstraints }}
4949
topologySpreadConstraints:
5050
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/query-frontend/deployment-query-frontend.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ spec:
4343
{{- toYaml . | nindent 8 }}
4444
{{- end }}
4545
spec:
46+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
47+
{{- with .Values.queryFrontend.topologySpreadConstraints }}
48+
topologySpreadConstraints:
49+
{{- toYaml . | nindent 8 }}
50+
{{- end }}
51+
{{- end }}
4652
serviceAccountName: {{ include "loki.serviceAccountName" . }}
4753
{{- with .Values.imagePullSecrets }}
4854
imagePullSecrets:

‎production/helm/loki/templates/query-scheduler/deployment-query-scheduler.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ spec:
4141
{{- end }}
4242
app.kubernetes.io/part-of: memberlist
4343
spec:
44+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
45+
{{- with .Values.queryScheduler.topologySpreadConstraints }}
46+
topologySpreadConstraints:
47+
{{- toYaml . | nindent 8 }}
48+
{{- end }}
49+
{{- end }}
4450
serviceAccountName: {{ include "loki.serviceAccountName" . }}
4551
{{- with .Values.imagePullSecrets }}
4652
imagePullSecrets:

‎production/helm/loki/templates/ruler/statefulset-ruler.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ spec:
3838
{{- toYaml . | nindent 8 }}
3939
{{- end }}
4040
spec:
41+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
42+
{{- with .Values.ruler.topologySpreadConstraints }}
43+
topologySpreadConstraints:
44+
{{- toYaml . | nindent 8 }}
45+
{{- end }}
46+
{{- end }}
4147
serviceAccountName: {{ include "loki.serviceAccountName" . }}
4248
{{- with .Values.imagePullSecrets }}
4349
imagePullSecrets:

‎production/helm/loki/values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,8 @@ enterpriseGateway:
11611161
affinity: {}
11621162
# -- Node selector for gateway Pods
11631163
nodeSelector: {}
1164+
# -- Topology Spread Constraints for enterprise-gateway pods
1165+
topologySpreadConstraints: []
11641166
# -- Tolerations for gateway Pods
11651167
tolerations: []
11661168
# -- Grace period to allow the gateway to shutdown before it is killed
@@ -1973,6 +1975,8 @@ distributor:
19731975
maxSurge: 0
19741976
# -- Node selector for distributor pods
19751977
nodeSelector: {}
1978+
# -- Topology Spread Constraints for distributor pods
1979+
topologySpreadConstraints: []
19761980
# -- Tolerations for distributor pods
19771981
tolerations: []
19781982
# -- Adds the appProtocol field to the distributor service. This allows distributor to work with istio protocol selection.
@@ -2181,6 +2185,8 @@ queryFrontend:
21812185
maxUnavailable: null
21822186
# -- Node selector for query-frontend pods
21832187
nodeSelector: {}
2188+
# -- Topology Spread Constraints for query-frontend pods
2189+
topologySpreadConstraints: []
21842190
# -- Tolerations for query-frontend pods
21852191
tolerations: []
21862192
# -- Adds the appProtocol field to the queryFrontend service. This allows queryFrontend to work with istio protocol selection.
@@ -2244,6 +2250,8 @@ queryScheduler:
22442250
maxUnavailable: 1
22452251
# -- Node selector for query-scheduler pods
22462252
nodeSelector: {}
2253+
# -- Topology Spread Constraints for query-scheduler pods
2254+
topologySpreadConstraints: []
22472255
# -- Tolerations for query-scheduler pods
22482256
tolerations: []
22492257
# -- Set the optional grpc service protocol. Ex: "grpc", "http2" or "https"
@@ -2308,6 +2316,8 @@ indexGateway:
23082316
maxUnavailable: null
23092317
# -- Node selector for index-gateway pods
23102318
nodeSelector: {}
2319+
# -- Topology Spread Constraints for index-gateway pods
2320+
topologySpreadConstraints: []
23112321
# -- Tolerations for index-gateway pods
23122322
tolerations: []
23132323
persistence:
@@ -2796,6 +2806,8 @@ patternIngester:
27962806
terminationGracePeriodSeconds: 30
27972807
# -- Node selector for pattern ingester pods
27982808
nodeSelector: {}
2809+
# -- Topology Spread Constraints for pattern ingester pods
2810+
topologySpreadConstraints: []
27992811
# -- Tolerations for pattern ingester pods
28002812
tolerations: []
28012813
# -- Set the optional grpc service protocol. Ex: "grpc", "http2" or "https"
@@ -2904,6 +2916,8 @@ ruler:
29042916
maxUnavailable: null
29052917
# -- Node selector for ruler pods
29062918
nodeSelector: {}
2919+
# -- Topology Spread Constraints for ruler pods
2920+
topologySpreadConstraints: []
29072921
# -- Tolerations for ruler pods
29082922
tolerations: []
29092923
# -- DNSConfig for ruler pods

0 commit comments

Comments
 (0)