Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: zachaller <[email protected]>
  • Loading branch information
zachaller committed Jul 17, 2023
1 parent 8108bb8 commit b363086
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rollout/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,15 @@ func NewController(cfg ControllerConfig) *Controller {
AddFunc: func(obj interface{}) {
controller.enqueueRollout(obj)
ro := unstructuredutil.ObjectToRollout(obj)
if ro != nil && cfg.Recorder != nil {
cfg.Recorder.Eventf(ro, record.EventOptions{
EventType: corev1.EventTypeNormal,
EventReason: conditions.RolloutAddedToInformerReason,
}, "Rollout resource added to informer: %s/%s", ro.Namespace, ro.Name)
} else {
log.Warnf("Malformed rollout resource added to informer")
if ro != nil {
if cfg.Recorder != nil {
cfg.Recorder.Eventf(ro, record.EventOptions{
EventType: corev1.EventTypeNormal,
EventReason: conditions.RolloutAddedToInformerReason,
}, "Rollout resource added to informer: %s/%s", ro.Namespace, ro.Name)
} else {
log.Warnf("Recorder is not configured")
}
}
},
UpdateFunc: func(old, new interface{}) {
Expand Down

0 comments on commit b363086

Please sign in to comment.