Skip to content

Commit 8ac0cf3

Browse files
authored
Allow enabling user namespaces (#79)
This gates the `.spec.hostUsers` field behind a semver version check which verifies that a Kubernetes cluster is at least on version 1.33. If that is the case, it sets the field to `true` which disables user namespaces by default because cluster administrators need to prepare their cluster nodes first, before they are able to switch on user namespaces. Fixes #78 --------- Signed-off-by: Sebastian Hoß <[email protected]>
1 parent c144b5e commit 8ac0cf3

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

charts/db-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
type: application
33
name: db-operator
4-
version: 1.39.0
4+
version: 1.40.0
55
# ---------------------------------------------------------------------------------
66
# -- All supported k8s versions are in the test:
77
# -- https://github.com/db-operator/charts/blob/main/.github/workflows/test.yaml

charts/db-operator/templates/controller/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ spec:
2626
{{ toYaml .Values.annotations | nindent 8 }}
2727
{{- end }}
2828
spec:
29+
{{- if semverCompare ">=1.33-0" .Capabilities.KubeVersion.Version }}
30+
hostUsers: {{ .Values.hostUsers }}
31+
{{- end }}
2932
{{- if .Values.serviceAccount.create }}
3033
serviceAccountName: {{ template "db-operator.serviceAccountName" . }}
3134
{{- end }}

charts/db-operator/templates/webhook/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ spec:
2525
{{ toYaml .Values.annotations | nindent 8 }}
2626
{{- end }}
2727
spec:
28+
{{- if semverCompare ">=1.33-0" .Capabilities.KubeVersion.Version }}
29+
hostUsers: {{ .Values.hostUsers }}
30+
{{- end }}
2831
{{- if .Values.webhook.serviceAccount.create }}
2932
serviceAccountName: {{ template "webhook.serviceAccountName" . }}
3033
{{- end }}

charts/db-operator/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ securityContext:
7777
drop:
7878
- ALL
7979

80+
hostUsers: true
8081
resources: {}
8182
nodeSelector: {}
8283
annotations: {}

0 commit comments

Comments
 (0)