Skip to content

Instantly share code, notes, and snippets.

@lwille
Last active August 9, 2019 13:59
Show Gist options
  • Save lwille/011509c9bde028b6948dfee3e490c10e to your computer and use it in GitHub Desktop.
Save lwille/011509c9bde028b6948dfee3e490c10e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Prerequisites:
# - `/bin/bash` and `shasum` available in pod
function wait_k8sync() {
local pod=$1
local file_local=$2
local file_remote=$3
echo -n Waiting for remote file ${file_remote} to reflect changes from ${file_local}...
while ! diff <(shasum ${file_local} | cut -b 1-8 ) <(kubectl exec ${pod} /bin/bash -- -c "shasum ${file_remote} | cut -b 1-8") > /dev/null; do
echo -n .
sleep 1
done
echo file is up to date
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment