public boolean serviceIsEnabled(Type type) { return services.containsKey(type) && services.get(type).getEnabled(); } }
public boolean serviceIsEnabled(Type type) { return services.containsKey(type) && services.get(type).getEnabled(); }
@Override public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { List<Profile> result = new ArrayList<>(); for (Map.Entry<Type, ServiceSettings> entry : endpoints.getAllServiceSettings().entrySet()) { ServiceSettings settings = entry.getValue(); Type type = entry.getKey(); if (!settings.getSidecar() && settings.getEnabled()) { String serviceName = type.getCanonicalName(); String profileName = consulClientService(serviceName); String profilePath = Paths.get(CLIENT_OUTPUT_PATH, serviceName + ".json").toString(); ProfileFactory factory = consulServiceProfileFactoryBuilder.build(type, settings); result.add(factory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); } } String profileName = clientProfileName; String profilePath = Paths.get(CLIENT_OUTPUT_PATH, profileName.split("/")[1]).toString(); result.add(consulClientProfileFactory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); return result; }
@Override public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { List<Profile> result = new ArrayList<>(); for (Map.Entry<Type, ServiceSettings> entry : endpoints.getAllServiceSettings().entrySet()) { ServiceSettings settings = entry.getValue(); Type type = entry.getKey(); if (!settings.getSidecar() && settings.getEnabled()) { String serviceName = type.getCanonicalName(); String profileName = consulClientService(serviceName); String profilePath = Paths.get(CLIENT_OUTPUT_PATH, serviceName + ".json").toString(); ProfileFactory factory = consulServiceProfileFactoryBuilder.build(type, settings); result.add(factory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); } } String profileName = clientProfileName; String profilePath = Paths.get(CLIENT_OUTPUT_PATH, profileName.split("/")[1]).toString(); result.add(consulClientProfileFactory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); return result; }
@Override public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { List<Profile> results = new ArrayList<>(); for (Map.Entry<Type, ServiceSettings> entry : endpoints.getAllServiceSettings().entrySet()) { ServiceSettings settings = entry.getValue(); if (settings.getMonitored() && settings.getEnabled()) { String serviceName = entry.getKey().getCanonicalName(); String profileName = serviceRegistryProfileName(serviceName); String profilePath = Paths.get(REGISTRY_OUTPUT_PATH, serviceName + ".yml").toString(); ProfileFactory factory = metricRegistryProfileFactoryBuilder.build(settings); results.add(factory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); } } String profileName = monitoringProfileName(); String profilePath = Paths.get(CONFIG_OUTPUT_PATH, profileName).toString(); results.add(spinnakerMonitoringDaemonProfileFactory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); return results; }
@Override public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { List<Profile> results = new ArrayList<>(); for (Map.Entry<Type, ServiceSettings> entry : endpoints.getAllServiceSettings().entrySet()) { ServiceSettings settings = entry.getValue(); if (settings.getMonitored() && settings.getEnabled()) { String serviceName = entry.getKey().getCanonicalName(); String profileName = serviceRegistryProfileName(serviceName); String profilePath = Paths.get(REGISTRY_OUTPUT_PATH, serviceName + ".yml").toString(); ProfileFactory factory = metricRegistryProfileFactoryBuilder.build(settings); results.add(factory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); } } String profileName = monitoringProfileName(); String profilePath = Paths.get(CONFIG_OUTPUT_PATH, profileName).toString(); results.add(spinnakerMonitoringDaemonProfileFactory.getProfile(profileName, profilePath, deploymentConfiguration, endpoints)); return results; }
@Override public RemoteAction clean(DeploymentDetails details, SpinnakerRuntimeSettings runtimeSettings) { String uninstallArtifacts = String.join("\n", getServices() .stream() .filter(s -> s != null && runtimeSettings.getServiceSettings(s).getEnabled()) .map(s -> ((LocalDebianService) s).uninstallArtifactCommand()) .collect(Collectors.toList())); Map<String, Object> bindings = new HashMap<>(); TemplatedResource resource = new StringReplaceJarResource("/debian/uninstall.sh"); bindings.put("uninstall-artifacts", uninstallArtifacts); return new RemoteAction().setScript(resource.setBindings(bindings).toString()) .setAutoRun(true) .setScriptDescription("This script apt-get purges all spinnaker components & deletes their config"); } }
@Override public String getInstallCommand(DeploymentDetails deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, Map<String, String> installCommands, String startupCommand) { Map<String, Object> bindings = new HashMap<>(); List<SpinnakerService.Type> serviceTypes = new ArrayList<>(installCommands.keySet()).stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList()); List<String> upstartNames = getPrioritizedBakeableServices(serviceTypes) .stream() .filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()) .map(i -> ((BakeDebianService) i).getUpstartServiceName()) .filter(Objects::nonNull) .collect(Collectors.toList()); List<String> systemdServiceConfigs = upstartNames.stream() .map(n -> n + ".service") .collect(Collectors.toList()); List<String> serviceInstalls = serviceTypes.stream() .map(t -> installCommands.get(t.getCanonicalName())) .collect(Collectors.toList()); TemplatedResource resource = new StringReplaceJarResource("/debian/init.sh"); bindings.put("services", Strings.join(upstartNames, " ")); bindings.put("systemd-service-configs", Strings.join(systemdServiceConfigs, " ")); String upstartInit = resource.setBindings(bindings).toString(); BillOfMaterials.ArtifactSources artifactSources = artifactService.getArtifactSources(deploymentDetails.getDeploymentName()); resource = new StringReplaceJarResource("/debian/pre-bake.sh"); bindings = new HashMap<>(); bindings.put("debian-repository", artifactSourcesConfig.mergeWithBomSources(artifactSources).getDebianRepository()); bindings.put("install-commands", String.join("\n", serviceInstalls)); bindings.put("upstart-init", upstartInit); bindings.put("startup-file", Paths.get(startupScriptPath, "startup.sh").toString()); bindings.put("startup-command", startupCommand); return resource.setBindings(bindings).toString(); }
@Override public RemoteAction clean(DeploymentDetails details, SpinnakerRuntimeSettings runtimeSettings) { String uninstallArtifacts = String.join("\n", getServices() .stream() .filter(s -> s != null && runtimeSettings.getServiceSettings(s).getEnabled()) .map(s -> ((LocalDebianService) s).uninstallArtifactCommand()) .collect(Collectors.toList())); Map<String, Object> bindings = new HashMap<>(); TemplatedResource resource = new StringReplaceJarResource("/debian/uninstall.sh"); bindings.put("uninstall-artifacts", uninstallArtifacts); return new RemoteAction().setScript(resource.setBindings(bindings).toString()) .setAutoRun(true) .setScriptDescription("This script apt-get purges all spinnaker components & deletes their config"); } }
default List<SidecarService> getSidecars(SpinnakerRuntimeSettings runtimeSettings) { SpinnakerMonitoringDaemonService monitoringService = getMonitoringDaemonService(); ServiceSettings monitoringSettings = runtimeSettings.getServiceSettings(monitoringService); ServiceSettings thisSettings = runtimeSettings.getServiceSettings(getService()); List<SidecarService> result = new ArrayList<>(); if (monitoringSettings.getEnabled() && thisSettings.getMonitored()) { result.add(monitoringService); } return result; }
default List<SidecarService> getSidecars(SpinnakerRuntimeSettings runtimeSettings) { SpinnakerMonitoringDaemonService monitoringService = getMonitoringDaemonService(); ServiceSettings monitoringSettings = runtimeSettings.getServiceSettings(monitoringService); ServiceSettings thisSettings = runtimeSettings.getServiceSettings(getService()); List<SidecarService> result = new ArrayList<>(); if (monitoringSettings.getEnabled() && thisSettings.getMonitored()) { result.add(monitoringService); } return result; }
@Override public String getInstallCommand(DeploymentDetails deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, Map<String, String> installCommands, String startupCommand) { Map<String, Object> bindings = new HashMap<>(); List<SpinnakerService.Type> serviceTypes = new ArrayList<>(installCommands.keySet()).stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList()); List<String> upstartNames = getPrioritizedBakeableServices(serviceTypes) .stream() .filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()) .map(i -> ((BakeDebianService) i).getUpstartServiceName()) .filter(Objects::nonNull) .collect(Collectors.toList()); List<String> systemdServiceConfigs = upstartNames.stream() .map(n -> n + ".service") .collect(Collectors.toList()); List<String> serviceInstalls = serviceTypes.stream() .map(t -> installCommands.get(t.getCanonicalName())) .collect(Collectors.toList()); TemplatedResource resource = new StringReplaceJarResource("/debian/init.sh"); bindings.put("services", Strings.join(upstartNames, " ")); bindings.put("systemd-service-configs", Strings.join(systemdServiceConfigs, " ")); String upstartInit = resource.setBindings(bindings).toString(); BillOfMaterials.ArtifactSources artifactSources = artifactService.getArtifactSources(deploymentDetails.getDeploymentName()); resource = new StringReplaceJarResource("/debian/pre-bake.sh"); bindings = new HashMap<>(); bindings.put("debian-repository", artifactSourcesConfig.mergeWithBomSources(artifactSources).getDebianRepository()); bindings.put("install-commands", String.join("\n", serviceInstalls)); bindings.put("upstart-init", upstartInit); bindings.put("startup-file", Paths.get(startupScriptPath, "startup.sh").toString()); bindings.put("startup-command", startupCommand); return resource.setBindings(bindings).toString(); }
default List<SidecarService> getSidecars(SpinnakerRuntimeSettings runtimeSettings) { SpinnakerMonitoringDaemonService monitoringService = getMonitoringDaemonService(); ServiceSettings monitoringSettings = runtimeSettings.getServiceSettings(monitoringService); ServiceSettings thisSettings = runtimeSettings.getServiceSettings(getService()); List<SidecarService> result = new ArrayList<>(); if (monitoringSettings.getEnabled() && thisSettings.getMonitored()) { result.add(monitoringService); } return result; }
default List<SidecarService> getSidecars(SpinnakerRuntimeSettings runtimeSettings) { SpinnakerMonitoringDaemonService monitoringService = getMonitoringDaemonService(); List<SidecarService> result = new ArrayList<>(); if (monitoringService == null) { return result; } ServiceSettings monitoringSettings = runtimeSettings.getServiceSettings(monitoringService); ServiceSettings thisSettings = runtimeSettings.getServiceSettings(getService()); if (monitoringSettings.getEnabled() && thisSettings.getMonitored()) { result.add(monitoringService); } return result; }
List<String> upstartNames = getLocalServices(serviceTypes) .stream() .filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()) .map(i -> ((LocalDebianService) i).getUpstartServiceName()) .filter(Objects::nonNull)
List<String> upstartNames = getLocalServices(serviceTypes) .stream() .filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()) .map(i -> ((LocalDebianService) i).getUpstartServiceName()) .filter(Objects::nonNull)
.filter(i -> { ServiceSettings serviceSettings = resolvedConfiguration.getServiceSettings(i.getService()); return serviceSettings != null && serviceSettings.getEnabled(); }) .collect(Collectors.toList());
public SlimServiceSettings slim() { return new SlimServiceSettings(getHost(), getPort(), getBaseUrl(), getEnabled()); }
.filter(i -> { ServiceSettings serviceSettings = resolvedConfiguration.getServiceSettings(i.getService()); return serviceSettings != null && serviceSettings.getEnabled(); }) .collect(Collectors.toList());
if (settings.getEnabled() == null || settings.getEnabled()) { return;