Created
September 18, 2021 13:34
-
-
Save martinkennelly/4c4b97e6c87f70b2f957b2ab3d8f4fd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
if [ "$#" -ne 2 ]; then | |
echo "you need to pass two arguments - $0 LOCAL_FILE_PATH TARGET_FILE_PATH" | |
exit 1 | |
fi | |
if ! [ -x "$(command -v oc)" ]; then | |
echo "you need oc installed" | |
exit 2 | |
fi | |
for node_name in $(oc get nodes --output jsonpath="{range .items[*].metadata}{.name}{'\n'}{end}"); do | |
oc debug node/$node_name -- sleep 10000 &>/dev/null & | |
done | |
sleep 5 | |
debug_pod_names=$(oc get pods --output jsonpath="{range .items[*].metadata}{.name}{'\n'}{end}") | |
for debug_pod in $debug_pod_names; do | |
echo "copying $1 to pod $debug_pod at location $2" | |
oc cp $1 $debug_pod:$2 | |
oc delete pod $debug_pod | |
done | |
echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment