Skip to content

Commit

Permalink
Add proxy properties for the Kubernetes client configuration (#273)
Browse files Browse the repository at this point in the history
Fixes: #105
  • Loading branch information
geoand committed Nov 22, 2018
1 parent a3d4303 commit 601357e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;
Expand Down Expand Up @@ -87,6 +86,16 @@ public Config kubernetesClientConfig(
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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;
Expand Down Expand Up @@ -202,4 +208,48 @@ public Integer getLoggingInterval() {
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;
}
}

0 comments on commit 601357e

Please sign in to comment.