Skip to content

Commit

Permalink
Added support to run zookeeper operator as non-root
Browse files Browse the repository at this point in the history
Signed-off-by: anishakj <[email protected]>
  • Loading branch information
anishakj committed Feb 25, 2022
1 parent b150f81 commit d2ebb5a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ spec:
containers:
- name: post-install-upgrade-job
image: "{{ .Values.hooks.image.repository }}:{{ .Values.hooks.image.tag }}"
{{- if .Values.hooks.securityContext }}
securityContext:
{{ toYaml .Values.hooks.securityContext | indent 10 }}
{{- end }}
command:
- /scripts/validations.sh
volumeMounts:
Expand All @@ -116,4 +120,4 @@ spec:
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- end }}
7 changes: 5 additions & 2 deletions charts/zookeeper-operator/templates/pre-delete-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ metadata:
"helm.sh/hook-weight": "2"
"helm.sh/hook-delete-policy": hook-succeeded, before-hook-creation, hook-failed
spec:
backoffLimit: 1
activeDeadlineSeconds: 20
backoffLimit: 6
template:
metadata:
name: {{ template "zookeeper-operator.fullname" . }}-pre-delete
Expand All @@ -101,6 +100,10 @@ spec:
containers:
- name: pre-delete-job
image: "{{ .Values.hooks.image.repository }}:{{ .Values.hooks.image.tag }}"
{{- if .Values.hooks.securityContext }}
securityContext:
{{ toYaml .Values.hooks.securityContext | indent 12 }}
{{- end }}
command:
- /scripts/pre-delete.sh
volumeMounts:
Expand Down
10 changes: 9 additions & 1 deletion charts/zookeeper-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ image:
tag: 0.2.13
pullPolicy: IfNotPresent

securityContext: {}
# runAsUser: 1001
# runAsGroup: 1001

## Additional labels to be added to resources
labels: {}

Expand Down Expand Up @@ -56,11 +60,15 @@ hooks:
backoffLimit: 10
image:
repository: lachlanevenson/k8s-kubectl
tag: v1.16.10
tag: v1.23.2
## Whether to create pre-delete hook which ensures that
## the operator cannot be deleted till the zookeeper cluster
## custom resources have been cleaned up
delete: true
securityContext: {}
# runAsUser: 1001
# runAsGroup: 1001


## Additional Sidecars Configuration.
additionalSidecars: {}
Expand Down
4 changes: 4 additions & 0 deletions charts/zookeeper/templates/post-install-upgrade-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ spec:
containers:
- name: post-install-upgrade-job
image: "{{ .Values.hooks.image.repository }}:{{ .Values.hooks.image.tag }}"
{{- if .Values.hooks.securityContext }}
securityContext:
{{ toYaml .Values.hooks.securityContext | indent 10 }}
{{- end }}
command:
- /scripts/validations.sh
volumeMounts:
Expand Down
7 changes: 5 additions & 2 deletions charts/zookeeper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ config:
# autoPurgePurgeInterval: 1
# quorumListenOnAllIPs: false
# additionalConfig: {}

## configure the storage type
## accepted values : persistence/ephemeral
## default option is persistence
Expand All @@ -93,7 +93,10 @@ ephemeral:
hooks:
image:
repository: lachlanevenson/k8s-kubectl
tag: v1.16.10
tag: v1.23.2
securityContext: {}
# runAsUser: 1001
# runAsGroup: 1001
backoffLimit: 10
pod:
annotations: {}
Expand Down

0 comments on commit d2ebb5a

Please sign in to comment.