From a58a78ff837adfcf5b28a5483f8d6c4ca85a7543 Mon Sep 17 00:00:00 2001 From: "KHIYANI, RAHUL (rk0850)" Date: Tue, 11 Aug 2020 09:45:08 -0500 Subject: [PATCH] Add security context template for keystone-webhook container This implements security context override at pod level and adds readOnly-fs to keystone-webhook container Change-Id: Ia67947b7323e41363a5ee379c0dfb001936b5107 --- kubernetes-keystone-webhook/templates/deployment.yaml | 5 ++--- kubernetes-keystone-webhook/values.yaml | 11 ++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kubernetes-keystone-webhook/templates/deployment.yaml b/kubernetes-keystone-webhook/templates/deployment.yaml index 831abf55e..02ffea48d 100644 --- a/kubernetes-keystone-webhook/templates/deployment.yaml +++ b/kubernetes-keystone-webhook/templates/deployment.yaml @@ -37,13 +37,12 @@ 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" "kubernetes-keystone-webhook" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} +{{ dict "envAll" $envAll "application" "kubernetes_keystone_webhook" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} containers: - name: kubernetes-keystone-webhook {{ tuple $envAll "kubernetes_keystone_webhook" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - securityContext: - allowPrivilegeEscalation: false +{{ dict "envAll" $envAll "application" "kubernetes_keystone_webhook" "container" "kubernetes_keystone_webhook" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/start.sh readinessProbe: diff --git a/kubernetes-keystone-webhook/values.yaml b/kubernetes-keystone-webhook/values.yaml index 53a81d4e3..19ec7ad38 100644 --- a/kubernetes-keystone-webhook/values.yaml +++ b/kubernetes-keystone-webhook/values.yaml @@ -48,9 +48,14 @@ network: port: 30601 pod: - user: - kubernetes-keystone-webhook: - uid: 65534 + security_context: + kubernetes_keystone_webhook: + pod: + runAsUser: 65534 + container: + kubernetes_keystone_webhook: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false affinity: anti: type: