Registry: Add pod/container security context

This updates the registry chart to include the pod
security context on the pod template

This also adds the container security context

Change-Id: I36b6a2cf291dda2f991843c07ba116f3bf936d03
This commit is contained in:
Rahul Khiyani 2019-03-22 16:28:45 -04:00 committed by RAHUL KHIYANI
parent 5e1ecd9840
commit 8edaf9fa31
3 changed files with 19 additions and 0 deletions

View File

@ -41,6 +41,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
spec:
{{ dict "envAll" $envAll "application" "registry_proxy" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
nodeSelector:
{{ .Values.labels.registry.node_selector_key }}: {{ .Values.labels.registry.node_selector_value | quote }}
@ -52,6 +53,7 @@ spec:
- name: registry-proxy
{{ tuple $envAll "registry_proxy" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.registry_proxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "registry_proxy" "container" "registry_proxy" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/registry-proxy.sh
volumeMounts:

View File

@ -43,6 +43,7 @@ spec:
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
spec:
{{ dict "envAll" $envAll "application" "registry" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
affinity:
{{ tuple $envAll "docker" "registry" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
@ -54,6 +55,7 @@ spec:
- name: registry
{{ tuple $envAll "registry" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.registry | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "registry" "container" "registry" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
ports:
- name: d-reg
containerPort: {{ tuple "docker_registry" "internal" "registry" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}

View File

@ -75,6 +75,21 @@ conf:
addr: null
pod:
security_context:
registry_proxy:
pod:
runAsUser: 65534
container:
registry_proxy:
runAsUser: 0
readOnlyRootFilesystem: false
registry:
pod:
runAsUser: 65534
container:
registry:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
affinity:
anti:
type: