Search in sources :

Example 16 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class EditCanaryPrometheusCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
    int originalHash = canary.hashCode();
    PrometheusCanaryServiceIntegration prometheusCanaryServiceIntegration = (PrometheusCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, PrometheusCanaryServiceIntegration.class);
    prometheusCanaryServiceIntegration.setMetadataCachingIntervalMS(isSet(metadataCachingIntervalMS) ? metadataCachingIntervalMS : prometheusCanaryServiceIntegration.getMetadataCachingIntervalMS());
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis Prometheus service integration settings.").setSuccessMessage("Successfully edited canary analysis Prometheus service integration settings.").get();
}
Also used : PrometheusCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration) Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 17 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class AbstractEnableDisableCanaryServiceIntegrationCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
    int originalHash = canary.hashCode();
    AbstractCanaryServiceIntegration canaryServiceIntegration = CanaryUtils.getServiceIntegrationByName(canary, currentDeployment, getName(), true);
    canaryServiceIntegration.setEnabled(isEnable());
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setSuccessMessage("Successfully " + indicativePastPerfectAction() + " canary analysis " + getName() + " service integration.").setFailureMesssage("Failed to " + getCommandName() + " canary analysis " + getName() + " service integration.").setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).get();
}
Also used : AbstractCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration) Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 18 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class EditCanaryCommand method executeThis.

@Override
protected void executeThis() {
    String currentDeployment = getCurrentDeployment();
    // Disable validation here, since we don't want an illegal config to prevent us from fixing it.
    Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
    int originalHash = canary.hashCode();
    canary.setReduxLoggerEnabled(isSet(reduxLoggerEnabled) ? reduxLoggerEnabled : canary.isReduxLoggerEnabled());
    canary.setDefaultMetricsAccount(isSet(defaultMetricsAccount) ? defaultMetricsAccount : canary.getDefaultMetricsAccount());
    canary.setDefaultStorageAccount(isSet(defaultStorageAccount) ? defaultStorageAccount : canary.getDefaultStorageAccount());
    canary.setDefaultJudge(isSet(defaultJudge) ? defaultJudge : canary.getDefaultJudge());
    canary.setDefaultMetricsStore(isSet(defaultMetricsStore) ? defaultMetricsStore : canary.getDefaultMetricsStore());
    canary.setStagesEnabled(isSet(stagesEnabled) ? stagesEnabled : canary.isStagesEnabled());
    canary.setAtlasWebComponentsUrl(isSet(atlasWebComponentsUrl) ? atlasWebComponentsUrl : canary.getAtlasWebComponentsUrl());
    canary.setTemplatesEnabled(isSet(templatesEnabled) ? templatesEnabled : canary.isTemplatesEnabled());
    canary.setShowAllConfigsEnabled(isSet(showAllConfigsEnabled) ? showAllConfigsEnabled : canary.isShowAllConfigsEnabled());
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis settings.").setSuccessMessage("Successfully edited canary analysis settings.").get();
}
Also used : Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 19 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class CanaryService method setCanaryEnabled.

public void setCanaryEnabled(String deploymentName, boolean enabled) {
    Canary canary = getCanary(deploymentName);
    canary.setEnabled(enabled);
}
Also used : Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)

Example 20 with Canary

use of com.netflix.spinnaker.halyard.config.model.v1.canary.Canary in project halyard by spinnaker.

the class CanaryService method setCanary.

public void setCanary(String deploymentName, Canary newCanary) {
    DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
    deploymentConfiguration.setCanary(newCanary);
}
Also used : DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Aggregations

Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)10 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)7 AbstractCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount)6 AbstractCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryServiceIntegration)3 UpdateRequestBuilder (com.netflix.spinnaker.halyard.core.DaemonResponse.UpdateRequestBuilder)3 ProblemSet (com.netflix.spinnaker.halyard.core.problem.v1.ProblemSet)3 Path (java.nio.file.Path)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 AwsCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)2 GoogleCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryServiceIntegration)2 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)2 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)1 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)1 AwsCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryAccount)1 DatadogCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.datadog.DatadogCanaryAccount)1 GoogleCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryAccount)1 PrometheusCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryAccount)1 PrometheusCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.prometheus.PrometheusCanaryServiceIntegration)1 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)1 Features (com.netflix.spinnaker.halyard.config.model.v1.node.Features)1