Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
9de16f2c
Commit
9de16f2c
authored
Oct 25, 2016
by
rithu leena john
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage/kubernetes: set CurrentContext when the Kubeconfig file contains only one context
parent
6c4ad8c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
client.go
storage/kubernetes/client.go
+4
-0
No files found.
storage/kubernetes/client.go
View file @
9de16f2c
...
@@ -348,8 +348,12 @@ func inClusterConfig() (cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace
...
@@ -348,8 +348,12 @@ func inClusterConfig() (cluster k8sapi.Cluster, user k8sapi.AuthInfo, namespace
func
currentContext
(
config
*
k8sapi
.
Config
)
(
cluster
k8sapi
.
Cluster
,
user
k8sapi
.
AuthInfo
,
ns
string
,
err
error
)
{
func
currentContext
(
config
*
k8sapi
.
Config
)
(
cluster
k8sapi
.
Cluster
,
user
k8sapi
.
AuthInfo
,
ns
string
,
err
error
)
{
if
config
.
CurrentContext
==
""
{
if
config
.
CurrentContext
==
""
{
if
len
(
config
.
Contexts
)
==
1
{
config
.
CurrentContext
=
config
.
Contexts
[
0
]
.
Name
}
else
{
return
cluster
,
user
,
""
,
errors
.
New
(
"kubeconfig has no current context"
)
return
cluster
,
user
,
""
,
errors
.
New
(
"kubeconfig has no current context"
)
}
}
}
context
,
ok
:=
func
()
(
k8sapi
.
Context
,
bool
)
{
context
,
ok
:=
func
()
(
k8sapi
.
Context
,
bool
)
{
for
_
,
namedContext
:=
range
config
.
Contexts
{
for
_
,
namedContext
:=
range
config
.
Contexts
{
if
namedContext
.
Name
==
config
.
CurrentContext
{
if
namedContext
.
Name
==
config
.
CurrentContext
{
...
...
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