-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Informer creation behavior for custom resource with CRDContext in SharedInformerFactory #2746
Informer creation behavior for custom resource with CRDContext in SharedInformerFactory #2746
Comments
@LukaTchumburidze: Hi, Would it be possible for you to share contents for |
Bdw, these methods accepting But I still see a way to provide different versions by providing an Line 309 in 24a5fae
SharedIndexInformer<Bicycle> bicycleV1Informer = informerFactory.sharedIndexInformerForCustomResource(Bicycle.class, resyncPeriodMillis);
SharedIndexInformer<Bicycle> bicycleV1beta1Informer = informerFactory.sharedIndexInformerForCustomResource(Bicycle.class, new OperationContext().withApiGroupVersion("v1beta1"), resyncPeriodMillis);
bicycleV1beta1Informer.addEventHandler(new GenericResourceHandler<>("v1beta1-bicycle"));
bicycleV1Informer.addEventHandler(new GenericResourceHandler<>("v1-bicycle")); Moreover having SharedIndexInformer<Pod> podInDefaultNamespaceInformer = informerFactory.inNamespace("default")
.sharedIndexInformerFor(Pod.class, resyncPeriodMillis);
SharedIndexInformer<Pod> podInKubePublicNamespaceInformer = informerFactory.inNamespace("kube-system")
.sharedIndexInformerFor(Pod.class, resyncPeriodMillis); // Overwrites previous entry I admit key should not be |
@rohanKanojia Since kubernetes-client's approach with CRDs has changed much during these months you're right that my example is obsolete.
Currently factory does not support several |
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. Since OperationContext is unique for all requests, it should be used as key parameter instead.
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
… as key SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
SharedInformerFactory has `informers` and `startedInformers` Map fields which use `Type` as key. This limits us to use only one SharedIndexInformer corresponding to a particular type. We should make a key based on OperationContext's elements like apigroup, apiversion, namespace, name, labels, fields etc.
Relates to: #2010 |
The factory has a method sharedIndexInformerForCustomResource to create an informer with a CRDContext for CRs. It's is using sharedInformerFor to register the informer inside the factory object. This causes a problem when registering new informers using several different CRDContexts, but using same set of classes (extending CustomResource and CustomResourceList). Case will result in creation of several informers, but registering only the one which is has been created the latest (since factory's internal map uses only classname as key).
Example:
As I have said
lostIndexInformer
will be rewritten by the time we reach tostartAllRegisteredInformers
. I don't think this is the right behavior, since idea of passing the different CRDContexts to factory methods means that several informers should be registered and that they should operate on different CRs which has been described in CRDContext.The text was updated successfully, but these errors were encountered: