-
Notifications
You must be signed in to change notification settings - Fork 423
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Milestone
Description
Describe the bug
When the replication for CachedResources writes the objects to cache, they only contain PartialObjectMetadata instead of full objects.
Steps To Reproduce
- Create a ConfigMap and a CachedResource for it:
apiVersion: v1 kind: ConfigMap metadata: name: hello-green labels: color: green data: hello: world --- apiVersion: cache.kcp.io/v1alpha1 kind: CachedResource metadata: name: hello-cache-green spec: group: "" version: v1 resource: configmaps labelSelector: matchLabels: color: green
- Read the object from the cache with a cache client, observe it contains metadata.
Expected Behaviour
The cached objects should be replicated fully.
Additional Context
This is happening because the replication controller for CachedResources gets its data from DiscoveringDynamicSharedInformerFactory which is instantiated with a metadata client.
Lines 155 to 175 in 802765f
| metadataClusterClient, err := metadataclient.NewDynamicMetadataClusterClientForConfig( | |
| rest.AddUserAgent(rest.CopyConfig(s.MiniAggregator.GenericAPIServer.LoopbackClientConfig), "kcp-partial-metadata-informers")) | |
| if err != nil { | |
| return nil, err | |
| } | |
| crdGVRSource, err := informer.NewCRDGVRSource(s.ApiExtensionsSharedInformerFactory.Apiextensions().V1().CustomResourceDefinitions().Informer()) | |
| if err != nil { | |
| return nil, err | |
| } | |
| s.DiscoveringDynamicSharedInformerFactory, err = informer.NewDiscoveringDynamicSharedInformerFactory( | |
| metadataClusterClient, | |
| func(obj interface{}) bool { return true }, | |
| nil, | |
| crdGVRSource, | |
| cache.Indexers{}, | |
| ) | |
| if err != nil { | |
| return nil, err | |
| } |
Normally, this would be okay because DiscoveringDynamicSharedInformerFactory is heavy and metadata is usually sufficient for where this factory is being used at the moment. In context of replication this is however not enough and we need full objects, with a real dynamic client that doesn't strip objects.
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Type
Projects
Status
New