diff --git a/USAGE.md b/USAGE.md index 5b480b8..37f8267 100644 --- a/USAGE.md +++ b/USAGE.md @@ -125,7 +125,8 @@ usage: ck creds [OPTIONS] [CONTEXT] -f Force operation if cluster is currently locked -p Extract a single property, like password or api_url - -r Refresh the credentials by fetching a fresh copy + -c Use the current credentials without fetching + -r Refresh the credentials by fetching a fresh copy (default) ``` [🔝 Back to top](#usage) diff --git a/lib/common.sh b/lib/common.sh index 030259c..c25af9c 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -182,6 +182,10 @@ function createContext { return $? fi + # Make sure cluster is running + setPowerState "$context" "Running" + ignoreOutput waitForClusterDeployment $1 "Running" + local kubeconfig kubeconfig_temp kubeconfig=$(getCredsFile "$context" "lifeguard/clusterclaims/${context}/kubeconfig" "true") verbose 0 "Preparing kubeconfig $kubeconfig" @@ -756,8 +760,7 @@ function displayCreds { function getCreds { local powerState - setPowerState $1 "Running" - ignoreOutput waitForClusterDeployment $1 "Running" + ignoreOutput waitForClusterDeployment $1 verbose 0 "Fetching credentials for ${1}" # Use lifeguard/clusterclaims/get_credentials.sh to get the credentionals for the cluster export CLUSTERCLAIM_NAME=$1 diff --git a/subcommands/creds.sh b/subcommands/creds.sh index bf14a3e..b5e9f07 100644 --- a/subcommands/creds.sh +++ b/subcommands/creds.sh @@ -16,18 +16,21 @@ function creds_usage { errEcho errEcho " -f Force operation if cluster is currently locked" errEcho " -p Extract a single property, like password or api_url" - errEcho " -r Refresh the credentials by fetching a fresh copy" + errEcho " -c Use the current credentials without fetching" + errEcho " -r Refresh the credentials by fetching a fresh copy (default)" errEcho abort } function creds { + FETCH_FRESH="true"; OPTIND=1 - while getopts :fp:r o + while getopts :fp:cr o do case "$o" in f) export FORCE="true";; p) PROPERTY="$OPTARG";; - r) FETCH_FRESH="true";; + c) FETCH_FRESH="";; + r) FETCH_FRESH="true"; verbose -1 "WARNING: -r option is deprecated and will be removed in a future release";; [?]) creds_usage;; esac done