@Override public void connectionChanged( IConnection connection, String property, Object oldValue, Object newValue) { if (pod != null) { // we're done already return; } if (dcSelector == null) { if (deploymentConfig.equals(oldValue) && newValue instanceof IDeploymentConfig) { deploymentConfig = (IDeploymentConfig) newValue; dcSelector = deploymentConfig.getReplicaSelector(); } return; } // Wait for new pod once deployment is done if (newValue instanceof IPod) { IPod candidate = (IPod) newValue; String podName = candidate.getName(); if (!oldPods.contains(podName) && "Running".equals(candidate.getStatus()) && ResourceUtils.containsAll(dcSelector, candidate.getLabels())) { pod = candidate; } } }
@Override protected String buildArgs() { StringBuilder args = new StringBuilder(); args.append("port-forward "); addSkipTlsVerify(args); addServer(args); addToken(args) .append("-n ") .append(pod.getNamespace()) .append(" ") .append("-p ") .append(pod.getName()) .append(" "); for (PortPair pair : pairs) { args.append(pair.getLocalPort()).append(":").append(pair.getRemotePort()).append(" "); } return args.toString(); }