Skip to content

Commit

Permalink
Adding owner for cronjob watch
Browse files Browse the repository at this point in the history
  • Loading branch information
johnugeorge committed May 31, 2019
1 parent 4e342cc commit df9f22c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controller/v1alpha2/trial/trial_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
}

// Watch for changes to Cronjob
err = c.Watch(&source.Kind{Type: &batchv1beta.CronJob{}}, &handler.EnqueueRequestForObject{})
err = c.Watch(
&source.Kind{Type: &batchv1beta.CronJob{}},
&handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &trialsv1alpha2.Trial{},
})

if err != nil {
log.Error(err, "CronJob watch error")
return err
Expand Down

0 comments on commit df9f22c

Please sign in to comment.