public <S> KubernetesV2Service getService(SpinnakerService.Type type, Class<S> clazz) { Field serviceField = getField(type.getCanonicalName() + "service"); if (serviceField == null) { return null; } serviceField.setAccessible(true); try { return (KubernetesV2Service) serviceField.get(this); } catch (IllegalAccessException e) { throw new HalException(Problem.Severity.FATAL, "Can't access service field for " + type + ": " + e.getMessage()); } finally { serviceField.setAccessible(false); } }}
public KubernetesV2Service getService(SpinnakerService.Type type) { return getService(type, Object.class); }
List<SpinnakerService.Type> serviceTypes) { List<KubernetesV2Service> services = serviceProvider.getServicesByPriority(serviceTypes); services.stream().forEach((service) -> { if (service instanceof SidecarService) {
public List<KubernetesV2Service> getServicesByPriority(List<SpinnakerService.Type> serviceTypes) { List<KubernetesV2Service> result = getFieldsOfType(KubernetesV2Service.class).stream() .filter(d -> serviceTypes.contains(d.getService().getType())) .sorted((d1, d2) -> d2.getDeployPriority().compareTo(d1.getDeployPriority())) .collect(Collectors.toList()); return result; }
GenerateService.ResolvedConfiguration resolvedConfiguration, List<SpinnakerService.Type> serviceTypes) { List<KubernetesV2Service> services = serviceProvider.getServicesByPriority(serviceTypes); services.stream().forEach((service) -> { if (service instanceof SidecarService) {
public List<KubernetesV2Service> getServicesByPriority(List<SpinnakerService.Type> serviceTypes) { List<KubernetesV2Service> result = getFieldsOfType(KubernetesV2Service.class).stream() .filter(d -> serviceTypes.contains(d.getService().getType())) .sorted((d1, d2) -> d2.getDeployPriority().compareTo(d1.getDeployPriority())) .collect(Collectors.toList()); return result; }
public KubernetesV2Service getService(SpinnakerService.Type type) { return getService(type, Object.class); }
List<SpinnakerService.Type> serviceTypes, boolean waitForCompletion) { List<KubernetesV2Service> services = serviceProvider.getServicesByPriority(serviceTypes); services.stream().forEach((service) -> { if (service instanceof SidecarService) {
public <S> KubernetesV2Service getService(SpinnakerService.Type type, Class<S> clazz) { Field serviceField = getField(type.getCanonicalName() + "service"); if (serviceField == null) { return null; } serviceField.setAccessible(true); try { return (KubernetesV2Service) serviceField.get(this); } catch (IllegalAccessException e) { throw new HalException(Problem.Severity.FATAL, "Can't access service field for " + type + ": " + e.getMessage()); } finally { serviceField.setAccessible(false); } }}
@Override public RemoteAction connectCommand(KubectlServiceProvider serviceProvider, AccountDeploymentDetails<KubernetesAccount> deploymentDetails, SpinnakerRuntimeSettings runtimeSettings, List<SpinnakerService.Type> serviceTypes) { RemoteAction result = new RemoteAction(); String connectCommands = String.join(" &\n", serviceTypes.stream() .map(t -> serviceProvider.getService(t) .connectCommand(deploymentDetails, runtimeSettings)) .collect(Collectors.toList())); result.setScript("#!/bin/bash\n" + connectCommands); result.setScriptDescription( "The generated script will open connections to the API & UI servers using ssh tunnels"); result.setAutoRun(false); return result; }
@Override public RemoteAction connectCommand(KubectlServiceProvider serviceProvider, AccountDeploymentDetails<KubernetesAccount> deploymentDetails, SpinnakerRuntimeSettings runtimeSettings, List<SpinnakerService.Type> serviceTypes) { RemoteAction result = new RemoteAction(); String connectCommands = String.join(" &\n", serviceTypes.stream() .map(t -> serviceProvider.getService(t) .connectCommand(deploymentDetails, runtimeSettings)) .collect(Collectors.toList())); result.setScript("#!/bin/bash\n" + connectCommands); result.setScriptDescription( "The generated script will open connections to the API & UI servers using ssh tunnels"); result.setAutoRun(false); return result; }