operator-framework / operator-lifecycle-manager

A management framework for extending Kubernetes with Operators
https://olm.operatorframework.io
Apache License 2.0
1.7k stars 542 forks source link

[RFE] Decouple APIs from Controllers #1837

Open Jamstah opened 3 years ago

Jamstah commented 3 years ago

Is your feature request related to a problem? Please describe.

Operator permissions and the ability for operators to affect cluster scoped resources are a problem within the operator space. At the moment, operator bundles include both APIs (which are always a cluster scoped resource) and Controllers (which are potentially namespace scoped), but the problem of running the same operator in different namespaces, especially at different versions, is hard.

Lets assume we have a Foo operator with two versions:

If version 3.0.0 is installed in one namespace, followed by 2.0.0 in another namespace, what happens to the installed CRD and web hook? How does OLM decide which one is correct? If 3.0.0 is removed, what does OLM do? Remove the CRD? Replace the CRD with an older version and webhook? How is this managed?

Operator developers also have a hard job to do in managing API versions and compatibility. This complexity is somewhat glossed over by CRDs being included within the same bundle as the controller, as there is the implication that the CRD can be changed easily along with the controller, when in reality the API interface should be managed very carefully and with as much stability as possible to ensure that 3rd parties can use the API.

Describe the solution you'd like

Decouple APIs and Controllers by introducing two new bundle types (potentially with an annotation such as operators.operatorframework.io.bundle.mediatype.v1) that OLM can manage in a decoupled way.

API Bundles

API bundles would always be cluster scoped. Controller bundles would depend on them by depending on a specific API version that it will then manage.

OLM responsibilities:

The API bundle would include the conversion webhook, which can be configured by OLM.

Additional restrictions could be added to API bundles:

Controller bundles

Controller bundles would be similar to existing operator bundles with the following changes:

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.