Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit fbb7e8a

Browse files
committed
Address comments.
Signed-off-by: Lantao Liu <[email protected]>
1 parent 9aa090b commit fbb7e8a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

cluster/gce/configure.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ fetch_metadata() {
4242
# and generate a env file under ${CONTAINERD_HOME}. It assumes that
4343
# the environment variables in metadata are in yaml format.
4444
fetch_env() {
45-
local -r env_name=$1
45+
local -r env_file_name=$1
4646
(
47-
umask 700;
48-
local -r tmp_env="/tmp/${env_name}.yaml"
49-
tmp_env_content=$(fetch_metadata "${env_name}")
47+
umask 077;
48+
local -r tmp_env_file="/tmp/${env_file_name}.yaml"
49+
tmp_env_content=$(fetch_metadata "${env_file_name}")
5050
if [ -z "${tmp_env_content}" ]; then
51-
echo "No environment variable is specified in ${env_name}"
51+
echo "No environment variable is specified in ${env_file_name}"
5252
return
5353
fi
54-
echo "${tmp_env_content}" > "${tmp_env}"
54+
echo "${tmp_env_content}" > "${tmp_env_file}"
5555
# Convert the yaml format file into a shell-style file.
5656
eval $(python -c '''
5757
import pipes,sys,yaml
5858
for k,v in yaml.load(sys.stdin).iteritems():
5959
print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
60-
''' < "${tmp_env}" > "${CONTAINERD_HOME}/${env_name}")
61-
rm -f "${tmp_env}"
60+
''' < "${tmp_env_file}" > "${CONTAINERD_HOME}/${env_file_name}")
61+
rm -f "${tmp_env_file}"
6262
)
6363
}
6464

65-
# is_preloaded checks whether containerd is preloaded in the image.
65+
# is_preloaded checks whether a package has been preloaded in the image.
6666
is_preloaded() {
6767
local -r tar=$1
6868
local -r sha1=$2
@@ -138,6 +138,7 @@ config_path="${CONTAINERD_CONFIG_PATH:-"/etc/containerd/config.toml"}"
138138
mkdir -p $(dirname ${config_path})
139139
cni_bin_dir="${CONTAINERD_HOME}/opt/cni/bin"
140140
cni_template_path="${CONTAINERD_HOME}/opt/containerd/cluster/gce/cni.template"
141+
# NETWORK_POLICY_PROVIDER is from kube-env.
141142
network_policy_provider="${NETWORK_POLICY_PROVIDER:-"none"}"
142143
if [ -n "${network_policy_provider}" ] && [ "${network_policy_provider}" != "none" ] && [ "${KUBERNETES_MASTER:-}" != "true" ]; then
143144
# Use Kubernetes cni daemonset on node if network policy provider is specified.

0 commit comments

Comments
 (0)