use of com.netflix.spinnaker.halyard.core.tasks.v1.DaemonTaskInterrupted in project halyard by spinnaker.
the class GoogleDistributedService method sshTunnelIntoService.
default <S> URI sshTunnelIntoService(AccountDeploymentDetails<GoogleAccount> details, SpinnakerRuntimeSettings runtimeSettings, SpinnakerService<S> sidecar) {
ServiceSettings settings = runtimeSettings.getServiceSettings(sidecar);
RunningServiceDetails runningServiceDetails = getRunningServiceDetails(details, runtimeSettings);
Integer enabledVersion = runningServiceDetails.getLatestEnabledVersion();
if (enabledVersion == null) {
throw new HalException(FATAL, "Cannot connect to " + getServiceName() + " when no server groups have been deployed yet");
}
List<RunningServiceDetails.Instance> instances = runningServiceDetails.getInstances().get(enabledVersion);
if (instances == null || instances.isEmpty()) {
throw new HalException(FATAL, "Cannot connect to " + getServiceName() + " when no instances have been deployed yet");
}
try {
return GoogleProviderUtils.openSshTunnel(details, instances.get(0).getId(), settings);
} catch (InterruptedException e) {
throw new DaemonTaskInterrupted(e);
}
}
use of com.netflix.spinnaker.halyard.core.tasks.v1.DaemonTaskInterrupted in project halyard by spinnaker.
the class KubernetesAccountValidator method ensureKubectlExists.
public void ensureKubectlExists(ConfigProblemSetBuilder p) {
JobExecutor jobExecutor = DaemonTaskHandler.getJobExecutor();
JobRequest request = new JobRequest().setTokenizedCommand(Collections.singletonList("kubectl")).setTimeoutMillis(TimeUnit.SECONDS.toMillis(10));
JobStatus status;
try {
status = jobExecutor.backoffWait(jobExecutor.startJob(request));
} catch (InterruptedException e) {
throw new DaemonTaskInterrupted(e);
}
if (status.getResult() != JobStatus.Result.SUCCESS) {
p.addProblem(FATAL, String.join(" ", "`kubectl` not installed, or can't be found by Halyard. It is needed for", "opening connections to your Kubernetes cluster to send commands to the Spinnaker deployment running there.")).setRemediation(String.join(" ", "Visit https://kubernetes.io/docs/tasks/kubectl/install/.", "If you've already installed kubectl via gcloud, it's possible updates to your $PATH aren't visible to Halyard."));
}
}
Aggregations