Add proxy properties for the Kubernetes client configuration (#273)

Fixes: #105
This commit is contained in:
Georgios Andrianakis
2018-11-22 12:59:28 +02:00
committed by GitHub
parent a3d430390f
commit 601357e030
2 changed files with 60 additions and 1 deletions

View File

@@ -23,7 +23,6 @@ import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -87,6 +86,16 @@ public class KubernetesAutoConfiguration {
base.getRollingTimeout()))
.withTrustCerts(or(kubernetesClientProperties.isTrustCerts(),
base.isTrustCerts()))
.withHttpProxy(or(kubernetesClientProperties.getHttpProxy(),
base.getHttpProxy()))
.withHttpsProxy(or(kubernetesClientProperties.getHttpsProxy(),
base.getHttpsProxy()))
.withProxyUsername(or(kubernetesClientProperties.getProxyUsername(),
base.getProxyUsername()))
.withPassword(or(kubernetesClientProperties.getProxyPassword(),
base.getProxyPassword()))
.withNoProxy(or(kubernetesClientProperties.getNoProxy(),
base.getNoProxy()))
.build();
if (properties.getNamespace() == null || properties.getNamespace().isEmpty()) {

View File

@@ -17,6 +17,7 @@
package org.springframework.cloud.kubernetes;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("spring.cloud.kubernetes.client")
@@ -42,6 +43,11 @@ public class KubernetesClientProperties {
private Integer requestTimeout;
private Long rollingTimeout;
private Integer loggingInterval;
private String httpProxy;
private String httpsProxy;
private String proxyUsername;
private String proxyPassword;
private String[] noProxy;
public String getClientCertData() {
return clientCertData;
@@ -202,4 +208,48 @@ public class KubernetesClientProperties {
public void setLoggingInterval(Integer loggingInterval) {
this.loggingInterval = loggingInterval;
}
public Boolean getTrustCerts() {
return trustCerts;
}
public String getHttpProxy() {
return httpProxy;
}
public void setHttpProxy(String httpProxy) {
this.httpProxy = httpProxy;
}
public String getHttpsProxy() {
return httpsProxy;
}
public void setHttpsProxy(String httpsProxy) {
this.httpsProxy = httpsProxy;
}
public String getProxyUsername() {
return proxyUsername;
}
public void setProxyUsername(String proxyUsername) {
this.proxyUsername = proxyUsername;
}
public String getProxyPassword() {
return proxyPassword;
}
public void setProxyPassword(String proxyPassword) {
this.proxyPassword = proxyPassword;
}
public String[] getNoProxy() {
return noProxy;
}
public void setNoProxy(String[] noProxy) {
this.noProxy = noProxy;
}
}