diff --git a/templates/flask.yaml b/templates/flask.yaml index cac0c8d..64089eb 100644 --- a/templates/flask.yaml +++ b/templates/flask.yaml @@ -20,10 +20,10 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: flask spec: + {{- with .Values.flask.securityContext }} securityContext: - runAsUser: 0 - runAsGroup: 0 - fsGroup: 0 + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: flask-app image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" diff --git a/templates/postgres.yaml b/templates/postgres.yaml index 996c06a..8460447 100644 --- a/templates/postgres.yaml +++ b/templates/postgres.yaml @@ -22,6 +22,10 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: postgres spec: + {{- with .Values.postgres.securityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: postgres image: "{{ .Values.postgres.image }}" diff --git a/templates/redis.yaml b/templates/redis.yaml index df35c78..f0f82bf 100644 --- a/templates/redis.yaml +++ b/templates/redis.yaml @@ -22,6 +22,10 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: redis spec: + {{- with .Values.redis.securityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: redis image: "{{ .Values.redis.image }}" diff --git a/templates/worker.yaml b/templates/worker.yaml index 32a980f..1103d4d 100644 --- a/templates/worker.yaml +++ b/templates/worker.yaml @@ -20,10 +20,10 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: worker spec: + {{- with .Values.worker.securityContext }} securityContext: - runAsUser: 0 - runAsGroup: 0 - fsGroup: 0 + {{- toYaml . | nindent 8 }} + {{- end }} containers: - name: rq-worker image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" diff --git a/values.yaml b/values.yaml index 20e8b2a..211f870 100644 --- a/values.yaml +++ b/values.yaml @@ -16,12 +16,20 @@ image: flask: replicaCount: 1 + securityContext: + runAsUser: 0 + runAsGroup: 0 + fsGroup: 0 service: type: LoadBalancer port: 8000 worker: replicaCount: 3 + securityContext: + runAsUser: 0 + runAsGroup: 0 + fsGroup: 0 redis: enabled: true