-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add get-kubeconfig script that will wait for, then cat kubeconfig.
Useful with docker exec to get the fully formed kubeconfig
- Loading branch information
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
while [ ! -f /kubeconfig ]; do | ||
sleep 1 | ||
done | ||
|
||
if [ "$1" = "-json" ]; then | ||
cfg=$(kubectl config view -o json --merge=true --flatten=true) | ||
else | ||
cfg=$(kubectl config view -o yaml --merge=true --flatten=true) | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
hostname="localhost" | ||
else | ||
hostname="$2" | ||
fi | ||
|
||
echo "$cfg" | sed -e "s/0\.0\.0\.0/$hostname/g" |
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