-
Notifications
You must be signed in to change notification settings - Fork 719
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
Handle Operator Upgrades #479
Comments
I'll try to summarise a few things I've learned while working on the migration to CRD v1. Which does not answer this issue completely but may give a bit more context. CRD versioningAdding a new CRD versionAdding a new CRD version mostly consists in adding it to the supported In Kubernetes < 1.16, we can only specify a single OpenAPI validation that matches all CRD versions. In Kubernetes 1.16 and above, we can specify the OpenAPI validation per version. Cf. #2044 (comment). Version conversionsIn theory all CRD versions with In the operator code, we only use a single version (the last one), retrieved through the mechanism above (conversion webhook or no-op conversion). Any update on that resource from the operator (including an update with no payload change) automatically changes the stored version of the resource to the updated one. Deprecating a versionRemoving support for a particular version can be done by:
Owner referencesOwner references set on some resources (eg. Secrets) may reference resources with an old apiVersion (eg. Dealing with breaking changes in CRD versionsLet's imagine we introduce crd
When using conversion webhooks is a valid option, the conversion from v1 to v2 and v2 to v1 can be handled by the webhook directly. Additional information of v2 when converting to v1 could technically be stored in annotations, to be retrieved during the v1 -> v2 conversion. When webhooks are not available, things get much more complicated. I don't see an easy way to handle conversions, except tracking the latest stored version in an annotation of the resource so the operator knows there might be a mismatch. Another way to deal with breaking changes could also be to simply stop serving the old version:
If the operator has RBAC access to the CRD kind, steps 2 to 5 could be done by the new version of the operator itself at startup. Upgrading the operatorIt's as simple as applying the newest operator manifest so it replaces the existing one. We currently deploy the operator with a StatefulSet, to ensure both versions are not running at the same time. If we need to deal with breaking changes, we may decide to ignore any resource created with an old version of the operator, using the mechanism already in place. Thoughts and questions
|
I think this is ready to close but it would be maybe worth capturing this summary somewhere else (ADR?) so that we can don't bury this. |
The text was updated successfully, but these errors were encountered: