protected RemoteApiDockerAdapterCommandExecutorImpl(ServiceHost host, TrustManager trustManager) { this.host = host; this.serviceClient = ServiceClientFactory.createServiceClient(trustManager, keyManager); this.attachServiceClient = ServiceClientFactory.createServiceClient(trustManager, keyManager); this.largeDataClient = ServiceClientFactory.createServiceClient( trustManager, keyManager, DOCKER_REQUEST_PAYLOAD_SIZE_LIMIT); if (trustManager instanceof ServerX509TrustManager) { this.trustManager = (ServerX509TrustManager) trustManager; } }
protected KubernetesRemoteApiClient(ServiceHost host, final TrustManager trustManager) { this.host = host; this.serviceClient = ServiceClientFactory.createServiceClient(trustManager, keyManager); if (trustManager instanceof ServerX509TrustManager) { this.trustManager = (ServerX509TrustManager) trustManager; } }
/** * Create a ServiceClient instance using the given SSLContext * * @param sslContext * @return */ public static ServiceClient createServiceClient(SSLContext sslContext) { return createServiceClient(sslContext, 0); }
public PKSRemoteClientService(TrustManager trustManager, ServiceHost host) { if (INSTANCE != null) { throw new IllegalStateException("PKS client has been already instantiated"); } this.serviceClient = ServiceClientFactory.createServiceClient(trustManager, keyManager); if (trustManager instanceof ServerX509TrustManager) { this.trustManager = (ServerX509TrustManager) trustManager; } this.host = host; INSTANCE = this; }
/** * Create a ServiceClient instance using the given TrustManager and KeyManager * * @param trustManager * @param keyManager * @return */ public static ServiceClient createServiceClient(TrustManager trustManager, KeyManager keyManager) { return createServiceClient(CertificateUtil.createSSLContext( trustManager, keyManager)); }
/** * Create a ServiceClient instance using the given TrustManager, KeyManager and requestPayloadSizeLimit * * @param trustManager * @param keyManager * @param requestPayloadSizeLimit * @return */ public static ServiceClient createServiceClient(TrustManager trustManager, KeyManager keyManager, int requestPayloadSizeLimit) { return createServiceClient(CertificateUtil.createSSLContext( trustManager, keyManager), requestPayloadSizeLimit); }
private void initNoProxyClient(Map<String, String> props) { // create plain, no proxied client serviceClientNoProxy = ServiceClientFactory.createServiceClient(trustManager, null); if (props != null) { String registryProxyAddress = props.get(REGISTRY_PROXY_PARAM_NAME); String registryNoProxiedHosts = props.get(REGISTRY_NO_PROXY_LIST_PARAM_NAME); if (registryNoProxiedHosts != null && !registryNoProxiedHosts.equals(REGISTRY_PROXY_NULL_VALUE) && registryProxyAddress != null && !registryProxyAddress.equals(REGISTRY_PROXY_NULL_VALUE)) { logInfo("Setting non-proxied registry hosts: %s", registryNoProxiedHosts); serviceClientNoProxyList.addAll( Arrays.asList(registryNoProxiedHosts.split("\\s*,\\s*"))); } } }
private void initProxyClient(Map<String, String> props) { String registryProxyAddress = null; if (props != null) { registryProxyAddress = props.get(REGISTRY_PROXY_PARAM_NAME); } if (registryProxyAddress != null && !registryProxyAddress.equals(REGISTRY_PROXY_NULL_VALUE)) { try { URI registryProxyURI = new URI(registryProxyAddress); serviceClientProxy = ServiceClientFactory.createServiceClient(trustManager, null); if (serviceClientProxy instanceof NettyHttpServiceClient) { ((NettyHttpServiceClient) serviceClientProxy).setHttpProxy(registryProxyURI); logInfo("Setting registry hosts proxy to: %s", registryProxyAddress); } else { logSevere("Cannot set proxy for accessing registries. Expecting " + "NettyHttpServiceClient, actual: %s", serviceClientProxy.getClass().getSimpleName()); serviceClientProxy = null; } } catch (Exception e) { logSevere("Registry proxy URI invalid syntax: %s. Error: %s", e.getMessage(), Utils.toString(e)); serviceClientProxy = null; } } }
@Override public void handleStart(Operation startOp) { startOp.complete(); getConfigProperty(Harbor.CONFIGURATION_USER_PROPERTY_NAME, (state) -> harborUser = state.value); getConfigProperty(Harbor.CONFIGURATION_PASS_PROPERTY_NAME, (state) -> harborPassword = state.value); getConfigProperty(Harbor.CONFIGURATION_URL_PROPERTY_NAME, (state) -> { String harborUrl = state.value; logInfo("Harbor url is %s", harborUrl); if (harborUrl != null && !harborUrl.trim().isEmpty()) { ServerX509TrustManager trustManager = ServerX509TrustManager.create(getHost()); client = ServiceClientFactory.createServiceClient(trustManager, null); harborUri = UriUtils.buildUri(harborUrl); } }); }
ServerX509TrustManager trustM = ServerX509TrustManager.create(host); createOrUpdateTargetSsl(input, keyM, trustM); ServiceClient serviceClientPing = ServiceClientFactory.createServiceClient(trustM, keyM);