static URI proxyServiceEndpoint(Proxy proxy, String namespace, String serviceName, int servicePort) { try { return new URIBuilder().setPort(proxy.getPort()) .setHost("localhost") .setScheme("http") .setPath("/api/v1/namespaces/" + namespace + "/services/" + serviceName + ":" + servicePort + "/proxy") .build(); } catch (URISyntaxException e) { throw new HalException(Severity.FATAL, "Malformed service details: " + e.getMessage()); } }
static Proxy openProxy(JobExecutor jobExecutor, AccountDeploymentDetails<KubernetesAccount> details) { KubernetesAccount account = details.getAccount(); Proxy proxy = proxyMap.getOrDefault(Proxy.buildKey(details.getDeploymentName()), new Proxy()); String jobId = proxy.jobId; if (StringUtils.isEmpty(jobId) || !jobExecutor.jobExists(jobId)) { Matcher matcher = portPattern.matcher(connectionMessage); if (matcher.find()) { proxy.setPort(Integer.valueOf(matcher.group(1))); proxyMap.put(Proxy.buildKey(details.getDeploymentName()), proxy); DaemonTaskHandler.message("Connected to kubernetes cluster for account " + account.getName() + " on port " + proxy.getPort()); DaemonTaskHandler.message("View the kube ui on http://localhost:" + proxy.getPort() + "/ui/"); } else { throw new HalException(Severity.FATAL,
static Proxy openProxy(JobExecutor jobExecutor, AccountDeploymentDetails<KubernetesAccount> details) { KubernetesAccount account = details.getAccount(); Proxy proxy = proxyMap.getOrDefault(Proxy.buildKey(details.getDeploymentName()), new Proxy()); String jobId = proxy.jobId; if (StringUtils.isEmpty(jobId) || !jobExecutor.jobExists(jobId)) { Matcher matcher = portPattern.matcher(connectionMessage); if (matcher.find()) { proxy.setPort(Integer.valueOf(matcher.group(1))); proxyMap.put(Proxy.buildKey(details.getDeploymentName()), proxy); DaemonTaskHandler.message("Connected to kubernetes cluster for account " + account.getName() + " on port " + proxy.getPort()); DaemonTaskHandler.message("View the kube ui on http://localhost:" + proxy.getPort() + "/ui/"); } else { throw new HalException(Severity.FATAL,
static URI proxyServiceEndpoint(Proxy proxy, String namespace, String serviceName, int servicePort) { try { return new URIBuilder().setPort(proxy.getPort()) .setHost("localhost") .setScheme("http") .setPath("/api/v1/namespaces/" + namespace + "/services/" + serviceName + ":" + servicePort + "/proxy") .build(); } catch (URISyntaxException e) { throw new HalException(Severity.FATAL, "Malformed service details: " + e.getMessage()); } }