From cd99469454f064177006d215cab907a6804f4966 Mon Sep 17 00:00:00 2001 From: RAHUL KHIYANI Date: Sun, 21 Apr 2019 21:16:15 -0500 Subject: [PATCH] Kibana: Fix security context This PS fixes the use of the security context macros for the Kibana chart. Change-Id: Iaad821ac3df7e42eb52ba2f274fe47e4847d30af --- kibana/templates/deployment.yaml | 3 +++ .../templates/job-register-kibana-indexes.yaml | 2 ++ kibana/values.yaml | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/kibana/templates/deployment.yaml b/kibana/templates/deployment.yaml index 82a455f40..6bbdd102d 100644 --- a/kibana/templates/deployment.yaml +++ b/kibana/templates/deployment.yaml @@ -45,6 +45,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" "dashboard" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: {{ tuple $envAll "kibana" "dashboard" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} @@ -56,6 +57,7 @@ spec: - name: apache-proxy {{ tuple $envAll "apache_proxy" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.apache_proxy | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "dashboard" "container" "apache_proxy" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/apache.sh - start @@ -92,6 +94,7 @@ spec: - name: kibana {{ tuple $envAll "kibana" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.kibana | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "dashboard" "container" "kibana" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/kibana.sh - start diff --git a/kibana/templates/job-register-kibana-indexes.yaml b/kibana/templates/job-register-kibana-indexes.yaml index d16196c37..dc4f8f42e 100644 --- a/kibana/templates/job-register-kibana-indexes.yaml +++ b/kibana/templates/job-register-kibana-indexes.yaml @@ -30,6 +30,7 @@ spec: labels: {{ tuple $envAll "kibana" "register_kibana_indexes" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: +{{ dict "envAll" $envAll "application" "register_kibana_indexes" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure nodeSelector: @@ -40,6 +41,7 @@ spec: - name: register-kibana-indexes {{ tuple $envAll "register_kibana_indexes" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.register_kibana_indexes | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "register_kibana_indexes" "container" "register_kibana_indexes" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} env: - name: ELASTICSEARCH_USERNAME valueFrom: diff --git a/kibana/values.yaml b/kibana/values.yaml index 89b1a579c..69ba2b169 100644 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -35,6 +35,24 @@ images: - image_repo_sync pod: + security_context: + dashboard: + pod: + runAsUser: 999 + container: + apache_proxy: + runAsUser: 0 + readOnlyRootFilesystem: false + kibana: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: false + register_kibana_indexes: + pod: + runAsUser: 999 + container: + register_kibana_indexes: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: false affinity: anti: type: