Skip to content

Commit

Permalink
Do not wake cluster to get creds (#39)
Browse files Browse the repository at this point in the history
Get fresh creds by default
  • Loading branch information
KevinFCormier authored Apr 23, 2021
1 parent ef32ba7 commit 5c1cddc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
<sup><sub>[🔝 Back to top](#usage)</sub></sup>

Expand Down
7 changes: 5 additions & 2 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions subcommands/creds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c1cddc

Please sign in to comment.