Skip to content

Commit 6e484b2

Browse files
committed
Add afinity pod co location on ReadWriteOnce storage
1 parent ec0615a commit 6e484b2

File tree

10 files changed

+29
-0
lines changed

10 files changed

+29
-0
lines changed

charts/self-host/templates/admin.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ metadata:
77
labels:
88
app.kubernetes.io/component: admin
99
app: {{ template "bitwarden.admin" . }}
10+
1011
{{ include "bitwarden.labels" . | indent 4 }}
1112
{{- with .Values.component.admin.labels }}
1213
{{ toYaml . | indent 4 }}
1314
{{- end }}
1415
spec:
16+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1517
replicas: 1
1618
strategy:
1719
type: "{{ .Values.component.admin.deploymentStrategy }}"

charts/self-host/templates/api.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.api.deploymentStrategy }}"

charts/self-host/templates/attachments.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.attachments.deploymentStrategy }}"

charts/self-host/templates/events.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.events.deploymentStrategy }}"

charts/self-host/templates/helpers.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ app.kubernetes.io/name: {{ template "bitwarden.name" . }}
6565
app.kubernetes.io/managed-by: {{ .Release.Service }}
6666
app.kubernetes.io/instance: {{ .Release.Name }}
6767
helm.sh/chart: {{ template "bitwarden.chart" . }}
68+
{{- if eq (.Values.general.volumeAccessMode "ReadWriteOnce") }}
69+
app.kubernetes.io/storage: "ReadWriteOnce"
70+
{{- end -}}
6871
{{- if .Values.general.labels }}
6972
{{ toYaml .Values.general.labels }}
7073
{{- end -}}
@@ -238,3 +241,19 @@ Name of SCIM components
238241
{{- define "bitwarden.scim" -}}
239242
{{ template "bitwarden.fullname" . }}-scim
240243
{{- end -}}
244+
245+
246+
{{- define "bitwarden.podCoLocation.affinity" -}}
247+
{{- if eq (.Values.general.volumeAccessMode "ReadWriteOnce") }}
248+
affinity:
249+
podAffinity:
250+
requiredDuringSchedulingIgnoredDuringExecution:
251+
- labelSelector:
252+
matchExpressions:
253+
- key: app.kubernetes.io/storage
254+
operator: In
255+
values:
256+
- ReadWriteOnce
257+
topologyKey: "kubernetes.io/hostname"
258+
{{- end -}}
259+
{{- end -}}

charts/self-host/templates/icons.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.icons.deploymentStrategy }}"

charts/self-host/templates/identity.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.identity.deploymentStrategy }}"

charts/self-host/templates/notifications.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.notifications.deploymentStrategy }}"

charts/self-host/templates/scim.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.scim.deploymentStrategy }}"

charts/self-host/templates/sso.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ metadata:
1212
{{ toYaml . | indent 4 }}
1313
{{- end }}
1414
spec:
15+
{{ include "bitwarden.podCoLocation.affinity" . | indent 2 }}
1516
replicas: 1
1617
strategy:
1718
type: "{{ .Values.component.sso.deploymentStrategy }}"

0 commit comments

Comments
 (0)