Skip to content

Commit

Permalink
running containers as not-root
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedemam-VU committed Mar 13, 2020
1 parent 32c8700 commit 3609f2f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions helm/charts/nats/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ spec:
app: {{ template "nats.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
spec:
{{- with .Values.securityContext }}
securityContext:
{{ toYaml . | indent 8 }}
{{- end }}
# Common volumes for the containers.
volumes:
- name: config-volume
Expand Down
8 changes: 7 additions & 1 deletion helm/charts/nats/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ nats:
connectErrorReports:
reconnectErrorReports:

# Toggle whether to use setup a NATS Cluster.
# Toggle whether to use setup a Pod Security Context
# ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
securityContext:
fsGroup: 1000
runAsUser: 1000
runAsNonRoot: true

cluster:
enabled: false

Expand Down
4 changes: 4 additions & 0 deletions helm/charts/stan/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ spec:
app: {{ template "stan.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
spec:
{{- with .Values.securityContext }}
securityContext:
{{ toYaml . | indent 8 }}
{{- end }}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
Expand Down
7 changes: 7 additions & 0 deletions helm/charts/stan/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ stan:
nats:
url:

# Toggle whether to use setup a Pod Security Context
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
securityContext:
fsGroup: 1000
runAsUser: 1000
runAsNonRoot: true

###########################
# #
# Storage configuration #
Expand Down

0 comments on commit 3609f2f

Please sign in to comment.