CloudMigrations: Add config for alert rules state behavior and remove experimental feature toggle on alerts migration (#97254)

* CloudMigrations: add config for controlling alert rules state behavior

* CloudMigrations: remove experimental 'onPremToCloudMigrationsAlerts' feature toggle
This commit is contained in:
Matheus Macabu
2024-12-17 12:56:18 +01:00
committed by GitHub
parent ae7cb6866d
commit c824f5b9bf
12 changed files with 69 additions and 95 deletions
+10
View File
@@ -5,6 +5,14 @@ import (
"time"
)
const (
// GMSAlertRulesPaused configures Alert Rules to all be in Paused state.
GMSAlertRulesPaused = "paused"
// GMSAlertRulesUnchanged will not change the Alert Rules' states.
GMSAlertRulesUnchanged = "unchanged"
)
type CloudMigrationSettings struct {
IsTarget bool
GcomAPIToken string
@@ -26,6 +34,7 @@ type CloudMigrationSettings struct {
TokenExpiresAfter time.Duration
FeedbackURL string
FrontendPollInterval time.Duration
AlertRulesState string
IsDeveloperMode bool
}
@@ -53,6 +62,7 @@ func (cfg *Cfg) readCloudMigrationSettings() {
cfg.CloudMigration.IsDeveloperMode = cloudMigration.Key("developer_mode").MustBool(false)
cfg.CloudMigration.FeedbackURL = cloudMigration.Key("feedback_url").MustString("")
cfg.CloudMigration.FrontendPollInterval = cloudMigration.Key("frontend_poll_interval").MustDuration(2 * time.Second)
cfg.CloudMigration.AlertRulesState = cloudMigration.Key("alert_rules_state").In(GMSAlertRulesPaused, []string{GMSAlertRulesPaused, GMSAlertRulesUnchanged})
if cfg.CloudMigration.SnapshotFolder == "" {
cfg.CloudMigration.SnapshotFolder = filepath.Join(cfg.DataPath, "cloud_migration")