diff --git a/README.md b/README.md index e785abdd77..384659c475 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Go Report Card](https://goreportcard.com/badge/sigs.k8s.io/controller-runtime)](https://goreportcard.com/report/sigs.k8s.io/controller-runtime) [![godoc](https://pkg.go.dev/badge/sigs.k8s.io/controller-runtime)](https://pkg.go.dev/sigs.k8s.io/controller-runtime) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcp-dev%2Fcontroller-runtime.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcp-dev%2Fcontroller-runtime?ref=badge_shield) # Kubernetes controller-runtime Project @@ -64,3 +65,7 @@ Before starting any work, please either comment on an existing issue, or file a ## Code of conduct Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md). + + +## License +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkcp-dev%2Fcontroller-runtime.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fkcp-dev%2Fcontroller-runtime?ref=badge_large) \ No newline at end of file diff --git a/pkg/kcp/wrappers.go b/pkg/kcp/wrappers.go index 570947950b..2e173ccbc6 100644 --- a/pkg/kcp/wrappers.go +++ b/pkg/kcp/wrappers.go @@ -21,8 +21,10 @@ import ( "net/http" "regexp" "strings" + "time" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/rest" k8scache "k8s.io/client-go/tools/cache" @@ -67,12 +69,14 @@ func NewClusterAwareManager(cfg *rest.Config, options ctrl.Options) (manager.Man func NewClusterAwareCache(config *rest.Config, opts cache.Options) (cache.Cache, error) { c := rest.CopyConfig(config) c.Host += "/clusters/*" - opts.NewInformerFunc = informers.NewSharedIndexInformer - opts.Indexers = k8scache.Indexers{ - kcpcache.ClusterIndexName: kcpcache.ClusterIndexFunc, - kcpcache.ClusterAndNamespaceIndexName: kcpcache.ClusterAndNamespaceIndexFunc, + opts.NewInformerFunc = func(lw k8scache.ListerWatcher, obj runtime.Object, syncPeriod time.Duration, indexers k8scache.Indexers) kcpcache.ScopeableSharedIndexInformer { + indexers[kcpcache.ClusterIndexName] = kcpcache.ClusterIndexFunc + indexers[kcpcache.ClusterAndNamespaceIndexName] = kcpcache.ClusterAndNamespaceIndexFunc + + return informers.NewSharedIndexInformer(lw, obj, syncPeriod, indexers) } + return cache.New(c, opts) }