Skip to content

Commit

Permalink
added filtered informer for containersource service accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
yijie-04 committed Jan 12, 2024
1 parent c365d4a commit 7d73360
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/reconciler/containersource/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"knative.dev/pkg/system"

"knative.dev/eventing/pkg/apis/feature"
"knative.dev/eventing/pkg/apis/sources"
v1 "knative.dev/eventing/pkg/apis/sources/v1"
eventingclient "knative.dev/eventing/pkg/client/injection/client"
containersourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1/containersource"
Expand All @@ -34,7 +35,7 @@ import (

kubeclient "knative.dev/pkg/client/injection/kube/client"
deploymentinformer "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment"
serviceaccountinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount"
serviceaccountinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount/filtered"
"knative.dev/pkg/configmap"
"knative.dev/pkg/controller"
"knative.dev/pkg/logging"
Expand All @@ -51,7 +52,7 @@ func NewController(
containersourceInformer := containersourceinformer.Get(ctx)
sinkbindingInformer := sinkbindinginformer.Get(ctx)
deploymentInformer := deploymentinformer.Get(ctx)
serviceaccountInformer := serviceaccountinformer.Get(ctx)
serviceaccountInformer := serviceaccountinformer.Get(ctx, sources.OIDCTokenRoleLabelSelector)
trustBundleConfigMapInformer := configmapinformer.Get(ctx, eventingtls.TrustBundleLabelSelector)

var globalResync func(obj interface{})
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconciler/containersource/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
"knative.dev/pkg/configmap"
. "knative.dev/pkg/reconciler/testing"
"knative.dev/eventing/pkg/apis/sources"

// Fake injection informers
_ "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment/fake"
Expand Down Expand Up @@ -56,6 +57,6 @@ func TestNew(t *testing.T) {
}

func SetUpInformerSelector(ctx context.Context) context.Context {
ctx = filteredFactory.WithSelectors(ctx, eventingtls.TrustBundleLabelSelector)
ctx = filteredFactory.WithSelectors(ctx, sources.OIDCTokenRoleLabelSelector, eventingtls.TrustBundleLabelSelector)
return ctx
}

0 comments on commit 7d73360

Please sign in to comment.