Allow init.sh and protoc.sh to be sourced idempotently

This commit is contained in:
Jordan Liggitt
2023-01-23 09:12:41 -05:00
parent 3548e7febe
commit d49d988467
2 changed files with 16 additions and 0 deletions

View File

@@ -18,6 +18,9 @@ set -o errexit
set -o nounset
set -o pipefail
# Short-circuit if init.sh has already been sourced
[[ $(type -t kube::init::loaded) == function ]] && return 0
# Unset CDPATH so that path interpolation can work correctly
# https://github.com/kubernetes/kubernetes/issues/52255
unset CDPATH
@@ -211,3 +214,8 @@ kube::realpath() {
fi
kube::readlinkdashf "${1}"
}
# Marker function to indicate init.sh has been fully sourced
kube::init::loaded() {
return 0
}