Created
June 10, 2020 19:02
-
-
Save billglover/b1b47a458673ceebd0e1d95bcb33ad11 to your computer and use it in GitHub Desktop.
Set the KUBECONFIG envar with all YAML files in the specified folder.
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 | |
DEFAULT_CONTEXTS="$HOME/.kube/config" | |
if test -f "${DEFAULT_CONTEXTS}" | |
then | |
export KUBECONFIG="$DEFAULT_CONTEXTS" | |
fi | |
CUSTOM_CONTEXTS="$HOME/.kube/custom-contexts" | |
mkdir -p "${CUSTOM_CONTEXTS}" | |
OIFS="$IFS" | |
IFS=$'\n' | |
for file in `find "${CUSTOM_CONTEXTS}" -type f -name "*.yml" -or -name "*.yaml"` | |
do | |
export KUBECONFIG="$file:$KUBECONFIG" | |
done | |
IFS="$OIFS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment