Skip to content

Commit

Permalink
Merge pull request #392 from weikinhuang/conf-conflist-upgrade
Browse files Browse the repository at this point in the history
Update install script to allow conf name changes
  • Loading branch information
caseydavenport authored Oct 11, 2017
2 parents 380abc3 + ec0e68c commit 161e5f1
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_CONF_NAME=${CNI_OLD_CONF_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_CONF_NAME}" ]; then
rm -f "/host/etc/cni/net.d/${CNI_OLD_CONF_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 161e5f1

Please sign in to comment.