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: add topologySpreadConstraints configuration option for deployments #157

2 changes: 1 addition & 1 deletion charts/bindplane/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: bindplane
description: BindPlane OP is an observability pipeline.
type: application
# The chart's version
version: 1.15.1
version: 1.16.0
# The BindPlane OP tagged release. If the user does not
# set the `image.tag` values option, this version is used.
appVersion: 1.72.0
Expand Down
4 changes: 4 additions & 0 deletions charts/bindplane/templates/bindplane-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ spec:
affinity:
{{- toYaml .Values.affinity.jobs | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints.jobs }}
topologySpreadConstraints:
{{- toYaml .Values.topologySpreadConstraints.jobs | nindent 8 }}
{{- end }}
{{- if .Values.backend.postgres.sslsecret.name }}
initContainers:
- name: postgres-tls
Expand Down
4 changes: 4 additions & 0 deletions charts/bindplane/templates/bindplane-nats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ spec:
affinity:
{{- toYaml .Values.affinity.nats | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints.nats }}
topologySpreadConstraints:
{{- toYaml .Values.topologySpreadConstraints.nats | nindent 8 }}
{{- end }}
containers:
- name: server
image: {{ include "bindplane.image" . }}:{{ include "bindplane.tag" . }}
Expand Down
4 changes: 4 additions & 0 deletions charts/bindplane/templates/bindplane.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ spec:
affinity:
{{- toYaml .Values.affinity.bindplane | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints.bindplane }}
topologySpreadConstraints:
{{- toYaml .Values.topologySpreadConstraints.bindplane | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "bindplane.fullname" . }}
{{- with .Values.podSecurityContext }}
securityContext:
Expand Down
4 changes: 4 additions & 0 deletions charts/bindplane/templates/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ spec:
affinity:
{{- toYaml .Values.affinity.prometheus | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints.prometheus }}
topologySpreadConstraints:
{{- toYaml .Values.topologySpreadConstraints.prometheus | nindent 8 }}
{{- end }}
containers:
- name: prometheus
image: {{ .Values.prometheus.image.name }}:{{ include "bindplane.tag" . }}
Expand Down
4 changes: 4 additions & 0 deletions charts/bindplane/templates/transform-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
affinity:
{{- toYaml .Values.affinity.transform_agent | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints.transform_agent }}
topologySpreadConstraints:
{{- toYaml .Values.topologySpreadConstraints.transform_agent | nindent 8 }}
{{- end }}
serviceAccountName: default
{{- with .Values.podSecurityContext }}
securityContext:
Expand Down
16 changes: 16 additions & 0 deletions charts/bindplane/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,22 @@ affinity:
# The transform agent pod is a single pod deployment.
transform_agent: {}

topologySpreadConstraints:
# -- spec.template.spec.topologySpreadConstraints on the BindPlane deployment pods.
bindplane: []
# -- This is for configuring spec.template.spec.topologySpreadConstraints on the BindPlane NATS statefulset
# pods, if NATS is enabled.
nats: []
# -- This is for configuring spec.template.spec.topologySpreadConstraints on the BindPlane Jobs pod.
# The jobs pod is a single pod deployment.
jobs: []
# -- This is for configuring spec.template.spec.topologySpreadConstraints on the BindPlane Prometheus pod.
# The Prometheus pod is a single pod deployment.
prometheus: []
# -- This is for configuring spec.template.spec.topologySpreadConstraints on the BindPlane transform agent pod.
# The transform agent pod is a single pod deployment.
transform_agent: []

autoscaling:
# -- Whether or not autoscaling should be enabled. Requires an eventbus to be configured.
enable: false
Expand Down
41 changes: 41 additions & 0 deletions test/cases/all/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,44 @@ affinity:
operator: In
values:
- us-central1-a

topologySpreadConstraints:
bindplane:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/component: server

nats:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/component: nats

jobs:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/component: jobs

prometheus:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/component: prometheus

transform_agent:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/component: transform-agent
Loading