Java Code Examples for io.fabric8.kubernetes.client.Config#getHttpProxy()

The following examples show how to use io.fabric8.kubernetes.client.Config#getHttpProxy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpClientUtils.java    From syndesis with Apache License 2.0 6 votes vote down vote up
private static URL getProxyUrl(Config config) throws MalformedURLException {
    URL master = new URL(config.getMasterUrl());
    String host = master.getHost();
    if (config.getNoProxy() != null) {
        for (String noProxy : config.getNoProxy()) {
            if (isIpAddress(noProxy)) {
                if (new IpAddressMatcher(noProxy).matches(host)) {
                    return null;
                }
            } else {
                if (host.contains(noProxy)) {
                    return null;
                }
            }
        }
    }
    String proxy = config.getHttpsProxy();
    if (master.getProtocol().equals("http")) {
        proxy = config.getHttpProxy();
    }
    if (proxy != null) {
        return new URL(proxy);
    }
    return null;
}
 
Example 2
Source File: HttpClientUtils.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
private static URL getProxyUrl(Config config) throws MalformedURLException {
    URL master = new URL(config.getMasterUrl());
    String host = master.getHost();
    if (config.getNoProxy() != null) {
     for (String noProxy : config.getNoProxy()) {
        if (isIpAddress(noProxy)) {
          if (new IpAddressMatcher(noProxy).matches(host)) {
            return null;
          }
        } else {
          if (host.contains(noProxy)) {
            return null;
          }
        }
     }
    }
    String proxy = config.getHttpsProxy();
    if (master.getProtocol().equals("http")) {
        proxy = config.getHttpProxy();
    }
    if (proxy != null) {
        return new URL(proxy);
    }
    return null;
}
 
Example 3
Source File: OpenShiftConfig.java    From kubernetes-client with Apache License 2.0 5 votes vote down vote up
public OpenShiftConfig(Config kubernetesConfig, String openShiftUrl, String oapiVersion, long buildTimeout) {
  this(openShiftUrl, oapiVersion, kubernetesConfig.getMasterUrl(), kubernetesConfig.getApiVersion(), kubernetesConfig.getNamespace(), kubernetesConfig.isTrustCerts(), kubernetesConfig.isDisableHostnameVerification(),
    kubernetesConfig.getCaCertFile(), kubernetesConfig.getCaCertData(),
    kubernetesConfig.getClientCertFile(), kubernetesConfig.getClientCertData(),
    kubernetesConfig.getClientKeyFile(), kubernetesConfig.getClientKeyData(),
    kubernetesConfig.getClientKeyAlgo(), kubernetesConfig.getClientKeyPassphrase(),
    kubernetesConfig.getUsername(), kubernetesConfig.getPassword(), kubernetesConfig.getOauthToken(),
    kubernetesConfig.getWatchReconnectInterval(), kubernetesConfig.getWatchReconnectLimit(),
    kubernetesConfig.getConnectionTimeout(), kubernetesConfig.getRequestTimeout(),
    kubernetesConfig.getRollingTimeout(), kubernetesConfig.getScaleTimeout(),
    kubernetesConfig.getLoggingInterval(),
    kubernetesConfig.getMaxConcurrentRequestsPerHost(),
    kubernetesConfig.getHttpProxy(),
    kubernetesConfig.getHttpsProxy(),
    kubernetesConfig.getNoProxy(),
    kubernetesConfig.getErrorMessages(),
    kubernetesConfig.getUserAgent(),
    kubernetesConfig.getTlsVersions(),
    buildTimeout,
    kubernetesConfig.getWebsocketTimeout(),
    kubernetesConfig.getWebsocketPingInterval(),
    kubernetesConfig.getProxyUsername(),
    kubernetesConfig.getProxyPassword(),
    kubernetesConfig.getTrustStoreFile(),
    kubernetesConfig.getTrustStorePassphrase(),
    kubernetesConfig.getKeyStoreFile(),
    kubernetesConfig.getKeyStorePassphrase(),
    kubernetesConfig.getImpersonateUsername(),
    kubernetesConfig.getImpersonateGroups(),
    kubernetesConfig.getImpersonateExtras(),
    false,
    false
    );
}