Search in sources :

Example 31 with DeploymentConfiguration

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

the class ApacheSpinnakerProfileFactory method getBindings.

@Override
protected Map<String, Object> getBindings(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
    TemplatedResource resource = new StringResource(SSL_TEMPLATE);
    Map<String, Object> bindings = new HashMap<>();
    UiSecurity uiSecurity = deploymentConfiguration.getSecurity().getUiSecurity();
    ApacheSsl apacheSsl = uiSecurity.getSsl();
    bindings.put("cert-file", apacheSsl.getSslCertificateFile());
    bindings.put("key-file", apacheSsl.getSslCertificateKeyFile());
    String ssl = resource.setBindings(bindings).toString();
    bindings.clear();
    bindings.put("ssl", ssl);
    bindings.put("deck-host", endpoints.getServices().getDeck().getHost());
    bindings.put("deck-port", endpoints.getServices().getDeck().getPort() + "");
    return bindings;
}
Also used : StringResource(com.netflix.spinnaker.halyard.core.resource.v1.StringResource) UiSecurity(com.netflix.spinnaker.halyard.config.model.v1.security.UiSecurity) HashMap(java.util.HashMap) ApacheSsl(com.netflix.spinnaker.halyard.config.model.v1.security.ApacheSsl) TemplatedResource(com.netflix.spinnaker.halyard.core.resource.v1.TemplatedResource)

Example 32 with DeploymentConfiguration

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

the class MetricRegistryProfileFactoryBuilder method build.

public ProfileFactory build(ServiceSettings settings) {
    return new ProfileFactory() {

        @Override
        protected ArtifactService getArtifactService() {
            return artifactService;
        }

        @Override
        protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
            URI uri;
            try {
                String baseUrl;
                if (settings.getBasicAuthEnabled() != null && settings.getBasicAuthEnabled()) {
                    baseUrl = settings.getAuthBaseUrl();
                } else {
                    baseUrl = settings.getBaseUrl();
                }
                uri = new URIBuilder(baseUrl).setHost("localhost").setPath("/spectator/metrics").build();
            } catch (URISyntaxException e) {
                throw new HalException(Problem.Severity.FATAL, "Unable to build service URL: " + e.getMessage());
            }
            profile.appendContents("metrics_url: " + uri.toString());
        }

        @Override
        protected Profile getBaseProfile(String name, String version, String outputFile) {
            return new Profile(name, version, outputFile, "");
        }

        @Override
        public SpinnakerArtifact getArtifact() {
            return SpinnakerArtifact.SPINNAKER_MONITORING_DAEMON;
        }

        @Override
        protected String commentPrefix() {
            return "## ";
        }
    };
}
Also used : HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration) URIBuilder(org.apache.http.client.utils.URIBuilder)

Example 33 with DeploymentConfiguration

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

the class RoscoProfileFactory method setProfile.

@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
    super.setProfile(profile, deploymentConfiguration, endpoints);
    Providers providers = deploymentConfiguration.getProviders();
    Providers otherProviders = getImageProviders(profile.getVersion());
    NodeIterator iterator = providers.getChildren();
    Provider child = (Provider) iterator.getNext();
    while (child != null) {
        if (child instanceof HasImageProvider) {
            NodeIterator otherIterator = otherProviders.getChildren();
            NodeFilter providerFilter = new NodeFilter().setProvider(child.getNodeName());
            HasImageProvider otherChild = (HasImageProvider) otherIterator.getNext(providerFilter);
            if (otherChild == null) {
                log.warn("images.yml has no images stored for " + child.getNodeName());
            } else {
                log.info("Adding default images for " + child.getNodeName());
                ((HasImageProvider) child).getBakeryDefaults().addDefaultImages(otherChild.getBakeryDefaults().getBaseImages());
            }
        }
        child = (Provider) iterator.getNext();
    }
    List<String> files = backupRequiredFiles(providers, deploymentConfiguration.getName());
    profile.appendContents(yamlToString(providers)).appendContents(profile.getBaseContents()).setRequiredFiles(files);
}
Also used : NodeIterator(com.netflix.spinnaker.halyard.config.model.v1.node.NodeIterator) Providers(com.netflix.spinnaker.halyard.config.model.v1.node.Providers) HasImageProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider) Provider(com.netflix.spinnaker.halyard.config.model.v1.node.Provider) HasImageProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 34 with DeploymentConfiguration

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

the class ApachePassphraseProfileFactory method getBindings.

@Override
protected Map<String, Object> getBindings(DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
    Map<String, Object> bindings = new HashMap<>();
    ApacheSsl ssl = deploymentConfiguration.getSecurity().getUiSecurity().getSsl();
    bindings.put("passphrase", ssl.getSslCertificatePassphrase());
    return bindings;
}
Also used : HashMap(java.util.HashMap) ApacheSsl(com.netflix.spinnaker.halyard.config.model.v1.security.ApacheSsl)

Example 35 with DeploymentConfiguration

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

the class SpinnakerMonitoringDaemonProfileFactory method setProfile.

@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
    SpinnakerRuntimeSettings.Services services = endpoints.getServices();
    ServiceSettings monitoringService = services.getMonitoringDaemon();
    MetricStores metricStores = deploymentConfiguration.getMetricStores();
    List<String> enabledMetricStores = new ArrayList<>();
    List<String> files = new ArrayList<>();
    DatadogStore datadogStore = metricStores.getDatadog();
    if (datadogStore.isEnabled()) {
        enabledMetricStores.add("datadog");
    }
    PrometheusStore prometheusStore = metricStores.getPrometheus();
    if (prometheusStore.isEnabled()) {
        enabledMetricStores.add("prometheus");
    }
    StackdriverStore stackdriverStore = metricStores.getStackdriver();
    if (stackdriverStore.isEnabled()) {
        enabledMetricStores.add("stackdriver");
        files.addAll(backupRequiredFiles(stackdriverStore, deploymentConfiguration.getName()));
    }
    profile.appendContents(yamlToString(metricStores));
    Server server = new Server().setHost(monitoringService.getHost()).setPort(monitoringService.getPort());
    ServerConfig serverConfig = new ServerConfig();
    serverConfig.setServer(server);
    profile.appendContents(yamlToString(serverConfig));
    Monitor monitor = new Monitor().setPeriod(metricStores.getPeriod()).setMetricStore(enabledMetricStores);
    MonitorConfig monitorConfig = new MonitorConfig();
    monitorConfig.setMonitor(monitor);
    profile.appendContents(yamlToString(monitorConfig));
    profile.appendContents(profile.getBaseContents());
    profile.setRequiredFiles(files);
}
Also used : MetricStores(com.netflix.spinnaker.halyard.config.model.v1.node.MetricStores) ServiceSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings) ArrayList(java.util.ArrayList) StackdriverStore(com.netflix.spinnaker.halyard.config.model.v1.metricStores.stackdriver.StackdriverStore) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) DatadogStore(com.netflix.spinnaker.halyard.config.model.v1.metricStores.datadog.DatadogStore) PrometheusStore(com.netflix.spinnaker.halyard.config.model.v1.metricStores.prometheus.PrometheusStore)

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