Skip to content

Commit

Permalink
Make install-cni.sh check if the etcd cert file exist.
Browse files Browse the repository at this point in the history
This will prevent it from terminating because `stat` returns non-zero
when called a non-existing file and also stat_output ends up being an
unbound variable.
  • Loading branch information
Ayodele Abejide committed May 22, 2018
1 parent 94e1a02 commit d418383
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions k8s-install/scripts/install-cni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,16 @@ while [ "$should_sleep" == "true" ]; do
# version to the host. Just check the timestamp on the certificate to see if it
# has been updated. A bit hokey, but likely good enough.
if [ "$(ls ${SECRETS_MOUNT_DIR} 2>/dev/null)" ];
then
stat_output=$(stat -c%y ${SECRETS_MOUNT_DIR}/etcd-cert 2>/dev/null)
sleep 10;
if [ "$stat_output" != "$(stat -c%y ${SECRETS_MOUNT_DIR}/etcd-cert 2>/dev/null)" ]; then
echo "Updating installed secrets at: $(date)"
cp -p ${SECRETS_MOUNT_DIR}/* /host/etc/cni/net.d/calico-tls/
fi
then
if [ -e ${SECRETS_MOUNT_DIR}/etcd-cert ]; then
stat_output=$(stat -c%y ${SECRETS_MOUNT_DIR}/etcd-cert 2>/dev/null)
sleep 10;
if [ "$stat_output" != "$(stat -c%y ${SECRETS_MOUNT_DIR}/etcd-cert 2>/dev/null)" ]; then
echo "Updating installed secrets at: $(date)"
cp -p ${SECRETS_MOUNT_DIR}/* /host/etc/cni/net.d/calico-tls/
fi
else
sleep 10
sleep 10
fi
fi
done

0 comments on commit d418383

Please sign in to comment.