Search in sources :

Example 11 with DeploymentConfiguration

use of com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration in project halyard by spinnaker.

the class DeployService method clean.

public void clean(String deploymentName) {
    DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
    SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration);
    DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration);
    RemoteAction action = serviceProvider.clean(deploymentDetails, serviceProvider.buildRuntimeSettings(deploymentConfiguration));
    action.commitScript(halconfigDirectoryStructure.getUnInstallScriptPath(deploymentName));
}
Also used : AccountDeploymentDetails(com.netflix.spinnaker.halyard.deploy.deployment.v1.AccountDeploymentDetails) DeploymentDetails(com.netflix.spinnaker.halyard.deploy.deployment.v1.DeploymentDetails) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Example 12 with DeploymentConfiguration

use of com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration in project halyard by spinnaker.

the class DeployService method getDeployer.

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);
    }
}
Also used : Account(com.netflix.spinnaker.halyard.config.model.v1.node.Account) DeploymentEnvironment(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment) HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) Provider(com.netflix.spinnaker.halyard.config.model.v1.node.Provider) SpinnakerServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerServiceProvider)

Example 13 with DeploymentConfiguration

use of com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration in project halyard by spinnaker.

the class ServiceProviderFactory method createDeployableServiceProvider.

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());
    }
}
Also used : Account(com.netflix.spinnaker.halyard.config.model.v1.node.Account) DeploymentEnvironment(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) LocalDebianServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.debian.LocalDebianServiceProvider) LocalGitServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitServiceProvider) GoogleDistributedServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.distributed.google.GoogleDistributedServiceProvider) KubectlServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.distributed.kubernetes.v2.KubectlServiceProvider) BakeDebianServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.debian.BakeDebianServiceProvider) SpinnakerServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerServiceProvider) Provider(com.netflix.spinnaker.halyard.config.model.v1.node.Provider) KubernetesV1DistributedServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.distributed.kubernetes.v1.KubernetesV1DistributedServiceProvider)

Example 14 with DeploymentConfiguration

use of com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration in project halyard by spinnaker.

the class DeploymentController method deploymentConfiguration.

@RequestMapping(value = "/{deploymentName:.+}", method = RequestMethod.PUT)
DaemonTask<Halconfig, Void> deploymentConfiguration(@PathVariable String deploymentName, @RequestParam(required = false, defaultValue = DefaultControllerValues.validate) boolean validate, @RequestParam(required = false, defaultValue = DefaultControllerValues.severity) Severity severity, @RequestBody Object rawDeployment) {
    DeploymentConfiguration deploymentConfiguration = objectMapper.convertValue(rawDeployment, DeploymentConfiguration.class);
    UpdateRequestBuilder builder = new UpdateRequestBuilder();
    Path configPath = halconfigDirectoryStructure.getConfigPath(deploymentName);
    builder.setStage(() -> deploymentConfiguration.stageLocalFiles(configPath));
    builder.setSeverity(severity);
    builder.setUpdate(() -> deploymentService.setDeploymentConfiguration(deploymentName, deploymentConfiguration));
    if (validate) {
        builder.setValidate(() -> deploymentService.validateDeployment(deploymentName));
    } else {
        builder.setValidate(ProblemSet::new);
    }
    builder.setRevert(() -> halconfigParser.undoChanges());
    builder.setSave(() -> halconfigParser.saveConfig());
    builder.setClean(() -> halconfigParser.cleanLocalFiles(configPath));
    return DaemonTaskHandler.submitTask(builder::build, "Edit deployment configuration");
}
Also used : Path(java.nio.file.Path) UpdateRequestBuilder(com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder) ProblemSet(com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with DeploymentConfiguration

use of com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration in project halyard by spinnaker.

the class DeploymentService method setLocation.

public void setLocation(String deploymentName, String location) {
    DeploymentConfiguration deploymentConfiguration = getDeploymentConfiguration(deploymentName);
    deploymentConfiguration.getDeploymentEnvironment().setLocation(location);
}
Also used : DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Aggregations

DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)39 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)9 SpinnakerRuntimeSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings)9 DeploymentDetails (com.netflix.spinnaker.halyard.deploy.deployment.v1.DeploymentDetails)7 DeploymentEnvironment (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment)6 AccountDeploymentDetails (com.netflix.spinnaker.halyard.deploy.deployment.v1.AccountDeploymentDetails)6 Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)5 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)5 SpinnakerService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService)5 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)4 Notifications (com.netflix.spinnaker.halyard.config.model.v1.node.Notifications)4 Provider (com.netflix.spinnaker.halyard.config.model.v1.node.Provider)4 Providers (com.netflix.spinnaker.halyard.config.model.v1.node.Providers)4 RemoteAction (com.netflix.spinnaker.halyard.core.RemoteAction)4 BakeDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.BakeDeployer)4 Deployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.Deployer)4 DistributedDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.DistributedDeployer)4 KubectlDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.KubectlDeployer)4 LocalDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalDeployer)4 LocalGitDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalGitDeployer)4