Skip to content

Commit

Permalink
feat: add topologySpreadConstraints configuration option for deploy…
Browse files Browse the repository at this point in the history
…ments (#157)

* add topologySpreadConstraints configuration options

* add topologySpreadConstraints to bindplane template

* add topologySpreadConstraints to bindplane-jobs template

* add topologySpreadConstraints to bindplane-nats template

* add topologySpreadConstraints to prometheus template

* add topologySpreadConstraints to transform agent template

* change topologySpreadConstraints from object to array

* bump chart minor version

* add topologySpreadConstraints to test case all

* fix typo
  • Loading branch information
algchoo authored Sep 11, 2024
1 parent df0f1e2 commit 56b991b
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 1 deletion.
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

0 comments on commit 56b991b

Please sign in to comment.