From 03f60f4b60faacd332d16c86d3951e5acbc999b6 Mon Sep 17 00:00:00 2001 From: Cindy Guo Date: Mon, 12 Apr 2021 08:21:01 +0000 Subject: [PATCH] chown on /mnt/disks/master-pd/var/etcd instead of /var/etcd --- cluster/gce/gci/configure-helper.sh | 10 ++-------- cluster/gce/manifests/etcd.manifest | 2 -- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index bffb491b418..66da8760602 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -1859,16 +1859,10 @@ function prepare-etcd-manifest { # Replace the volume host path. sed -i -e "s@/mnt/master-pd/var/etcd@/mnt/disks/master-pd/var/etcd@g" "${temp_file}" # Replace the run as user and run as group - pod_run_as_user="" - pod_run_as_group="" container_security_context="" if [[ -n "${ETCD_RUNASUSER:-}" && -n "${ETCD_RUNASGROUP:-}" ]]; then - pod_run_as_user="\"runAsUser\": ${ETCD_RUNASUSER}," - pod_run_as_group="\"runAsGroup\": ${ETCD_RUNASGROUP}," - container_security_context="\"securityContext\": {\"allowPrivilegeEscalation\": false, \"capabilities\": {\"drop\": [\"all\"]}}," + container_security_context="\"securityContext\": {\"runAsUser\": ${ETCD_RUNASUSER}, \"runAsGroup\": ${ETCD_RUNASGROUP}, \"allowPrivilegeEscalation\": false, \"capabilities\": {\"drop\": [\"all\"]}}," fi - sed -i -e "s@{{ run_as_user }}@${pod_run_as_user}@g" "${temp_file}" - sed -i -e "s@{{ run_as_group }}@${pod_run_as_group}@g" "${temp_file}" sed -i -e "s@{{security_context}}@${container_security_context}@g" "${temp_file}" mv "${temp_file}" /etc/kubernetes/manifests } @@ -1891,7 +1885,7 @@ function start-etcd-servers { rm -f /etc/init.d/etcd fi if [[ -n "${ETCD_RUNASUSER:-}" && -n "${ETCD_RUNASGROUP:-}" ]]; then - chown -R "${ETCD_RUNASUSER}":"${ETCD_RUNASGROUP}" /var/etcd/ + chown -R "${ETCD_RUNASUSER}":"${ETCD_RUNASGROUP}" /mnt/disks/master-pd/var/etcd fi prepare-log-file /var/log/etcd.log "${ETCD_RUNASUSER:-0}" prepare-etcd-manifest "" "2379" "2380" "200m" "etcd.manifest" diff --git a/cluster/gce/manifests/etcd.manifest b/cluster/gce/manifests/etcd.manifest index 30327fab9ac..ffa5c3fa126 100644 --- a/cluster/gce/manifests/etcd.manifest +++ b/cluster/gce/manifests/etcd.manifest @@ -7,8 +7,6 @@ }, "spec":{ "securityContext": { - {{ run_as_user }} - {{ run_as_group }} "seccompProfile": { "type": "RuntimeDefault" }