1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-18 00:08:17 +00:00

Add an attribute observedgeneration (#714)

* Add an attribute observedgeneration

* add unit tests
This commit is contained in:
Sakala Venkata Krishna Rohit
2025-08-07 10:30:06 -07:00
committed by GitHub
parent a020084518
commit 6946ffe8aa
9 changed files with 137 additions and 21 deletions

View File

@@ -52,7 +52,7 @@ type clusterCache struct {
sync.RWMutex
ctx context.Context
summaryClient client.Interface
summaryClient client.ExtendedInterface
watchers map[schema2.GroupVersionKind]*watcher
workqueue workqueue.DelayingInterface
@@ -64,7 +64,7 @@ type clusterCache struct {
func NewClusterCache(ctx context.Context, dynamicClient dynamic.Interface) ClusterCache {
c := &clusterCache{
ctx: ctx,
summaryClient: client.NewForDynamicClient(dynamicClient),
summaryClient: client.NewForExtendedDynamicClient(dynamicClient),
watchers: map[schema2.GroupVersionKind]*watcher{},
workqueue: workqueue.NewNamedDelayingQueue("cluster-cache"),
}
@@ -147,7 +147,10 @@ func (h *clusterCache) OnSchemas(schemas *schema.Collection) error {
continue
}
summaryInformer := informer.NewFilteredSummaryInformer(h.summaryClient, gvr, metav1.NamespaceAll, 2*time.Hour,
opts := &client.Options{
Schema: schema.Schema,
}
summaryInformer := informer.NewFilteredSummaryInformerWithOptions(h.summaryClient, gvr, opts, metav1.NamespaceAll, 2*time.Hour,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, nil)
ctx, cancel := context.WithCancel(h.ctx)
w := &watcher{