Search in sources :

Example 6 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class DeployService method connectCommand.

public RemoteAction connectCommand(String deploymentName, List<String> serviceNames) {
    DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
    SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration);
    SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration);
    Deployer deployer = getDeployer(deploymentConfiguration);
    DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration);
    List<SpinnakerService.Type> serviceTypes = serviceNames.stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList());
    if (serviceTypes.isEmpty()) {
        serviceTypes.add(SpinnakerService.Type.DECK);
        serviceTypes.add(SpinnakerService.Type.GATE);
    }
    RemoteAction result = deployer.connectCommand(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes);
    result.setAutoRun(true);
    result.commitScript(halconfigDirectoryStructure.getConnectScriptPath(deploymentName));
    return result;
}
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) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) SpinnakerService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration) Deployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.Deployer) KubectlDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.KubectlDeployer) DistributedDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.DistributedDeployer) BakeDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.BakeDeployer) LocalDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalDeployer) LocalGitDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalGitDeployer)

Example 7 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class DeployService method prep.

public RemoteAction prep(String deploymentName, List<String> serviceNames) {
    DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
    DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration);
    Deployer deployer = getDeployer(deploymentConfiguration);
    SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration);
    SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration);
    List<SpinnakerService.Type> serviceTypes = serviceNames.stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList());
    if (serviceTypes.isEmpty()) {
        serviceTypes = serviceProvider.getServices().stream().map(SpinnakerService::getType).collect(Collectors.toList());
    }
    RemoteAction action = deployer.prep(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes);
    if (!action.getScript().isEmpty()) {
        action.commitScript(halconfigDirectoryStructure.getPrepScriptPath(deploymentName));
    }
    return action;
}
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) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) SpinnakerService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration) Deployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.Deployer) KubectlDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.KubectlDeployer) DistributedDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.DistributedDeployer) BakeDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.BakeDeployer) LocalDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalDeployer) LocalGitDeployer(com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalGitDeployer)

Example 8 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction 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 9 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class KubectlDeployer method deploy.

@Override
public RemoteAction deploy(KubectlServiceProvider serviceProvider, AccountDeploymentDetails<KubernetesAccount> deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, List<SpinnakerService.Type> serviceTypes) {
    List<KubernetesV2Service> services = serviceProvider.getServicesByPriority(serviceTypes);
    services.stream().forEach((service) -> {
        ServiceSettings settings = resolvedConfiguration.getServiceSettings((SpinnakerService) service);
        if (settings.getEnabled() != null && !settings.getEnabled()) {
            return;
        }
        if (settings.getSkipLifeCycleManagement() != null && settings.getSkipLifeCycleManagement()) {
            return;
        }
        DaemonTaskHandler.newStage("Deploying " + service.getServiceName() + " with kubectl");
        KubernetesAccount account = deploymentDetails.getAccount();
        String namespaceDefinition = service.getNamespaceYaml(resolvedConfiguration);
        String serviceDefinition = service.getServiceYaml(resolvedConfiguration);
        if (!KubernetesV2Utils.exists(account, namespaceDefinition)) {
            KubernetesV2Utils.apply(account, namespaceDefinition);
        }
        if (!KubernetesV2Utils.exists(account, serviceDefinition)) {
            KubernetesV2Utils.apply(account, serviceDefinition);
        }
        String resourceDefinition = service.getResourceYaml(deploymentDetails, resolvedConfiguration);
        DaemonTaskHandler.message("Running kubectl apply on the resource definition...");
        KubernetesV2Utils.apply(account, resourceDefinition);
    });
    return new RemoteAction();
}
Also used : KubernetesAccount(com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesAccount) ServiceSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) KubernetesV2Service(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.distributed.kubernetes.v2.KubernetesV2Service)

Example 10 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class LocalGitDeployer method prep.

@Override
public RemoteAction prep(LocalServiceProvider serviceProvider, DeploymentDetails deploymentDetails, SpinnakerRuntimeSettings runtimeSettings, List<SpinnakerService.Type> serviceTypes) {
    LocalGitServiceProvider localGitServiceProvider = (LocalGitServiceProvider) serviceProvider;
    List<LocalGitService> enabledServices = localGitServiceProvider.getLocalGitServices(serviceTypes);
    List<String> prepCommands = enabledServices.stream().filter(i -> !runtimeSettings.getServiceSettings(i.getService()).getSkipLifeCycleManagement()).map(s -> {
        s.commitWrapperScripts();
        return s.prepArtifactCommand(deploymentDetails);
    }).collect(Collectors.toList());
    String prepCommand = localGitServiceProvider.getPrepCommand(deploymentDetails, prepCommands);
    RemoteAction result = new RemoteAction();
    result.setAutoRun(true);
    result.setScript(prepCommand);
    return result;
}
Also used : List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) LocalServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider) LocalGitServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitServiceProvider) LocalGitService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitService) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) SpinnakerService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService) Collectors(java.util.stream.Collectors) LocalGitServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitServiceProvider) LocalGitService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitService) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction)

Aggregations

RemoteAction (com.netflix.spinnaker.halyard.core.RemoteAction)18 SpinnakerService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService)8 SpinnakerRuntimeSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings)7 DeploymentDetails (com.netflix.spinnaker.halyard.deploy.deployment.v1.DeploymentDetails)5 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)4 AccountDeploymentDetails (com.netflix.spinnaker.halyard.deploy.deployment.v1.AccountDeploymentDetails)4 HashMap (java.util.HashMap)4 Collectors (java.util.stream.Collectors)4 Component (org.springframework.stereotype.Component)4 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)3 StringReplaceJarResource (com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource)3 TemplatedResource (com.netflix.spinnaker.halyard.core.resource.v1.TemplatedResource)3 BakeDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.BakeDeployer)3 Deployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.Deployer)3 DistributedDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.DistributedDeployer)3 KubectlDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.KubectlDeployer)3 LocalDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalDeployer)3 LocalGitDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalGitDeployer)3 GenerateService (com.netflix.spinnaker.halyard.deploy.services.v1.GenerateService)3 LocalServiceProvider (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider)3