Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose topologySpreadConstraints for distributed deployment #14853

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 75 additions & 5 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,8 @@ null
"serviceAnnotations": {},
"serviceLabels": {},
"terminationGracePeriodSeconds": 30,
"tolerations": []
"tolerations": [],
"topologySpreadConstraints": []
}
</pre>
</td>
Expand Down Expand Up @@ -3015,6 +3016,15 @@ null
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>distributor.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for distributor pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -3658,6 +3668,7 @@ false
},
"terminationGracePeriodSeconds": 60,
"tolerations": [],
"topologySpreadConstraints": [],
"useDefaultProxyURLs": true
}
</pre>
Expand Down Expand Up @@ -3858,6 +3869,15 @@ false
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>enterpriseGateway.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for enterprise-gateway pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -4658,6 +4678,7 @@ null
"serviceLabels": {},
"terminationGracePeriodSeconds": 300,
"tolerations": [],
"topologySpreadConstraints": [],
"updateStrategy": {
"type": "RollingUpdate"
}
Expand Down Expand Up @@ -4944,6 +4965,15 @@ null
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>indexGateway.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for index-gateway pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -7686,7 +7716,8 @@ false
"serviceAnnotations": {},
"serviceLabels": {},
"terminationGracePeriodSeconds": 30,
"tolerations": []
"tolerations": [],
"topologySpreadConstraints": []
}
</pre>
</td>
Expand Down Expand Up @@ -8015,6 +8046,15 @@ null
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>patternIngester.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for pattern ingester pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -8541,7 +8581,8 @@ Defaults to allow skew no more then 1 node
"serviceAnnotations": {},
"serviceLabels": {},
"terminationGracePeriodSeconds": 30,
"tolerations": []
"tolerations": [],
"topologySpreadConstraints": []
}
</pre>
</td>
Expand Down Expand Up @@ -8852,6 +8893,15 @@ null
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>queryFrontend.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for query-frontend pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -8899,7 +8949,8 @@ null
"serviceAnnotations": {},
"serviceLabels": {},
"terminationGracePeriodSeconds": 30,
"tolerations": []
"tolerations": [],
"topologySpreadConstraints": []
}
</pre>
</td>
Expand Down Expand Up @@ -9111,6 +9162,15 @@ null
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>queryScheduler.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for query-scheduler pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -10008,7 +10068,8 @@ null
"serviceAnnotations": {},
"serviceLabels": {},
"terminationGracePeriodSeconds": 300,
"tolerations": []
"tolerations": [],
"topologySpreadConstraints": []
}
</pre>
</td>
Expand Down Expand Up @@ -10301,6 +10362,15 @@ null
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
<td>ruler.topologySpreadConstraints</td>
<td>list</td>
<td>Topology Spread Constraints for ruler pods</td>
<td><pre lang="json">
[]
</pre>
</td>
</tr>
<tr>
Expand Down
2 changes: 2 additions & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang

[//]: # (<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.)

- [ENHANCEMENT] Expose Topology Spread Constraints in Helm chart templates and default values.

## 6.19.0

## 6.18.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.compactor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- tpl . $ | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.enterpriseGateway.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ template "loki.serviceAccountName" . }}
{{- if .Values.enterpriseGateway.priorityClassName }}
priorityClassName: {{ .Values.enterpriseGateway.priorityClassName }}
Expand Down Expand Up @@ -143,4 +149,4 @@ spec:
{{- if .Values.enterpriseGateway.extraVolumes }}
{{ toYaml .Values.enterpriseGateway.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.indexGateway.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.indexGateway.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.ingester.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.ingester.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.ingester.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.ingester.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.patternIngester.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.patternIngester.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.querier.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.queryFrontend.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ spec:
{{- end }}
app.kubernetes.io/part-of: memberlist
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.queryScheduler.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
6 changes: 6 additions & 0 deletions production/helm/loki/templates/ruler/statefulset-ruler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.ruler.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
14 changes: 14 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,8 @@ enterpriseGateway:
affinity: {}
# -- Node selector for gateway Pods
nodeSelector: {}
# -- Topology Spread Constraints for enterprise-gateway pods
topologySpreadConstraints: []
# -- Tolerations for gateway Pods
tolerations: []
# -- Grace period to allow the gateway to shutdown before it is killed
Expand Down Expand Up @@ -1973,6 +1975,8 @@ distributor:
maxSurge: 0
# -- Node selector for distributor pods
nodeSelector: {}
# -- Topology Spread Constraints for distributor pods
topologySpreadConstraints: []
# -- Tolerations for distributor pods
tolerations: []
# -- Adds the appProtocol field to the distributor service. This allows distributor to work with istio protocol selection.
Expand Down Expand Up @@ -2181,6 +2185,8 @@ queryFrontend:
maxUnavailable: null
# -- Node selector for query-frontend pods
nodeSelector: {}
# -- Topology Spread Constraints for query-frontend pods
topologySpreadConstraints: []
# -- Tolerations for query-frontend pods
tolerations: []
# -- Adds the appProtocol field to the queryFrontend service. This allows queryFrontend to work with istio protocol selection.
Expand Down Expand Up @@ -2244,6 +2250,8 @@ queryScheduler:
maxUnavailable: 1
# -- Node selector for query-scheduler pods
nodeSelector: {}
# -- Topology Spread Constraints for query-scheduler pods
topologySpreadConstraints: []
# -- Tolerations for query-scheduler pods
tolerations: []
# -- Set the optional grpc service protocol. Ex: "grpc", "http2" or "https"
Expand Down Expand Up @@ -2308,6 +2316,8 @@ indexGateway:
maxUnavailable: null
# -- Node selector for index-gateway pods
nodeSelector: {}
# -- Topology Spread Constraints for index-gateway pods
topologySpreadConstraints: []
# -- Tolerations for index-gateway pods
tolerations: []
persistence:
Expand Down Expand Up @@ -2796,6 +2806,8 @@ patternIngester:
terminationGracePeriodSeconds: 30
# -- Node selector for pattern ingester pods
nodeSelector: {}
# -- Topology Spread Constraints for pattern ingester pods
topologySpreadConstraints: []
# -- Tolerations for pattern ingester pods
tolerations: []
# -- Set the optional grpc service protocol. Ex: "grpc", "http2" or "https"
Expand Down Expand Up @@ -2904,6 +2916,8 @@ ruler:
maxUnavailable: null
# -- Node selector for ruler pods
nodeSelector: {}
# -- Topology Spread Constraints for ruler pods
topologySpreadConstraints: []
# -- Tolerations for ruler pods
tolerations: []
# -- DNSConfig for ruler pods
Expand Down
Loading