Skip to content

Commit 455a389

Browse files
author
Lars Wander
committed
Allow kubeconfig to be loaded without current-context
1 parent 757ab61 commit 455a389

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

Lines changed: 7 additions & 0 deletions
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)