Skip to content

Commit

Permalink
fixes send_resolved option for alertmanager config
Browse files Browse the repository at this point in the history
  • Loading branch information
f41gh7 committed Nov 9, 2021
1 parent 7806ff9 commit 6ee7505
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/factory/alertmanager/config.go
Expand Up @@ -557,6 +557,9 @@ func (cb *configBuilder) buildPagerDuty(pd operatorv1beta1.PagerDutyConfig) erro
toYaml("client", pd.Client)
toYaml("class", pd.Class)
toYaml("component", pd.Component)
if pd.SendResolved != nil {
temp = append(temp, yaml.MapItem{Key: "send_resolved", Value: *pd.SendResolved})
}
cb.currentYaml = append(cb.currentYaml, temp)
return nil
}
Expand Down Expand Up @@ -600,10 +603,14 @@ func (cb *configBuilder) buildEmail(email operatorv1beta1.EmailConfig) error {
toYamlString("auth_username", email.AuthUsername)
toYamlString("hello", email.Hello)
toYamlString("smarthost", email.Smarthost)
if email.SendResolved != nil {
temp = append(temp, yaml.MapItem{Key: "send_resolved", Value: *email.SendResolved})
}

cb.currentYaml = append(cb.currentYaml, temp)
return nil
}

func (cb *configBuilder) buildOpsGenie(og operatorv1beta1.OpsGenieConfig) error {
var temp yaml.MapSlice
toYamlString := func(key string, value string) {
Expand Down
2 changes: 2 additions & 0 deletions controllers/factory/alertmanager/config_test.go
Expand Up @@ -80,6 +80,7 @@ receivers:
from: some-sender
text: some-text
to: some-dst
send_resolved: true
templates: []
`,
},
Expand Down Expand Up @@ -213,6 +214,7 @@ receivers:
from: some-sender
text: some-text
to: some-dst
send_resolved: true
- name: default-base-webhook
webhook_configs:
- url: http://some-wh
Expand Down

0 comments on commit 6ee7505

Please sign in to comment.