From 7cbe8070bc5e5b20c9f403719406f87b6f73f5bc Mon Sep 17 00:00:00 2001 From: Vinayak Goyal Date: Thu, 8 Oct 2020 14:16:37 -0700 Subject: [PATCH] Update write-pki-data to give read permissions to KUBE_PKI_READERS_GROUP, for components running as non-root to be able to read the credentials. --- cluster/gce/gci/configure-helper.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 6d69bc55fea..4e8b748244c 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -619,7 +619,12 @@ function append_or_replace_prefixed_line { function write-pki-data { local data="${1}" local path="${2}" - (umask 077; echo "${data}" | base64 --decode > "${path}") + if [[ -n "${KUBE_PKI_READERS_GROUP:-}" ]]; then + (umask 027; echo "${data}" | base64 --decode > "${path}") + chgrp "${KUBE_PKI_READERS_GROUP:-}" "${path}" + else + (umask 077; echo "${data}" | base64 --decode > "${path}") + fi } function create-node-pki {