-
Notifications
You must be signed in to change notification settings - Fork 347
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
operator: option to limit CRs the operator should handle #1943
Comments
Ideally, these labels should be taken into account by the controller-runtime informer that watches for Integration resources, to filter sever-side, so that the corresponding operator does not filter client-side and cache the out-of-scope Integrations, so that the solution scales nicely. |
It seems like server-side filtering is not yet possible with controller-runtime: kubernetes-sigs/controller-runtime#244. We can go for a client-side predicate in the meantime. |
One of the use case where is feature can be useful is to implement "rolling upgrade" of the camel-k operator where you have multiple running version of the camel-k operator and you want to move integrations from one operator to the another by steps. The simplest approach is to change the label i.e. from @astefanutti @nicolaferraro what do you think ? |
Right. As we are introducing a mechanism where multiple operators can concurrently manage the same resources, a locking mechanism is necessary. More generally to the rolling upgrade use-case, that mechanism would make sure that only a single operator manages the same resource at a single point in time. That would prevent issues where the label selectors for multiple operators intersect. Now on how to implement that locking mechanism, I think we could reuse the approach used for locking by multiple replicas of the same operator, that is with a Lease resource, but owned by the Integration. The Lease resource seems the preferred mechanism (by client-go and controller-runtime), and handle use cases such as renewing and deadlining nicely. It would also be an extension of the locking implementation already in place for managing HA of the operator replicas. |
Is the |
+1 on the lease resource for managing locks. |
@astefanutti we should also take into account the |
Right, scoping IntegrationPlatform should be supported in addition to scoping Integration. actually, I think scoping must be implemented for any kind of resources being watched / managed by the operator, like IntegrationKit, Build, ... Even for environments that do not leverage the builder, I think it makes sense to implement a generic scoping mechanism. |
Selectors support has been added to k8s informers into the latest version of controller-runtime: kubernetes-sigs/controller-runtime#1435. |
We should be able to restrict what CRs a camel-k operator should handle, as example, we can add a label like
camel.apache.org/operator.id
to each CR:The
operator.id
should also be used to acquire the operator lock.Note:
The text was updated successfully, but these errors were encountered: