-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
CreateOrUpdate ergonomics in presence of defaults #2733
Comments
Hmm, this has to be false: if my client is older than the server, I will not see new fields at all. So at least this is not an issue. Point 3 (changing defaults) is probably a rare case. Now I'm just curious how much of a problem point 1 (older servers) is. In any case, this stuff could use a lot of documentation. |
This does not work in my testing :( I guess I'm stuck with carefully updating only the fields I need set. |
Hi folks.
I'm working on an operator that, absolutely unsurprisingly, creates deployments. Following what seems to be the good controller style, I tried using CreateOrUpdate in roughly this way (simplified):
As you can guess from the title, this naive approach does not actually work. Because there are certain defaults in the schema (e.g.
ImagePullPolicy
), the deep comparison insideCreateOrUpdate
always fails, and my controller gets stuck in an infinite reconcile loop trying to update the "defaulted" fields to their empty values.What is a possible way out of this problem?
I've seen this solution mentioned on stackoverflow, but I see a large problem here. The local copy of Kubernetes code may not match the server side causing one of three issues:
The only possible solution I can imaging is to run comparison on copies with defaults applied. So, change
CreateOrUpdate
to something likebut obviously
Schema
nowNo idea if this issue even has solutions but recording it here for any potential ideas.
The text was updated successfully, but these errors were encountered: