Skip to content

Commit

Permalink
Update install script to allow conf name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
weikinhuang committed Oct 11, 2017
1 parent 7f506c3 commit a461fbd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions k8s-install/scripts/install-cni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,23 @@ sed -i s~__ETCD_CA_CERT_FILE__~${CNI_CONF_ETCD_CA:-}~g $TMP_CONF
sed -i s~__ETCD_ENDPOINTS__~${ETCD_ENDPOINTS:-}~g $TMP_CONF
sed -i s~__LOG_LEVEL__~${LOG_LEVEL:-warn}~g $TMP_CONF

FILENAME=${CNI_CONF_NAME:-10-calico.conf}
CNI_CONF_NAME=${CNI_CONF_NAME:-10-calico.conf}
CNI_OLD_NAME=${CNI_OLD_NAME:-10-calico.conf}

# Log the config file before inserting service account token.
# This way auth token is not visible in the logs.
echo "CNI config: $(cat ${TMP_CONF})"

sed -i s/__SERVICEACCOUNT_TOKEN__/${SERVICEACCOUNT_TOKEN:-}/g $TMP_CONF

# Delete old CNI config files for upgrades.
if [ "${CNI_CONF_NAME}" != "${CNI_OLD_NAME}" ]; then
rm -f "/host/etc/cni/net.d/${CNI_OLD_NAME}"
fi
# Move the temporary CNI config into place.
mv $TMP_CONF /host/etc/cni/net.d/${FILENAME}
mv $TMP_CONF /host/etc/cni/net.d/${CNI_CONF_NAME}

echo "Created CNI config $FILENAME"
echo "Created CNI config ${CNI_CONF_NAME}"

# Unless told otherwise, sleep forever.
# This prevents Kubernetes from restarting the pod repeatedly.
Expand Down

0 comments on commit a461fbd

Please sign in to comment.