Skip to content

Commit c2d6b2c

Browse files
committed
Only disable autoconfiguration if auth is also set
1 parent f6f672e commit c2d6b2c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesFactoryAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ public KubernetesClient createClient() throws KubernetesAuthException {
107107
LOGGER.log(FINE, "Autoconfiguring Kubernetes client");
108108
builder = new ConfigBuilder(Config.autoConfigure(null));
109109
} else {
110-
// Using Config.empty() disables autoconfiguration
111-
builder = new ConfigBuilder(Config.empty()).withMasterUrl(serviceAddress);
110+
// Using Config.empty() disables autoconfiguration when both serviceAddress and auth are set
111+
builder = auth == null ? new ConfigBuilder() : new ConfigBuilder(Config.empty());
112+
builder = builder.withMasterUrl(serviceAddress);
112113
}
113114

114115
if (auth != null) {

0 commit comments

Comments
 (0)