use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings in project halyard by spinnaker.
the class KubernetesV1DistributedServiceProvider method clean.
@Override
public RemoteAction clean(AccountDeploymentDetails<KubernetesAccount> details, SpinnakerRuntimeSettings runtimeSettings) {
KubernetesSharedServiceSettings kubernetesSharedServiceSettings = new KubernetesSharedServiceSettings(details.getDeploymentConfiguration());
KubernetesV1ProviderUtils.kubectlDeleteNamespaceCommand(DaemonTaskHandler.getJobExecutor(), details, kubernetesSharedServiceSettings.getDeployLocation());
return new RemoteAction();
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings in project halyard by spinnaker.
the class DistributedLogCollector method collectLogs.
@Override
public void collectLogs(AccountDeploymentDetails<A> details, SpinnakerRuntimeSettings runtimeSettings) {
DistributedService<T, A> distributedService = (DistributedService<T, A>) getService();
RunningServiceDetails runningServiceDetails = distributedService.getRunningServiceDetails(details, runtimeSettings);
runningServiceDetails.getInstances().values().forEach(is -> is.stream().filter(RunningServiceDetails.Instance::isRunning).forEach(i -> {
File outputDir = getDirectoryStructure().getServiceLogsPath(details.getDeploymentName(), i.getId(), getService().getCanonicalName()).toFile();
collectInstanceLogs(details, runtimeSettings, outputDir, i.getId());
}));
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings in project halyard by spinnaker.
the class LocalDebianServiceProvider method clean.
@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");
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings in project halyard by spinnaker.
the class ClouddriverBootstrapProfileFactory method setProfile.
@Override
@SuppressWarnings("unchecked")
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
super.setProfile(profile, deploymentConfiguration, endpoints);
DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment();
if (deploymentEnvironment.getType() != DeploymentEnvironment.DeploymentType.Distributed) {
throw new IllegalStateException("There is no need to produce a bootstrapping clouddriver for a non-remote deployment of Spinnaker. This is a bug.");
}
// We need to make modifications to this deployment configuration, but can't use helpful objects
// like the accountService on a clone. Therefore, we'll make the modifications in place and
// restore to the original state when the modifications are written out.
Providers originalProviders = deploymentConfiguration.getProviders().cloneNode(Providers.class);
Providers modifiedProviders = deploymentConfiguration.getProviders();
String deploymentName = deploymentConfiguration.getName();
String bootstrapAccountName = deploymentEnvironment.getAccountName();
Account bootstrapAccount = accountService.getAnyProviderAccount(deploymentName, bootstrapAccountName);
bootstrapAccount.makeBootstrappingAccount(artifactSourcesConfig);
Provider bootstrapProvider = (Provider) bootstrapAccount.getParent();
disableAllProviders(modifiedProviders);
bootstrapProvider.setEnabled(true);
bootstrapProvider.setAccounts(Collections.singletonList(bootstrapAccount));
if (bootstrapAccount instanceof ContainerAccount) {
ContainerAccount containerAccount = (ContainerAccount) bootstrapAccount;
List<DockerRegistryAccount> bootstrapRegistries = containerAccount.getDockerRegistries().stream().map(ref -> (DockerRegistryAccount) accountService.getProviderAccount(deploymentName, DOCKER_REGISTRY, ref.getAccountName())).collect(Collectors.toList());
DockerRegistryProvider dockerProvider = modifiedProviders.getDockerRegistry();
dockerProvider.setEnabled(true);
dockerProvider.setAccounts(bootstrapRegistries);
}
if (bootstrapAccount instanceof SupportsConsul) {
SupportsConsul consulAccount = (SupportsConsul) bootstrapAccount;
ConsulConfig config = consulAccount.getConsul();
if (config == null) {
config = new ConsulConfig();
consulAccount.setConsul(config);
}
consulAccount.getConsul().setEnabled(true);
} else {
log.warn("Attempting to perform a distributed deployment to account \"" + bootstrapAccount.getName() + "\" without a discovery mechanism");
}
List<String> files = backupRequiredFiles(modifiedProviders, deploymentConfiguration.getName());
profile.appendContents(yamlToString(modifiedProviders)).appendContents("services.fiat.enabled: false").appendContents(profile.getBaseContents()).setRequiredFiles(files);
deploymentConfiguration.setProviders(originalProviders);
}
use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings in project halyard by spinnaker.
the class Front50Service method getProfiles.
@Override
public List<Profile> getProfiles(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
List<Profile> profiles = super.getProfiles(deploymentConfiguration, endpoints);
String filename = "front50.yml";
String path = Paths.get(getConfigOutputPath(), filename).toString();
Profile profile = front50ProfileFactory.getProfile(filename, path, deploymentConfiguration, endpoints);
profiles.add(profile);
return profiles;
}
Aggregations