-
Notifications
You must be signed in to change notification settings - Fork 40.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
Fix strategic patch for list of primitive type with merge sementic #35647
Fix strategic patch for list of primitive type with merge sementic #35647
Conversation
This change will break the current tests, since part of the format of the format has changed. |
Currently the old the client is able to talk to the new API server and the API server will behave the same when merging the patch. |
@k8s-bot ok to test |
@ymqytw Any idea why the tests failed? |
I guess something went wrong with the test-infra, since I found many tests were failing because of |
fd8ff44
to
43a6d7a
Compare
@k8s-bot test this |
Jenkins Kubemark GCE e2e failed for commit 01f0aa0e47c14c387c6bf74b9cea98287b33d05a. Full PR test history. The magic incantation to run this job again is |
01f0aa0
to
14b5d7d
Compare
Jenkins GCE e2e failed for commit 14b5d7d1d14d9d5c37f8d1de8c9802218a22b12e. Full PR test history. The magic incantation to run this job again is |
@ymqytw Let me know if I should take a look again |
14b5d7d
to
787f339
Compare
@smarterclayton If we encounter error when calling |
@smarterclayton WDYT of defaulting to the new patch version when we can't get the supported version from the server? Is it safe to require that all servers will support the same STMRG version? I am not sure if there is a perfect solution here and want to make sure we make a good set of tradeoffs. |
I'm ok with defaulting to the latest (if we are broken with the old way). On Wed, Nov 16, 2016 at 11:31 AM, Phillip Wittrock <notifications@github.com
|
…_fail Automatic merge from submit-queue Fix kubectl Stratigic Merge Patch compatibility As @smarterclayton pointed out in [comment1](#35647 (review)) and [comment2](#35647 (review)) in PR #35647, we cannot assume the API servers publish version and they shares the same version. This PR removes all the calls of GetServerSupportedSMPatchVersion(). Change the behavior of `apply` and `edit` to: Retrying with the old patch version, if the new version fails. Default other usage of SMPatch to the new version, since they don't update list of primitives. fixes #36916 cc: @pwittrock @smarterclayton
@pwittrock @ymqytw Sorry I didn't think about this very hard before. I don't like that the patch deviates from the schema of the resource. Among other things, that prevents us from using the schema validator on patches. Was a parallel list considered instead? Also, we need to update the existing SMP doc: And ideally we'd write a more complete user-facing version of that section. Also, I didn't have time to read the whole discussion, but I don't think it's valid to base any functionality on the release version. For instance, it's not clear to me that every use of Kubernetes source code is going to report the same release info. If we agree that this is the case, we need to document it in the api conventions. |
@bgrant0607 This part has been removed in #36916. In that PR, we change the behavior to: |
Thanks @ymqytw. Also, However, if we changed to parallel lists, we'd replace
We could write something like:
|
This makes sense to me @ymqytw given that the 1.5 cut date is fast approaching, what is your confidence that we could change the implementation to match @bgrant0607 's suggestion before the deadline? |
@pwittrock I can try to create a PR for review before thanksgiving. |
Sounds good. Otherwise we may need to consider rolling back the client changes. |
@pwittrock Is there a reason why we can't just rollback and try again in 1.6? What's blocked by this? |
With my proposed approach, I believe older apiservers would just ignore the additional directives, though we should confirm that is true. |
@ymqytw @pwittrock Please email sig-api-machinery to give them the opportunity to chime in before we merge the new approach. |
@bgrant0607 Nothing is blocked by this. The finalizers field in ObjectMeta were changed to use the a merge strategy, so this would be newly broken in 1.5. @caesarxuchao, I believe that you indicated that this was acceptable for 1.5 - would you confirm? If that is the case, rolling back the changes SGTM. |
Rolling back is fine. The garbage collector does NOT use patch to update the finalizers. |
@pwittrock I think we should try the new way in 1.6. It may be too risky to do that for 1.5. Since there is only 1 week left, because of the Thanksgiving holiday. |
Agreed |
Reverting related PRs in #37343. |
Not that we should necessarily copy them, but mongo does it this way: https://docs.mongodb.com/manual/reference/operator/update/pull/ (I think 'pull' is a silly name for this.) I do think $deleteFromStringList is overly specific, though. Perhaps 'primitive' instead of string? |
Fix strategic patch for list of primitive type when the patch strategy is
merge
.Before: we cannot replace or delete an item in a list of primitive, e.g. string, when the patch strategy is
merge
. It will always append new items to the list.This patch will generate a map to update the list of primitive type.
The server with this patch will accept either a new patch or an old patch.
The client will found out the APIserver version before generate the patch.
Fixes #35163, #32398
cc: @pwittrock @fabianofranz
This change is