Search in sources :

Example 36 with DeploymentConfiguration

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

the class FiatProfileFactory method setProfile.

@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
    super.setProfile(profile, deploymentConfiguration, endpoints);
    Authz authz = deploymentConfiguration.getSecurity().getAuthz();
    List<String> files = backupRequiredFiles(authz, deploymentConfiguration.getName());
    AuthConfig authConfig = new AuthConfig().setAuth(authz);
    profile.appendContents(yamlToString(authConfig)).appendContents(profile.getBaseContents()).setRequiredFiles(files);
}
Also used : Authz(com.netflix.spinnaker.halyard.config.model.v1.security.Authz)

Example 37 with DeploymentConfiguration

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

the class GateProfileFactory method setProfile.

@Override
public void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
    super.setProfile(profile, deploymentConfiguration, endpoints);
    Security security = deploymentConfiguration.getSecurity();
    List<String> requiredFiles = backupRequiredFiles(security.getApiSecurity(), deploymentConfiguration.getName());
    requiredFiles.addAll(backupRequiredFiles(security.getAuthn(), deploymentConfiguration.getName()));
    requiredFiles.addAll(backupRequiredFiles(security.getAuthz(), deploymentConfiguration.getName()));
    GateConfig gateConfig = getGateConfig(endpoints.getServices().getGate(), security);
    gateConfig.getCors().setAllowedOriginsPattern(security.getApiSecurity());
    profile.appendContents(yamlToString(gateConfig)).appendContents(profile.getBaseContents()).setRequiredFiles(requiredFiles);
}
Also used : Security(com.netflix.spinnaker.halyard.config.model.v1.security.Security) ApiSecurity(com.netflix.spinnaker.halyard.config.model.v1.security.ApiSecurity)

Example 38 with DeploymentConfiguration

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

the class EditConfigCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    DeploymentConfiguration deploymentConfiguration = new OperationHandler<DeploymentConfiguration>().setOperation(Daemon.getDeploymentConfiguration(currentDeployment, false)).setFailureMesssage("Failed to get your deployment configuration for edits.").get();
    int hash = deploymentConfiguration.hashCode();
    deploymentConfiguration.setTimezone(isSet(timezone) ? timezone : deploymentConfiguration.getTimezone());
    if (deploymentConfiguration.hashCode() == hash) {
        AnsiUi.error("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setDeploymentConfiguration(currentDeployment, !noValidate, deploymentConfiguration)).setFailureMesssage("Failed to apply edits to your deployment configuration").setSuccessMessage("Successfully edited your deployment configuration").get();
}
Also used : DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 39 with DeploymentConfiguration

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

the class KubernetesAccountValidator method validate.

@Override
public void validate(ConfigProblemSetBuilder psBuilder, KubernetesAccount account) {
    DeploymentConfiguration deploymentConfiguration;
    // TODO(lwander) this is still a little messy - I should use the filters to get the necessary docker account
    Node parent = account.getParent();
    while (!(parent instanceof DeploymentConfiguration)) {
        // Note this will crash in the above check if the halconfig representation is corrupted
        // (that's ok, because it indicates a more serious error than we want to validate).
        parent = parent.getParent();
    }
    deploymentConfiguration = (DeploymentConfiguration) parent;
    validateKindConfig(psBuilder, account);
    // TODO(lwander) validate all config with clouddriver's v2 creds
    switch(account.getProviderVersion()) {
        case V1:
            final List<String> dockerRegistryNames = account.getDockerRegistries().stream().map(DockerRegistryReference::getAccountName).collect(Collectors.toList());
            validateDockerRegistries(psBuilder, deploymentConfiguration, dockerRegistryNames, Provider.ProviderType.KUBERNETES);
            validateKubeconfig(psBuilder, account);
        case V2:
            break;
        default:
            throw new IllegalStateException("Unknown provider version " + account.getProviderVersion());
    }
}
Also used : Node(com.netflix.spinnaker.halyard.config.model.v1.node.Node) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Example 40 with DeploymentConfiguration

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

the class DeployService method configDiff.

public NodeDiff configDiff(String deploymentName) {
    try {
        DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
        halconfigParser.switchToBackupConfig();
        DeploymentConfiguration oldDeploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
        return deploymentConfiguration.diff(oldDeploymentConfiguration);
    } finally {
        halconfigParser.switchToPrimaryConfig();
    }
}
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