Skip to content

Commit c46c11b

Browse files
huikangHui Kang
andauthored
docs: clarify the service in notificatioin.md (argoproj#1546)
- template and trigger should be included in the argo-rollouts-notification-configmap - add debug message for missing notification message Signed-off-by: Hui Kang <[email protected]> Co-authored-by: Hui Kang <[email protected]>
1 parent 26433be commit c46c11b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/features/notifications.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ kind: ConfigMap
3535
metadata:
3636
name: argo-rollouts-notification-configmap
3737
data:
38+
# detail of the templates is omitted
39+
# detail of the triggers is omitted
3840
service.slack: |
3941
token: $slack-token
4042
---
@@ -124,7 +126,7 @@ when rollout pod spec uses `argoproj/rollouts-demo:purple` image:
124126
apiVersion: v1
125127
kind: ConfigMap
126128
metadata:
127-
name: argocd-notifications-cm
129+
name: argo-rollouts-notification-configmap
128130
data:
129131
trigger.on-purple: |
130132
- send: [my-purple-template]

utils/record/record.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,15 @@ func NewAPIFactorySettings() api.Settings {
167167

168168
// Send notifications for triggered event if user is subscribed
169169
func (e *EventRecorderAdapter) sendNotifications(object runtime.Object, opts EventOptions) error {
170+
logCtx := logutil.WithObject(object)
170171
subsFromAnnotations := subscriptions.Annotations(object.(metav1.Object).GetAnnotations())
171172
destByTrigger := subsFromAnnotations.GetDestinations(nil, map[string][]string{})
172173

173174
trigger := translateReasonToTrigger(opts.EventReason)
174175

175176
destinations := destByTrigger[trigger]
176177
if len(destinations) == 0 {
178+
logCtx.Debugf("No configured destinations for trigger: %s", trigger)
177179
return nil
178180
}
179181

@@ -185,6 +187,7 @@ func (e *EventRecorderAdapter) sendNotifications(object runtime.Object, opts Eve
185187
// Creates config for notifications for built-in triggers
186188
triggerActions, ok := notificationsAPI.GetConfig().Triggers[trigger]
187189
if !ok {
190+
logCtx.Debugf("No configured template for trigger: %s", trigger)
188191
return nil
189192
}
190193

0 commit comments

Comments
 (0)