-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix #4136: adding support for fieldValidation #4524
Conversation
There's no integration test yet as the feature is gated. |
The gate is enabled by default in K8s 1.25.
An IT can be added with the appropriate |
String parameterValue; | ||
|
||
private Validation() { | ||
this.parameterValue = this.name().charAt(0) + this.name().toLowerCase().substring(1); |
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.
It would probably make this more readable by providing this statically:
WARN("Warn"),
//...
private Validation(String parameterValue) {
//...
Sure, I just hadn't seen that it was enabled yet in 1.25. I can add something if you like. |
🙏 That'd be nice, it can be used as a reference on how to use the new feature too. |
SonarCloud Quality Gate failed. |
Description
Fixes #4136 with general support for field validation. This is mostly of interest for users who could be dealing with multiple versions, or manually constructing generic resources, or manually constructing patches. As long as you are using the typed api that matches the server version and not setting additionalProperties - all fields should be valid.
Part of the motivation here is just to see what level of effort it would take to move more of the PatchContext to dsl methods as we move towards #3896 to add a dsl method for apply. One issue that we'll have - unless we further refine the interfaces - is that there will be a conflict between the context dsl methods and the context passed in. In some places we consider the dsl forcing - such as when you perform a watch and pass in ListOptions. Here I'm assuming that the passed in context trumps the dsl methods - https://github.com/fabric8io/kubernetes-client/compare/master...shawkins:4136?expand=1#diff-628edeb9a79ef1b9f8a55c24437fad0e1a5b8aa34887214e948524c6811cc1dbL226
Beyond this kubectl allows you to set the fieldManager and force conflicts, so this could fully look like:
In general the fieldManager forceConflicts only applies to serverSideApply, so only the serverSideApply would be available after those calls.
vs
Thoughts?
Type of change
test, version modification, documentation, etc.)
Checklist