Source:
<code>public KubernetesClient createClient() throws IOException { ConfigBuilder builder; if (auth instanceof KubernetesAuthKubeconfig) { builder = new ConfigBuilder( Config.fromKubeconfig( ((KubernetesAuthKubeconfig) auth).getKubeconfig() ) ); } else { if (StringUtils.isBlank(serviceAddress)) { LOGGER.log(FINE, "Autoconfiguring Kubernetes client"); builder = new ConfigBuilder(Config.autoConfigure(null)); } else { builder = new ConfigBuilder().withMasterUrl(serviceAddress); } } <START> if (auth instanceof KubernetesAuthToken) { <END> builder.withOauthToken(((KubernetesAuthToken) auth).getToken()); } else if (auth instanceof KubernetesAuthUsernamePassword) { KubernetesAuthUsernamePassword usernamePassword = (KubernetesAuthUsernamePassword) auth; builder.withUsername(usernamePassword.getUsername()).withPassword(usernamePassword.getPassword()); } else if (auth instanceof KubernetesAuthCertificate) { KubernetesAuthCertificate certData = (KubernetesAuthCertificate) auth; builder.withClientCertData(certData.getCertificate()); builder.withClientKeyData(certData.getKey()); String password = certData.getKeyPassword(); if (password != null) { builder.withClientKeyPassphrase(password); } } if (skipTlsVerify) { builder.withTrustCerts(true); } if (caCertData != null) { builder.withCaCertData(Base64.encodeBase64String(caCertData.getBytes(UTF_8))); } builder = builder.withRequestTimeout(readTimeout * 1000).withConnectionTimeout(connectTimeout * 1000); builder.withMaxConcurrentRequestsPerHost(maxRequestsPerHost); if (!StringUtils.isBlank(namespace)) { builder.withNamespace(namespace); } else if (StringUtils.isBlank(builder.getNamespace())) { builder.withNamespace("default"); } LOGGER.log(FINE, "Creating Kubernetes client: {0}", this.toString()); return new DefaultKubernetesClient(builder.build()); }</code><technical_language>implemented in KubernetesAuth implementations a method public void decorate(ConfigBuilder builder). require pushing kubernetes-client dependency kubernetes-credentials, kubernetes-model part of it. mentioned in another thread (<LINK_0> valuable extract library plugin anyway</technical_language>

Target:
public KubernetesClient createClient() throws KubernetesAuthException { ConfigBuilder builder; if (StringUtils.isBlank(serviceAddress)) { LOGGER.log(FINE, "Autoconfiguring Kubernetes client"); builder = new ConfigBuilder(Config.autoConfigure(null)); } else { builder = new ConfigBuilder().withMasterUrl(serviceAddress); } if (auth != null) { builder = auth.decorate(builder, new KubernetesAuthConfig(builder.getMasterUrl(), caCertData, skipTlsVerify)); } if (skipTlsVerify) { builder.withTrustCerts(true); } if (caCertData != null) { builder.withCaCertData(Base64.encodeBase64String(caCertData.getBytes(UTF_8))); } builder = builder.withRequestTimeout(readTimeout * 1000).withConnectionTimeout(connectTimeout * 1000); builder.withMaxConcurrentRequestsPerHost(maxRequestsPerHost); if (!StringUtils.isBlank(namespace)) { builder.withNamespace(namespace); } else if (StringUtils.isBlank(builder.getNamespace())) { builder.withNamespace("default"); } LOGGER.log(FINE, "Creating Kubernetes client: {0}", this.toString()); return new DefaultKubernetesClient(builder.build()); }