Skip to content
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

add a proposal for CRD conversion webhook #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MariamFahmy98
Copy link
Contributor

No description provided.

Kyverno CRDs `v1` contain many deprecated fields that require removal. Additionally, there are fields at the `spec` level that are only specific to certain rules and not others. Therefore, we would like to introduce a more stable version, `v2`. Since `v1` and `v2` will have different schema, a conversion webhook is required to convert between them.

## Proposal
In Kubernetes, it is essential that all versions are compatible with each other. This means that if we go from `v1` to `v2` and then back to `v1`, we must not lose any information. Therefore, any changes we make to our API must be compatible with `v1`, and we must ensure that anything we add in `v2` is also supported in `v1`. This requires us to add new fields to `v1` to support any new additions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires us to add new fields to v1 to support any new additions.

I don't quite understand this, isn't it possible for us to use an annotation (as stated in solution 2.) also on the V1 object? So if something is only available in v2, it gets written to an annotation in v1 and then we don't lose data. Maybe I am missing something why this wouldn't work.

Copy link
Contributor Author

@MariamFahmy98 MariamFahmy98 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can do that.


Note that multiple versions may exist in storage if they were written before the storage version changes – changing the storage version only affects how objects are created/updated after the change.

## Implementation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think implementation is the most important thing to clarify here. The two standouts to me are:

  1. Testing of the conversion
  2. Deployment of the CRDs with the webhook included in helm (size limitation issues + templating necessity)

I think the proposal here might change slightly when implementation plans become more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants