Implement helm-toolkit snippet to drydock pods/containers
This updates the drydock chart to include the pod security context on the pod template. This also adds the container security context to set readOnlyRootFilesystem flag to true Change-Id: Ibeb60d0b88f3519730b5b76996ab137c5af4f4f5
This commit is contained in:
parent
6a9c6b092b
commit
63f7783da2
|
@ -36,6 +36,7 @@ spec:
|
||||||
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
spec:
|
spec:
|
||||||
|
{{ dict "envAll" $envAll "application" "db_init" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
||||||
serviceAccountName: {{ $serviceAccountName }}
|
serviceAccountName: {{ $serviceAccountName }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
|
@ -47,6 +48,7 @@ spec:
|
||||||
image: {{ .Values.images.tags.drydock_db_init | quote }}
|
image: {{ .Values.images.tags.drydock_db_init | quote }}
|
||||||
imagePullPolicy: {{ .Values.images.pull_policy | quote }}
|
imagePullPolicy: {{ .Values.images.pull_policy | quote }}
|
||||||
{{ tuple $envAll $envAll.Values.pod.resources.jobs.drydock_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
{{ tuple $envAll $envAll.Values.pod.resources.jobs.drydock_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||||
|
{{ dict "envAll" $envAll "application" "db_init" "container" "drydock_db_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
||||||
env:
|
env:
|
||||||
- name: USER_DB_NAME
|
- name: USER_DB_NAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
|
|
|
@ -36,6 +36,7 @@ spec:
|
||||||
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
|
||||||
spec:
|
spec:
|
||||||
|
{{ dict "envAll" $envAll "application" "db_sync" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
||||||
serviceAccountName: {{ $serviceAccountName }}
|
serviceAccountName: {{ $serviceAccountName }}
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
|
@ -47,6 +48,7 @@ spec:
|
||||||
image: {{ .Values.images.tags.drydock_db_sync | quote }}
|
image: {{ .Values.images.tags.drydock_db_sync | quote }}
|
||||||
imagePullPolicy: {{ .Values.images.pull_policy | quote }}
|
imagePullPolicy: {{ .Values.images.pull_policy | quote }}
|
||||||
{{ tuple $envAll $envAll.Values.pod.resources.jobs.drydock_db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
{{ tuple $envAll $envAll.Values.pod.resources.jobs.drydock_db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||||
|
{{ dict "envAll" $envAll "application" "db_sync" "container" "drydock_db_sync" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
||||||
env:
|
env:
|
||||||
- name: DRYDOCK_DB_URL
|
- name: DRYDOCK_DB_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
|
|
|
@ -29,6 +29,7 @@ metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll "drydock" "api-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
{{ tuple $envAll "drydock" "api-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||||
spec:
|
spec:
|
||||||
|
{{ dict "envAll" $envAll "application" "api_test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
|
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
|
||||||
|
@ -40,6 +41,7 @@ spec:
|
||||||
image: {{ .Values.images.tags.drydock }}
|
image: {{ .Values.images.tags.drydock }}
|
||||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||||
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
||||||
|
{{ dict "envAll" $envAll "application" "api_test" "container" "drydock_api_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
|
||||||
command: ["/bin/bash", "-c", "curl -v -X GET --fail ${DRYDOCK_URL}/api/v1.0/health; exit $?"]
|
command: ["/bin/bash", "-c", "curl -v -X GET --fail ${DRYDOCK_URL}/api/v1.0/health; exit $?"]
|
||||||
...
|
...
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -30,6 +30,7 @@ metadata:
|
||||||
labels:
|
labels:
|
||||||
{{ tuple $envAll "drydock" "auth-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
{{ tuple $envAll "drydock" "auth-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||||
spec:
|
spec:
|
||||||
|
{{ dict "envAll" $envAll "application" "auth_test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
|
||||||
restartPolicy: Never
|
restartPolicy: Never
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
|
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
|
||||||
|
@ -41,6 +42,7 @@ spec:
|
||||||
image: {{ .Values.images.tags.drydock }}
|
image: {{ .Values.images.tags.drydock }}
|
||||||
imagePullPolicy: {{ .Values.images.pull_policy }}
|
imagePullPolicy: {{ .Values.images.pull_policy }}
|
||||||
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
{{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
|
||||||
|
{{ dict "envAll" $envAll "application" "auth_test" "container" "drydock_auth_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
|
||||||
command: ["/bin/bash", "-c", 'curl -v -X GET --fail ${DRYDOCK_URL}/api/v1.0/tasks; exit_code=$?; if [ "$exit_code" = "22" ]; then exit 0; fi; exit 1']
|
command: ["/bin/bash", "-c", 'curl -v -X GET --fail ${DRYDOCK_URL}/api/v1.0/tasks; exit_code=$?; if [ "$exit_code" = "22" ]; then exit 0; fi; exit 1']
|
||||||
...
|
...
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -79,8 +79,36 @@ pod:
|
||||||
runAsUser: 65534
|
runAsUser: 65534
|
||||||
container:
|
container:
|
||||||
drydock_api:
|
drydock_api:
|
||||||
allowPrivilegeEscalation: false
|
|
||||||
readOnlyRootFilesystem: true
|
readOnlyRootFilesystem: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
db_init:
|
||||||
|
pod:
|
||||||
|
runAsUser: 65534
|
||||||
|
container:
|
||||||
|
drydock_db_init:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
db_sync:
|
||||||
|
pod:
|
||||||
|
runAsUser: 65534
|
||||||
|
container:
|
||||||
|
drydock_db_sync:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
api_test:
|
||||||
|
pod:
|
||||||
|
runAsUser: 65534
|
||||||
|
container:
|
||||||
|
drydock_api_test:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
auth_test:
|
||||||
|
pod:
|
||||||
|
runAsUser: 65534
|
||||||
|
container:
|
||||||
|
drydock_auth_test:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
lifecycle:
|
lifecycle:
|
||||||
upgrades:
|
upgrades:
|
||||||
deployments:
|
deployments:
|
||||||
|
|
Loading…
Reference in New Issue