-
Notifications
You must be signed in to change notification settings - Fork 7
feat(validation-gen): Add +k8s:immutable and +k8s:frozen tags with KEP update semantics #103
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
feat(validation-gen): Add +k8s:immutable and +k8s:frozen tags with KEP update semantics #103
Conversation
34c032d to
1413c63
Compare
1413c63 to
5e75cbb
Compare
52318b5 to
9b2f79f
Compare
9b2f79f to
d4f8522
Compare
|
/hold I want to look at this again. I don't love the name and "immutable" is already the tag we use today. |
|
From the cited use-case: Is this |
| {"string nil to empty", nil, ptr.To("")}, | ||
| {"string nil to value", nil, ptr.To("hello")}, | ||
| {"string empty to value", ptr.To(""), ptr.To("hello")}, | ||
| {"string value to empty", ptr.To("hello"), ptr.To("")}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also "string value to nil" ?
I am expecting us to retain the field wiping we already have to prevent changes to While I don't love field how field wiping is implemented today, it feels like something we can improve post-declarative validation. |
|
I expanded on my concerns in: #63 (comment)
So what do we want to say in validation? We could say nothing and just do the validation (including ratcheting) which is what a lot of handwritten code does. Field wiping will ensure that it's a no-op. We could say that all of the status field is We could instead say "spec is part of subresource==/" and "status is part of subresource==/status" and emit the immutability check (describing the data more than the validation). |
I'm in favor of the latter: annotating which stanzas/fields are "writable" via which resources/subresources. Part of the problem here is that field wiping is mechanically different that validation. Today, field wiping tolerates a write to /status that includes changes spec values (with invalid values, even), because the field wiping resets the values of the spec fields before validating. We can't change that behavior because it would be breaking. Long term, I'd really like to get to the point where we drive the field wiping declarative from something that (very roughly) looks like: The tags need to somehow convey that these stanzas are "part" of the resource/subresource for field wiping purposes. I'm struggling a bit in how to make this semantic visually distinct from a validation rule. |
100% agree - describe the schema in tags and drive field wiping from that - one step closer to IDL. This is not bad (though the args grammar doesn't allow it since we require named args for n>1, and we don't have a list syntax. it could just be; ...because we do support multiple values for tags, right? Need to handle carve-outs like pod resources which are in multiple subresources with different validations. This notation feels achievable, without not driving the wiping behavior (yet). It would mean this notation and wiping would be redundant, but that's part of introducing DV overall. If wiping works, validation will never see an actual change in value anyway? |
Yes, sorry. I threw those tag examples up really quick without any thought to grammar. Repeating the tag for multiple resources/subresources SGTM.
Exactly. And my intuition is that ratcheting should make it sufficiently safe/cheap to validate unchanged data that we don't urgently need to optimize further. |
|
From discussions in #63, the +k8s:frozen tag and +k8s:immutable semantics presented in this PR are no longer the desired syntax here. Closing |
PR Changes
More semantics:
pointers
non-pointers
CSR Example Usage For v1.34