Skip to content

Commit

Permalink
Enable Insights recommendations as alerts by default (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
tremes authored Jul 22, 2022
1 parent 23f16e1 commit 2f490af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Serialized struct {
ClusterTransferEndpoint string `json:"clusterTransferEndpoint"`
ClusterTransferInterval string `json:"clusterTransferInterval"`
}
EnableInsightsAlerts bool `json:"enableInsightsAlerts"`
DisableInsightsAlerts bool `json:"disableInsightsAlerts"`
}

// Controller defines the standard config for this operator.
Expand Down Expand Up @@ -68,8 +68,8 @@ type Controller struct {
HTTPConfig HTTPConfig
OCMConfig OCMConfig

// EnableInsightsAlerts enables exposing of Insights recommendations as Prometheus info alerts
EnableInsightsAlerts bool
// DisableInsightsAlerts disabled exposing of Insights recommendations as Prometheus info alerts
DisableInsightsAlerts bool
}

// HTTPConfig configures http proxy and exception settings if they come from config
Expand Down Expand Up @@ -155,7 +155,7 @@ func (c *Controller) mergeReport(cfg *Controller) {
c.ReportMinRetryTime = cfg.ReportMinRetryTime
}
c.EnableGlobalObfuscation = c.EnableGlobalObfuscation || cfg.EnableGlobalObfuscation
c.EnableInsightsAlerts = c.EnableInsightsAlerts || cfg.EnableInsightsAlerts
c.DisableInsightsAlerts = c.DisableInsightsAlerts || cfg.DisableInsightsAlerts
}

func (c *Controller) mergeOCM(cfg *Controller) {
Expand Down Expand Up @@ -198,7 +198,7 @@ func ToController(s *Serialized, cfg *Controller) (*Controller, error) { // noli
cfg.Impersonate = s.Impersonate
cfg.Gather = s.Gather
cfg.EnableGlobalObfuscation = s.EnableGlobalObfuscation
cfg.EnableInsightsAlerts = s.EnableInsightsAlerts
cfg.DisableInsightsAlerts = s.DisableInsightsAlerts

if len(s.Interval) > 0 {
d, err := time.ParseDuration(s.Interval)
Expand Down Expand Up @@ -293,7 +293,7 @@ func ToDisconnectedController(s *Serialized, cfg *Controller) (*Controller, erro
cfg.Gather = s.Gather
cfg.EnableGlobalObfuscation = s.EnableGlobalObfuscation
cfg.ConditionalGathererEndpoint = s.ConditionalGathererEndpoint
cfg.EnableInsightsAlerts = s.EnableInsightsAlerts
cfg.DisableInsightsAlerts = s.DisableInsightsAlerts

if len(s.Interval) > 0 {
d, err := time.ParseDuration(s.Interval)
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/configobserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func (c *Config) loadReport(data map[string][]byte) {
}

c.Report = len(c.Endpoint) > 0
if enableInsightsAlerts, ok := data["enableInsightsAlerts"]; ok {
c.EnableInsightsAlerts = strings.EqualFold(string(enableInsightsAlerts), "true")
if disableInsightsAlerts, ok := data["disableInsightsAlerts"]; ok {
c.DisableInsightsAlerts = strings.EqualFold(string(disableInsightsAlerts), "true")
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/insights/insightsreport/insightsreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (c *Controller) updateInsightsMetrics(report types.SmartProxyReport) {
critical++
}

if !c.configurator.Config().EnableInsightsAlerts {
if c.configurator.Config().DisableInsightsAlerts {
continue
}
if rule.Disabled {
Expand Down

0 comments on commit 2f490af

Please sign in to comment.