@@ -17,7 +17,7 @@ const queryString = `{{ reReplaceAll "%22" "%5C%22" (index .Alerts 0).GeneratorU
1717func configSecret (ctx * common.RenderContext ) ([]runtime.Object , error ) {
1818 var receivers []* config.Receiver
1919
20- receivers = append (receivers , criticalReceiver (ctx ))
20+ receivers = append (receivers , criticalReceivers (ctx )... )
2121 receivers = append (receivers , defaultReceivers (ctx )... )
2222 receivers = append (receivers , teamSlackReceivers (ctx )... )
2323 resolveTimeout , _ := model .ParseDuration ("5m" )
@@ -59,6 +59,16 @@ func configSecret(ctx *common.RenderContext) ([]runtime.Object, error) {
5959func routes (ctx * common.RenderContext ) []* config.Route {
6060 var routes []* config.Route
6161
62+ if ctx .Config .Alerting .IncidentIoURL != "" && ctx .Config .Alerting .IncidentIoAuthToken != "" {
63+ routes = append (routes , & config.Route {
64+ Receiver : "criticalReceiverIncidentIO" ,
65+ Match : map [string ]string {
66+ "severity" : "critical" ,
67+ },
68+ Continue : true ,
69+ })
70+ }
71+
6272 routes = append (routes , & config.Route {
6373 Receiver : "criticalReceiver" ,
6474 Match : map [string ]string {
@@ -114,9 +124,11 @@ func inhibitRules() []*config.InhibitRule {
114124 return inhibitRules
115125}
116126
117- func criticalReceiver (ctx * common.RenderContext ) * config.Receiver {
127+ func criticalReceivers (ctx * common.RenderContext ) []* config.Receiver {
128+ var receivers []* config.Receiver
129+
118130 if ctx .Config .Alerting .PagerDutyRoutingKey != "" {
119- return & config.Receiver {
131+ receivers = append ( receivers , & config.Receiver {
120132 Name : "criticalReceiver" ,
121133 PagerdutyConfigs : []* config.PagerdutyConfig {
122134 {
@@ -138,9 +150,28 @@ func criticalReceiver(ctx *common.RenderContext) *config.Receiver {
138150 },
139151 },
140152 },
141- }
142- } else {
143- return & config.Receiver {
153+ })
154+ }
155+
156+ if ctx .Config .Alerting .IncidentIoURL != "" && ctx .Config .Alerting .IncidentIoAuthToken != "" {
157+ receivers = append (receivers , & config.Receiver {
158+ Name : "criticalReceiverIncidentIO" ,
159+ WebhookConfigs : []* config.WebhookConfig {
160+ {
161+ VSendResolved : common .ToPointer (true ),
162+ URL : ctx .Config .Alerting .IncidentIoURL ,
163+ HTTPConfig : & config.HTTPClientConfig {
164+ Authorization : & config.Authorization {
165+ Credentials : ctx .Config .Alerting .IncidentIoAuthToken ,
166+ },
167+ },
168+ },
169+ },
170+ })
171+ }
172+
173+ if len (receivers ) == 0 {
174+ receivers = append (receivers , & config.Receiver {
144175 Name : "criticalReceiver" ,
145176 SlackConfigs : []* config.SlackConfig {
146177 {
@@ -158,8 +189,10 @@ func criticalReceiver(ctx *common.RenderContext) *config.Receiver {
158189 Actions : slackButtons (),
159190 },
160191 },
161- }
192+ })
162193 }
194+
195+ return receivers
163196}
164197
165198func defaultReceivers (ctx * common.RenderContext ) []* config.Receiver {
0 commit comments