Created
June 15, 2022 10:57
-
-
Save afbjorklund/334ff06cc38093f1bb6fc97446b14ed4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/sh | |
# Wrapper for using kubectl as "ssh", for rsync and git | |
# - setting either $RSYNC_RSH or $GIT_SSH env variables | |
namespace='' | |
pod=$1 | |
shift | |
# POD[@NAMESPACE]:DEST | |
if [ "X$pod" = "X-l" ]; then | |
pod=$1 | |
shift | |
namespace="-n $1" | |
shift | |
fi | |
if [ "$1" = "rsync" ]; then | |
exec kubectl $namespace exec -i $pod -- "$@" | |
else # git-receive-pack '*' | |
exec kubectl $namespace exec -i $pod -- /bin/sh -c "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment