Skip to content

Commit 60a8cd1

Browse files
authoredSep 29, 2017
Merge pull request #81 from lwander/allow-kubeconfig-load-wo-context
Allow kubeconfig to be loaded without current-context
2 parents 757ab61 + 455a389 commit 60a8cd1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎util/src/main/java/io/kubernetes/client/util/KubeConfig.java

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ public KubeConfig(ArrayList<Object> contexts,
9696
}
9797

9898
public boolean setContext(String context) {
99+
if (context == null) {
100+
return false;
101+
}
102+
99103
currentCluster = null;
100104
currentUser = null;
101105
Map<String, Object> ctx = findObject(contexts, context);
@@ -197,6 +201,9 @@ public String getAccessToken() {
197201
}
198202

199203
public boolean verifySSL() {
204+
if (currentCluster == null) {
205+
return false;
206+
}
200207
if (currentCluster.containsKey("insecure-skip-tls-verify")) {
201208
return ! ((Boolean) currentCluster.get("insecure-skip-tls-verify")).booleanValue();
202209
}

0 commit comments

Comments
 (0)