Skip to content

Commit

Permalink
Merge pull request #390 from heschlie/fixing-tls-failure
Browse files Browse the repository at this point in the history
Fixing TLS copy error
  • Loading branch information
caseydavenport authored Oct 9, 2017
2 parents 1498db1 + 665e3ee commit 7f506c3
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions k8s-install/scripts/install-cni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ rm -f /host/opt/cni/bin/calico /host/opt/cni/bin/calico-ipam
rm -f /host/etc/cni/net.d/calico-tls/*

# Copy over any TLS assets from the SECRETS_MOUNT_DIR to the host.
if [ -e "${SECRETS_MOUNT_DIR}" ];
# First check if the dir exists and has anything in it.
if [ "$(ls -A ${SECRETS_MOUNT_DIR} 2>/dev/null)" ];
then
echo "Installing any TLS assets from ${SECRETS_MOUNT_DIR}"
mkdir -p /host/etc/cni/net.d/calico-tls
Expand Down Expand Up @@ -148,10 +149,15 @@ while [ "$should_sleep" == "true" ]; do
# Kubernetes Secrets can be updated. If so, we need to install the updated
# 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.
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 ${SECRETS_MOUNT_DIR}/* /host/etc/cni/net.d/calico-tls/
fi
if [ "$(ls -A ${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 ${SECRETS_MOUNT_DIR}/* /host/etc/cni/net.d/calico-tls/
fi
else
sleep 10
fi
done

0 comments on commit 7f506c3

Please sign in to comment.