private void validateDistributedDeployment(ConfigProblemSetBuilder p, DeploymentEnvironment n) { String accountName = n.getAccountName(); if (StringUtils.isEmpty(accountName)) { p.addProblem(Problem.Severity.FATAL, "An account name must be specified when using a Distributed deployment."); return; } DeploymentConfiguration deploymentConfiguration = n.parentOfType(DeploymentConfiguration.class); Account account; try { account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), n.getAccountName()); } catch (ConfigNotFoundException e) { p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " not defined."); return; } if (account instanceof GoogleAccount) { p.addProblem(Problem.Severity.WARNING, "Support for distributed deployments on GCE aren't fully supported yet."); } else if (account instanceof KubernetesAccount) { kubernetesAccountValidator.ensureKubectlExists(p); } else { p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " is not in a provider that supports distributed installation of Spinnaker yet"); } } }
private void validateDistributedDeployment(ConfigProblemSetBuilder p, DeploymentEnvironment n) { String accountName = n.getAccountName(); if (StringUtils.isEmpty(accountName)) { p.addProblem(Problem.Severity.FATAL, "An account name must be specified when using a Distributed deployment."); return; } DeploymentConfiguration deploymentConfiguration = n.parentOfType(DeploymentConfiguration.class); Account account; try { account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), n.getAccountName()); } catch (ConfigNotFoundException e) { p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " not defined."); return; } if (account instanceof GoogleAccount) { p.addProblem(Problem.Severity.WARNING, "Support for distributed deployments on GCE aren't fully supported yet."); } else if (account instanceof KubernetesAccount) { kubernetesAccountValidator.ensureKubectlExists(p); } else { p.addProblem(Problem.Severity.FATAL, "Account " + accountName + " is not in a provider that supports distributed installation of Spinnaker yet"); } } }
private Deployer getDeployer(DeploymentConfiguration deploymentConfiguration) { DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); DeploymentEnvironment.DeploymentType type = deploymentEnvironment.getType(); String accountName = deploymentEnvironment.getAccountName(); switch (type) { case BakeDebian: return bakeDeployer; case LocalGit: return localGitDeployer; case LocalDebian: return localDeployer; case Distributed: if (StringUtils.isEmpty(accountName)) { throw new HalException(Problem.Severity.FATAL, "An account name must be " + "specified as the desired place to run your distributed deployment."); } Account account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), accountName); Provider.ProviderType providerType = ((Provider) account.getParent()).providerType(); if (providerType == Provider.ProviderType.KUBERNETES && account.getProviderVersion() == V2) { return kubectlDeployer; } else { return distributedDeployer; } default: throw new IllegalArgumentException("Unrecognized deployment type " + type); } }
private Deployer getDeployer(DeploymentConfiguration deploymentConfiguration) { DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); DeploymentEnvironment.DeploymentType type = deploymentEnvironment.getType(); String accountName = deploymentEnvironment.getAccountName(); switch (type) { case BakeDebian: return bakeDeployer; case LocalGit: return localGitDeployer; case LocalDebian: return localDeployer; case Distributed: if (StringUtils.isEmpty(accountName)) { throw new HalException(Problem.Severity.FATAL, "An account name must be " + "specified as the desired place to run your distributed deployment."); } Account account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), accountName); Provider.ProviderType providerType = ((Provider) account.getParent()).providerType(); if (providerType == Provider.ProviderType.KUBERNETES && account.getProviderVersion() == V2) { return kubectlDeployer; } else { return distributedDeployer; } default: throw new IllegalArgumentException("Unrecognized deployment type " + type); } }
private SpinnakerServiceProvider createDeployableServiceProvider(DeploymentConfiguration deploymentConfiguration) { DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); String accountName = deploymentEnvironment.getAccountName(); if (accountName == null || accountName.isEmpty()) { throw new HalException(new ConfigProblemBuilder(Problem.Severity.FATAL, "An account name must be " + "specified as the desired place to run your simple clustered deployment.").build()); } Account account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), accountName); Provider.ProviderType providerType = ((Provider) account.getParent()).providerType(); switch (providerType) { case KUBERNETES: switch (account.getProviderVersion()) { case V1: return kubernetesV1DistributedServiceProvider; case V2: return kubectlServiceProvider; default: return kubernetesV1DistributedServiceProvider; } case GOOGLE: return googleDistributedServiceProvider; default: throw new IllegalArgumentException("No Clustered Simple Deployment for " + providerType.getName()); } } }
private SpinnakerServiceProvider createDeployableServiceProvider(DeploymentConfiguration deploymentConfiguration) { DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); String accountName = deploymentEnvironment.getAccountName(); if (accountName == null || accountName.isEmpty()) { throw new HalException(new ConfigProblemBuilder(Problem.Severity.FATAL, "An account name must be " + "specified as the desired place to run your simple clustered deployment.").build()); } Account account = accountService.getAnyProviderAccount(deploymentConfiguration.getName(), accountName); Provider.ProviderType providerType = ((Provider) account.getParent()).providerType(); switch (providerType) { case KUBERNETES: switch (account.getProviderVersion()) { case V1: return kubernetesV1DistributedServiceProvider; case V2: return kubectlServiceProvider; default: return kubernetesV1DistributedServiceProvider; } case GOOGLE: return googleDistributedServiceProvider; default: throw new IllegalArgumentException("No Clustered Simple Deployment for " + providerType.getName()); } } }
case Distributed: DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); String accountName = deploymentEnvironment.getAccountName();
case Distributed: DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); String accountName = deploymentEnvironment.getAccountName();
String bootstrapAccountName = deploymentEnvironment.getAccountName();
String bootstrapAccountName = deploymentEnvironment.getAccountName();
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { super.setProfile(profile, deploymentConfiguration, endpoints); // 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(); DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); if (deploymentEnvironment.getBootstrapOnly() != null && deploymentEnvironment.getBootstrapOnly()) { String bootstrapAccountName = deploymentEnvironment.getAccountName(); removeBootstrapOnlyAccount(modifiedProviders, deploymentConfiguration.getName(), bootstrapAccountName); } Artifacts artifacts = deploymentConfiguration.getArtifacts(); List<String> files = backupRequiredFiles(modifiedProviders, deploymentConfiguration.getName()); files.addAll(backupRequiredFiles(artifacts, deploymentConfiguration.getName())); if (deploymentConfiguration.getProviders() != null) { processProviders(deploymentConfiguration.getProviders()); } profile.appendContents(yamlToString(modifiedProviders)) .appendContents(yamlToString(new ArtifactWrapper(artifacts))) .appendContents(profile.getBaseContents()) .setRequiredFiles(files); deploymentConfiguration.setProviders(originalProviders); }
@Override protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) { super.setProfile(profile, deploymentConfiguration, endpoints); // 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(); DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment(); if (deploymentEnvironment.getBootstrapOnly() != null && deploymentEnvironment.getBootstrapOnly()) { String bootstrapAccountName = deploymentEnvironment.getAccountName(); removeBootstrapOnlyAccount(modifiedProviders, deploymentConfiguration.getName(), bootstrapAccountName); } Artifacts artifacts = deploymentConfiguration.getArtifacts(); List<String> files = backupRequiredFiles(modifiedProviders, deploymentConfiguration.getName()); files.addAll(backupRequiredFiles(artifacts, deploymentConfiguration.getName())); if (deploymentConfiguration.getProviders() != null) { processProviders(deploymentConfiguration.getProviders()); } profile.appendContents(yamlToString(modifiedProviders)) .appendContents(yamlToString(new ArtifactWrapper(artifacts))) .appendContents(profile.getBaseContents()) .setRequiredFiles(files); deploymentConfiguration.setProviders(originalProviders); }
deploymentEnvironment.setAccountName(isSet(accountName) ? accountName : deploymentEnvironment.getAccountName()); deploymentEnvironment.setBootstrapOnly(isSet(bootstrapOnly) ? bootstrapOnly : deploymentEnvironment.getBootstrapOnly()); deploymentEnvironment.setUpdateVersions(isSet(updateVersions) ? updateVersions : deploymentEnvironment.getUpdateVersions());
deploymentEnvironment.setAccountName(isSet(accountName) ? accountName : deploymentEnvironment.getAccountName()); deploymentEnvironment.setBootstrapOnly(isSet(bootstrapOnly) ? bootstrapOnly : deploymentEnvironment.getBootstrapOnly()); deploymentEnvironment.setUpdateVersions(isSet(updateVersions) ? updateVersions : deploymentEnvironment.getUpdateVersions());