Skip to content

Commit 24a1983

Browse files
[PM-19673] Add nodeSelector and tolerations (#239)
* add default nodeSelect & tolerations values * add nodeSelector & tolerations to admin template * add nodeSelector & tolerations to api template * add nodeSelector & tolerations to attachments template * add nodeSelector & tolerations to events template * add nodeSelector & tolerations to icons template * add nodeSelector & tolerations to notifications template * add nodeSelector & tolerations to scim template * add nodeSelector & tolerations to sso template * add nodeSelector & tolerations to web template * add nodeSelector & tolerations to mssql template * add nodeSelector & tolerations to pre & post templates * add nodeSelector & tolerations to sm-operator deployment * add nodeSelector & tolerations to values.schema.json * tolerations should be an array of objects * Update charts/sm-operator/values.yaml tolerations should be array of objects * remove test data from charts/self-host/values.yaml * move nodeSelector & tolerations next to labels * move all nodeSelect & tolerations next to labels, add comments * move all nodeSelect & tolerations next to labels in values.schema.json * harmonize nodeSelector & toleration comments in sm-operator Helm chart --------- Co-authored-by: MtnBurrit0 <[email protected]>
1 parent 6f24e4c commit 24a1983

21 files changed

+423
-0
lines changed

charts/self-host/templates/admin.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app: {{ template "bitwarden.admin" . }}
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.admin.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.admin.nodeSelector }}
31+
{{ toYaml .Values.component.admin.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.admin.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.admin.tolerations }}
39+
{{ toYaml .Values.component.admin.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.admin.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.admin.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.admin.podServiceAccount | quote }}

charts/self-host/templates/api.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: api
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.api.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.api.nodeSelector }}
31+
{{ toYaml .Values.component.api.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.api.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.api.tolerations }}
39+
{{ toYaml .Values.component.api.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.api.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.api.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.api.podServiceAccount | quote }}

charts/self-host/templates/attachments.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: attachments
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.attachments.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.attachments.nodeSelector }}
31+
{{ toYaml .Values.component.attachments.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.attachments.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.attachments.tolerations }}
39+
{{ toYaml .Values.component.attachments.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.attachments.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.attachments.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.attachments.podServiceAccount | quote }}

charts/self-host/templates/events.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: events
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.events.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.events.nodeSelector }}
31+
{{ toYaml .Values.component.events.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.events.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.events.tolerations }}
39+
{{ toYaml .Values.component.events.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.events.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.events.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.events.podServiceAccount | quote }}

charts/self-host/templates/icons.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: icons
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.icons.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.icons.nodeSelector }}
31+
{{ toYaml .Values.component.icons.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.icons.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.icons.tolerations }}
39+
{{ toYaml .Values.component.icons.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.icons.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.icons.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.icons.podServiceAccount | quote }}

charts/self-host/templates/identity.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: identity
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.identity.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.identity.nodeSelector }}
31+
{{ toYaml .Values.component.identity.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.identity.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.identity.tolerations }}
39+
{{ toYaml .Values.component.identity.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.identity.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.identity.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.identity.podServiceAccount | quote }}

charts/self-host/templates/mssql.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ spec:
3030
{{ toYaml . | indent 8 }}
3131
{{- end }}
3232
spec:
33+
{{- with .Values.general.nodeSelector }}
34+
nodeSelector:
35+
{{- toYaml . | nindent 8 }}
36+
{{- end }}
37+
{{- with .Values.general.tolerations }}
38+
tolerations:
39+
{{- toYaml . | nindent 8 }}
40+
{{- end }}
3341
{{- if .Values.database.podServiceAccount }}
3442
serviceAccount: {{ .Values.database.podServiceAccount | quote }}
3543
serviceAccountName: {{ .Values.database.podServiceAccount | quote }}

charts/self-host/templates/notifications.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: notifications
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.notifications.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.notifications.nodeSelector }}
31+
{{ toYaml .Values.component.notifications.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.notifications.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.notifications.tolerations }}
39+
{{ toYaml .Values.component.notifications.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.notifications.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.notifications.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.notifications.podServiceAccount | quote }}

charts/self-host/templates/post-delete-hook.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ spec:
1616
labels:
1717
app.kubernetes.io/component: post-delete-hook
1818
spec:
19+
{{- with .Values.general.nodeSelector }}
20+
nodeSelector:
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
{{- with .Values.general.tolerations }}
24+
tolerations:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
1927
{{- if .Values.serviceAccount.name }}
2028
serviceAccountName: "{{ .Values.serviceAccount.name }}"
2129
{{- end }}

charts/self-host/templates/post-install-db-migrator-job.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ spec:
1616
labels:
1717
app.kubernetes.io/component: post-install-db-migrator-job
1818
spec:
19+
{{- with .Values.general.nodeSelector }}
20+
nodeSelector:
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
{{- with .Values.general.tolerations }}
24+
tolerations:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
1927
{{- if .Values.serviceAccount.name }}
2028
serviceAccountName: "{{ .Values.serviceAccount.name }}"
2129
{{- end }}

charts/self-host/templates/pre-install-db-migrator-job.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ spec:
2020
labels:
2121
app.kubernetes.io/component: pre-install-db-migrator-job
2222
spec:
23+
{{- with .Values.general.nodeSelector }}
24+
nodeSelector:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
{{- with .Values.general.tolerations }}
28+
tolerations:
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
2331
{{- if .Values.serviceAccount.name }}
2432
serviceAccountName: {{ .Values.serviceAccount.name | quote }}
2533
{{- end }}

charts/self-host/templates/pre-install-job.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ spec:
2323
labels:
2424
app.kubernetes.io/component: pre-install-hook
2525
spec:
26+
{{- with .Values.general.nodeSelector }}
27+
nodeSelector:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
{{- with .Values.general.tolerations }}
31+
tolerations:
32+
{{- toYaml . | nindent 8 }}
33+
{{- end }}
2634
{{- if .Values.serviceAccount.name }}
2735
serviceAccountName: {{ .Values.serviceAccount.name | quote }}
2836
{{- end }}

charts/self-host/templates/pre-install-secret-sql.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ spec:
1919
labels:
2020
app.kubernetes.io/component: pre-install-hook
2121
spec:
22+
{{- with .Values.general.nodeSelector }}
23+
nodeSelector:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
{{- with .Values.general.tolerations }}
27+
tolerations:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
2230
{{- if .Values.serviceAccount.name }}
2331
serviceAccountName: {{ .Values.serviceAccount.name | quote }}
2432
{{- end }}

charts/self-host/templates/scim.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ spec:
2626
app.kubernetes.io/component: scim
2727
{{ include "bitwarden.labels" . | indent 8 }}
2828
spec:
29+
{{- if or .Values.component.scim.nodeSelector .Values.general.nodeSelector }}
30+
nodeSelector:
31+
{{- if .Values.component.scim.nodeSelector }}
32+
{{ toYaml .Values.component.scim.nodeSelector | nindent 8 }}
33+
{{- else }}
34+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
35+
{{- end }}
36+
{{- end }}
37+
{{- if or .Values.component.scim.tolerations .Values.general.tolerations }}
38+
tolerations:
39+
{{- if .Values.component.scim.tolerations }}
40+
{{ toYaml .Values.component.scim.tolerations | nindent 8 }}
41+
{{- else }}
42+
{{ toYaml .Values.general.tolerations | nindent 8 }}
43+
{{- end }}
44+
{{- end }}
2945
{{- if .Values.component.scim.podServiceAccount }}
3046
serviceAccount: {{ .Values.component.scim.podServiceAccount | quote }}
3147
serviceAccountName: {{ .Values.component.scim.podServiceAccount | quote }}

charts/self-host/templates/sso.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: sso
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.sso.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.sso.nodeSelector }}
31+
{{ toYaml .Values.component.sso.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.sso.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.sso.tolerations }}
39+
{{ toYaml .Values.component.sso.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.sso.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.sso.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.sso.podServiceAccount | quote }}

charts/self-host/templates/web.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ spec:
2525
app.kubernetes.io/component: web
2626
{{ include "bitwarden.labels" . | indent 8 }}
2727
spec:
28+
{{- if or .Values.component.web.nodeSelector .Values.general.nodeSelector }}
29+
nodeSelector:
30+
{{- if .Values.component.web.nodeSelector }}
31+
{{ toYaml .Values.component.web.nodeSelector | nindent 8 }}
32+
{{- else }}
33+
{{ toYaml .Values.general.nodeSelector | nindent 8 }}
34+
{{- end }}
35+
{{- end }}
36+
{{- if or .Values.component.web.tolerations .Values.general.tolerations }}
37+
tolerations:
38+
{{- if .Values.component.web.tolerations }}
39+
{{ toYaml .Values.component.web.tolerations | nindent 8 }}
40+
{{- else }}
41+
{{ toYaml .Values.general.tolerations | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
2844
{{- if .Values.component.web.podServiceAccount }}
2945
serviceAccount: {{ .Values.component.web.podServiceAccount | quote }}
3046
serviceAccountName: {{ .Values.component.web.podServiceAccount | quote }}

0 commit comments

Comments
 (0)