@@ -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.
4444fetch_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 ' ' '
5757import pipes,sys,yaml
5858for 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.
6666is_preloaded () {
6767 local -r tar=$1
6868 local -r sha1=$2
@@ -138,6 +138,7 @@ config_path="${CONTAINERD_CONFIG_PATH:-"/etc/containerd/config.toml"}"
138138mkdir -p $( dirname ${config_path} )
139139cni_bin_dir=" ${CONTAINERD_HOME} /opt/cni/bin"
140140cni_template_path=" ${CONTAINERD_HOME} /opt/containerd/cluster/gce/cni.template"
141+ # NETWORK_POLICY_PROVIDER is from kube-env.
141142network_policy_provider=" ${NETWORK_POLICY_PROVIDER:- " none" } "
142143if [ -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