use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings in project halyard by spinnaker.
the class SpinnakerMonitoringDaemonService method getProfiles.
@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;
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings in project halyard by spinnaker.
the class DeckDockerProfileFactory method setProfile.
@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
super.setProfile(profile, deploymentConfiguration, endpoints);
ServiceSettings deckSettings = endpoints.getServices().getDeck();
ServiceSettings gateSettings = endpoints.getServices().getGate();
ApacheSsl apacheSsl = deploymentConfiguration.getSecurity().getUiSecurity().getSsl();
if (apacheSsl.isEnabled()) {
Map<String, String> env = profile.getEnv();
env.put("DECK_HOST", deckSettings.getHost());
env.put("DECK_PORT", deckSettings.getPort() + "");
env.put("API_HOST", gateSettings.getBaseUrl());
env.put("AUTH_ENABLED", Boolean.toString(deploymentConfiguration.getSecurity().getAuthn().isEnabled()));
env.put("DECK_CERT", apacheSsl.getSslCertificateFile());
env.put("DECK_KEY", apacheSsl.getSslCertificateKeyFile());
env.put("PASSPHRASE", apacheSsl.getSslCertificatePassphrase());
}
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings in project halyard by spinnaker.
the class ConsulClientProfileFactory method getBindings.
@Override
protected Map<String, Object> getBindings(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
Map<String, Object> bindings = new HashMap<>();
ServiceSettings consul = endpoints.getServices().getConsulClient();
bindings.put("scheme", consul.getScheme());
bindings.put("port", consul.getPort() + "");
return bindings;
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings in project halyard by spinnaker.
the class SpinnakerServiceProvider method buildRuntimeSettings.
public SpinnakerRuntimeSettings buildRuntimeSettings(DeploymentConfiguration deploymentConfiguration) {
SpinnakerRuntimeSettings endpoints = new SpinnakerRuntimeSettings();
for (SpinnakerService.Type type : SpinnakerService.Type.values()) {
SpinnakerService service = getSpinnakerService(type);
if (service != null) {
log.info("Building service settings entry for " + service.getServiceName());
ServiceSettings settings = service.getDefaultServiceSettings(deploymentConfiguration);
settings.mergePreferThis(service.buildServiceSettings(deploymentConfiguration));
endpoints.setServiceSettings(type, settings);
}
}
return endpoints;
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings in project halyard by spinnaker.
the class DistributedService method buildRollbackPipeline.
default Map<String, Object> buildRollbackPipeline(AccountDeploymentDetails<A> details, SpinnakerRuntimeSettings runtimeSettings) {
RunningServiceDetails serviceDetails = getRunningServiceDetails(details, runtimeSettings);
Integer version = serviceDetails.getLatestEnabledVersion();
if (version == null) {
throw new HalException(Problem.Severity.FATAL, "There are no enabled server groups for service " + getServiceName() + " nothing to rollback to.");
}
int targetSize = serviceDetails.getInstances().get(version).size();
targetSize = targetSize == 0 ? 1 : targetSize;
ServiceSettings settings = runtimeSettings.getServiceSettings(getService());
Map<String, Object> baseDescription = new HashMap<>();
baseDescription.put("cloudProvider", getProviderType().getId());
baseDescription.put("cloudProviderType", getProviderType().getId());
baseDescription.put("region", getRegion(settings));
baseDescription.put("credentials", details.getAccount().getName());
baseDescription.put("cluster", getServiceName());
baseDescription.put("name", "rollback");
Map<String, Object> capacity = new HashMap<>();
capacity.put("desired", targetSize);
Map<String, Object> resizeDescription = new HashMap<>();
resizeDescription.putAll(baseDescription);
String resizeId = "resize";
resizeDescription.put("name", "Resize old " + getServiceName() + " to prior size");
resizeDescription.put("capacity", capacity);
resizeDescription.put("type", "resizeServerGroup");
resizeDescription.put("refId", resizeId);
resizeDescription.put("target", "ancestor_asg_dynamic");
resizeDescription.put("action", "scale_exact");
resizeDescription.put("requisiteStageRefIds", Collections.emptyList());
Map<String, Object> enableDescription = new HashMap<>();
enableDescription.putAll(baseDescription);
String enableId = "enable";
enableDescription.put("name", "Enable old " + getServiceName());
enableDescription.put("type", "enableServerGroup");
enableDescription.put("refId", enableId);
enableDescription.put("target", "ancestor_asg_dynamic");
enableDescription.put("requisiteStageRefIds", Collections.singletonList(resizeId));
// This is a destroy, rather than a disable because the typical flow will look like this:
//
// 1. You deploy a new version/config
// 2. Something is wrong, so you rollback.
// 3. Fixing the bad server group requires redeploying.
//
// Since you can't fix the newest destroyed server group in place, and you won't (at least I can't imagine why)
// want to reenable that server group, there is no point it keeping it around. There's an argument
// to be made for keeping it around to debug, but that's far from what the average halyard user will want
// to do.
Map<String, Object> destroyDescription = new HashMap<>();
String destroyId = "destroy";
destroyDescription.putAll(baseDescription);
destroyDescription.put("name", "Destroy current " + getServiceName());
destroyDescription.put("type", "destroyServerGroup");
destroyDescription.put("refId", destroyId);
destroyDescription.put("requisiteStageRefIds", Collections.singletonList(enableId));
destroyDescription.put("target", "current_asg_dynamic");
List<Map<String, Object>> stages = new ArrayList<>();
stages.add(resizeDescription);
stages.add(enableDescription);
stages.add(destroyDescription);
Map<String, Object> pipeline = new HashMap<>();
pipeline.put("stages", stages);
pipeline.put("application", "spin");
pipeline.put("name", "Rollback " + getServiceName());
pipeline.put("description", "Auto-generated by Halyard");
return pipeline;
}
Aggregations