public SpinnakerServiceProvider create(DeploymentConfiguration deploymentConfiguration) { DeploymentEnvironment.DeploymentType type = deploymentConfiguration.getDeploymentEnvironment().getType(); // TODO(lwander) what's the best UX here? mashing together deploys & installs feels wrong. switch (type) { case BakeDebian: return bakeDebianServiceProvider; case LocalDebian: return localDebianServiceProvider; case LocalGit: return localGitServiceProvider; case Distributed: return createDeployableServiceProvider(deploymentConfiguration); default: throw new IllegalArgumentException("Unrecognized deployment type " + type); } }
@Override public void validate(ConfigProblemSetBuilder p, DeploymentEnvironment n) { DeploymentType type = n.getType(); switch (type) { case LocalDebian: case BakeDebian: break; case Distributed: validateDistributedDeployment(p, n); break; case LocalGit: validateGitDeployment(p, n); break; default: throw new RuntimeException("Unknown deployment environment type " + type); } }
@Override public void validate(ConfigProblemSetBuilder p, DeploymentEnvironment n) { DeploymentType type = n.getType(); switch (type) { case LocalDebian: case BakeDebian: break; case Distributed: validateDistributedDeployment(p, n); break; case LocalGit: validateGitDeployment(p, n); break; default: throw new RuntimeException("Unknown deployment environment type " + type); } }
public SpinnakerServiceProvider create(DeploymentConfiguration deploymentConfiguration) { DeploymentEnvironment.DeploymentType type = deploymentConfiguration.getDeploymentEnvironment().getType(); // TODO(lwander) what's the best UX here? mashing together deploys & installs feels wrong. switch (type) { case BakeDebian: return bakeDebianServiceProvider; case LocalDebian: return localDebianServiceProvider; case LocalGit: return localGitServiceProvider; case Distributed: return createDeployableServiceProvider(deploymentConfiguration); default: throw new IllegalArgumentException("Unrecognized deployment type " + type); } }
@Override public void validate(ConfigProblemSetBuilder p, Security n) { DeploymentConfiguration deploymentConfiguration = n.parentOfType(DeploymentConfiguration.class); boolean localhostAccess = StringUtils.isEmpty(n.getApiSecurity().getOverrideBaseUrl()) || StringUtils.isEmpty(n.getUiSecurity().getOverrideBaseUrl()) ; switch (deploymentConfiguration.getDeploymentEnvironment().getType()) { case Distributed: if (localhostAccess) { p.addProblem(Problem.Severity.WARNING, "Your UI or API domain does not have override base URLs set " + "even though your Spinnaker deployment is a Distributed deployment on a remote cloud provider. " + "As a result, you will need to open SSH tunnels against that deployment to access Spinnaker.") .setRemediation("We recommend that you instead configure an authentication mechanism (OAuth2, SAML2, or x509) " + "to make it easier to access Spinnaker securely, and then register the intended Domain and IP addresses " + "that your publicly facing services will be using."); // TODO(lwander) point to a guide here } break; case LocalDebian: break; } } }
@Override public void validate(ConfigProblemSetBuilder p, Security n) { DeploymentConfiguration deploymentConfiguration = n.parentOfType(DeploymentConfiguration.class); boolean localhostAccess = StringUtils.isEmpty(n.getApiSecurity().getOverrideBaseUrl()) || StringUtils.isEmpty(n.getUiSecurity().getOverrideBaseUrl()) ; switch (deploymentConfiguration.getDeploymentEnvironment().getType()) { case Distributed: if (localhostAccess) { p.addProblem(Problem.Severity.WARNING, "Your UI or API domain does not have override base URLs set " + "even though your Spinnaker deployment is a Distributed deployment on a remote cloud provider. " + "As a result, you will need to open SSH tunnels against that deployment to access Spinnaker.") .setRemediation("We recommend that you instead configure an authentication mechanism (OAuth2, SAML2, or x509) " + "to make it easier to access Spinnaker securely, and then register the intended Domain and IP addresses " + "that your publicly facing services will be using."); // TODO(lwander) point to a guide here } break; case LocalDebian: break; } } }
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); } }
boolean localGit = n.getDeploymentEnvironment().getType() == DeploymentType.LocalGit;
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); } }
boolean localGit = n.getDeploymentEnvironment().getType() == DeploymentType.LocalGit;
private DeploymentDetails getDeploymentDetails(DeploymentConfiguration deploymentConfiguration) { String deploymentName = deploymentConfiguration.getName(); BillOfMaterials billOfMaterials = artifactService.getBillOfMaterials(deploymentName); DeploymentEnvironment.DeploymentType type = deploymentConfiguration.getDeploymentEnvironment().getType(); switch (type) { case BakeDebian:
private DeploymentDetails getDeploymentDetails(DeploymentConfiguration deploymentConfiguration) { String deploymentName = deploymentConfiguration.getName(); BillOfMaterials billOfMaterials = artifactService.getBillOfMaterials(deploymentName); DeploymentEnvironment.DeploymentType type = deploymentConfiguration.getDeploymentEnvironment().getType(); switch (type) { case BakeDebian:
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.");
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.");
deploymentEnvironment.setBootstrapOnly(isSet(bootstrapOnly) ? bootstrapOnly : deploymentEnvironment.getBootstrapOnly()); deploymentEnvironment.setUpdateVersions(isSet(updateVersions) ? updateVersions : deploymentEnvironment.getUpdateVersions()); deploymentEnvironment.setType(type != null ? type : deploymentEnvironment.getType());
deploymentEnvironment.setBootstrapOnly(isSet(bootstrapOnly) ? bootstrapOnly : deploymentEnvironment.getBootstrapOnly()); deploymentEnvironment.setUpdateVersions(isSet(updateVersions) ? updateVersions : deploymentEnvironment.getUpdateVersions()); deploymentEnvironment.setType(type != null ? type : deploymentEnvironment.getType());