mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Update util.sh
This commit is contained in:
parent
549504dfff
commit
c348b30f62
@ -199,7 +199,7 @@ function detect-master () {
|
||||
# KUBE_PASSWORD
|
||||
function get-password {
|
||||
# go template to extract the auth-path of the current-context user
|
||||
local template='{{with $ctx := index . "current-context"}}{{$user := index . "contexts" $ctx "user"}}{{index . "users" $user "auth-path"}}{{end}'
|
||||
local template='{{with $ctx := index . "current-context"}}{{$user := index . "contexts" $ctx "user"}}{{index . "users" $user "auth-path"}}{{end}}'
|
||||
local file=$("${KUBE_ROOT}/cluster/kubectl.sh" config view -o template --template="${template}")
|
||||
if [[ ! -z "$file" && -r "$file" ]]; then
|
||||
KUBE_USER=$(cat "$file" | python -c 'import json,sys;print json.load(sys.stdin)["User"]')
|
||||
|
Loading…
Reference in New Issue
Block a user