Skip to content

Commit

Permalink
Correct pod watching in Taskrun controller
Browse files Browse the repository at this point in the history
Should use `cache.FilteringResourceEventHandler` rather than `cache.ResourceEventHandlerFuncs`.
The `pod` with incorrect owner will not go into the queue.
  • Loading branch information
vincent-pli authored and tekton-robot committed Sep 23, 2019
1 parent cd5b973 commit 04dfa5b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/reconciler/taskrun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"time"

"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
pipelineclient "github.com/tektoncd/pipeline/pkg/client/injection/client"
clustertaskinformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/clustertask"
resourceinformer "github.com/tektoncd/pipeline/pkg/client/injection/informers/pipeline/v1alpha1/pipelineresource"
Expand Down Expand Up @@ -84,10 +85,10 @@ func NewController(
})

c.tracker = tracker.New(impl.EnqueueKey, controller.GetTrackerLease(ctx))
podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: impl.EnqueueControllerOf,
UpdateFunc: controller.PassNew(impl.EnqueueControllerOf),
DeleteFunc: impl.EnqueueControllerOf,

podInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{
FilterFunc: controller.Filter(v1alpha1.SchemeGroupVersion.WithKind("TaskRun")),
Handler: controller.HandleAll(impl.EnqueueControllerOf),
})

// FIXME(vdemeester) it was never set
Expand Down

0 comments on commit 04dfa5b

Please sign in to comment.