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

Enforce immutable fields using CEL rules #4128

Open
Tracked by #3957
negz opened this issue May 30, 2023 · 5 comments · Fixed by #5682
Open
Tracked by #3957

Enforce immutable fields using CEL rules #4128

negz opened this issue May 30, 2023 · 5 comments · Fixed by #5682
Assignees
Labels
enhancement New feature or request user experience

Comments

@negz
Copy link
Member

negz commented May 30, 2023

What problem are you facing?

Many Crossplane API fields are immutable - you can't change them after they're first set. Typically today when a field is immutable we'll let you update it, and will just silently ignore the update. This is obviously a terrible user experience.

We've wanted to be able to enforce immutability at the schema level for a long time, but until recently doing so was pretty involved. You essentially had to write a webhook (e.g. #727) for every type to enforce immutability.

Now with CEL and kubebuilder it's possible to do this much more conveniently with comment markers - see https://kubernetes.io/blog/2022/09/29/enforce-immutability-using-cel/. Once these comment markers are added any API server that supports CEL will reject updates to immutable fields.

How could Crossplane help solve your problem?

We should use CEL-based immutability.

In many cases we've already added // +immutable comment markers on fields we know are immutable. These comment markers don't do anything - they're just placeholders and should be replaced with CEL ones.

Copy link

github-actions bot commented Jan 8, 2024

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

@github-actions github-actions bot added the stale label Jan 8, 2024
@negz
Copy link
Member Author

negz commented Jan 8, 2024

/fresh

@github-actions github-actions bot removed the stale label Jan 8, 2024
@jbw976 jbw976 removed this from the v1.15 milestone Jan 24, 2024
Copy link

Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

@github-actions github-actions bot added the stale label Apr 23, 2024
@bobh66
Copy link
Contributor

bobh66 commented Apr 23, 2024

/fresh

@github-actions github-actions bot removed the stale label Apr 23, 2024
@jbw976 jbw976 added the good first issue Good for newcomers label Apr 26, 2024
@negz negz reopened this May 29, 2024
@negz negz removed the good first issue Good for newcomers label May 29, 2024
@negz
Copy link
Member Author

negz commented May 29, 2024

Reopening this and removing the good first issue tag. @NeerajNagure got the ball rolling in #5682, but I think we need to do a more thorough scan for immutable fields and replicate the pattern there. This will probably require someone familiar enough with Crossplane APIs to know what should and shouldn't be mutable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request user experience
Projects
Status: Backlog
5 participants