Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
06aa8bd1
Commit
06aa8bd1
authored
Feb 03, 2015
by
Jeff Lowdermilk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes get-password for gce
parent
acbadc8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
util.sh
cluster/gce/util.sh
+15
-2
No files found.
cluster/gce/util.sh
View file @
06aa8bd1
...
@@ -189,13 +189,26 @@ function detect-master () {
...
@@ -189,13 +189,26 @@ function detect-master () {
}
}
# Ensure that we have a password created for validating to the master. Will
# Ensure that we have a password created for validating to the master. Will
# read from $HOME/.kubernetres_auth if available.
# read from the kubernetes auth-file for the current context if available.
#
# Assumed vars
# KUBE_ROOT
#
#
# Vars set:
# Vars set:
# KUBE_USER
# KUBE_USER
# KUBE_PASSWORD
# KUBE_PASSWORD
function
get-password
{
function
get-password
{
local
file
=
"
$HOME
/.kubernetes_auth"
local
get_auth_path
=
'''
import yaml, sys
cfg = yaml.load(sys.stdin)
try:
current = cfg["current-context"]
user = cfg["contexts"][current]["user"]
print cfg["users"][user]["auth-path"]
except KeyError:
pass
'''
local
file
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
--global
| python
-c
"
${
get_auth_path
}
"
)
if
[[
-r
"
$file
"
]]
;
then
if
[[
-r
"
$file
"
]]
;
then
KUBE_USER
=
$(
cat
"
$file
"
| python
-c
'import json,sys;print json.load(sys.stdin)["User"]'
)
KUBE_USER
=
$(
cat
"
$file
"
| python
-c
'import json,sys;print json.load(sys.stdin)["User"]'
)
KUBE_PASSWORD
=
$(
cat
"
$file
"
| python
-c
'import json,sys;print json.load(sys.stdin)["Password"]'
)
KUBE_PASSWORD
=
$(
cat
"
$file
"
| python
-c
'import json,sys;print json.load(sys.stdin)["Password"]'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment