-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
kubectl docs: explanation json patch, strategic merge $patch directives #47624
Conversation
|
✅ Pull request preview available for checkingBuilt without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
* Link to the specification of strategic merge patches * More clealy explain the difference between a json (json patch) and merge (json merge) patch * add an example of a json patch, including selection of a container in an array and a test for the container name * mention using json patch to append to args, volumes, volumeMounts etc * mention $patch strategic merge directives
Unknown CLA label state. Rechecking for CLA labels. Send feedback to sig-contributor-experience at kubernetes/community. /check-cla |
You'll need to sign the CLA before we can review your changes, but you might like to check out https://kubernetes.io/docs/reference/using-api/api-concepts/#patch-and-apply and see if you want to also update that page, or maybe to direct readers to look there. |
@sftim Thanks very much. The more I got into this the worse it got - I don't think I can do justice to untangling all the confusion and outdated or incomplete info in the relevant docs regarding the patch types, server-side apply, etc. I can't clearly figure out for example if strategic merge patch directives are still supported with I'll look at the ref you provided, and see if I can tidy this docs change up to be a minimal update that doesn't go too deep into the weeds. I'm currently stuck waiting for my org to eventually appoint a CLA manager so I can sign the CLA, which is taking forever. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
abandoning |
Description
When learning k8s I found myself confused by the difference between
json
andmerge
patch types, usage of$patch
strategic merge directives.It's very confusing for new (and not so new) users that
merge
is the name for the RFC7386 JSON merge patch ("dumb" structural merge),json
is the name for the RFC6902 json patch patch (array of operations), andstrategic
is the name for the strategic merge patch. And all of them can be in yaml...Then there's server-side apply, which may act like a patch rather than replace in the presence of multiple resource managers.
Draft to expand the kubectl
patch
(and soon,apply
) guidance a bit to:$patch
directives for overriding the merge strategy in strategic merge patchesThis is draft, because I'm still not 100% sure myself of the rules surrounding server-side vs client-side patching and strategic merge patches so I have some more tests to write before proposing for merge. The current documentation is very confusing - server-side-apply is actually used for both
patch
andapply --server-side
operations, butpatch
can accept json / merge / strategic formats, etc. I will seek to further refine my changes until they clearly explain how exactly k8s applies changes in different modes, and update further.TODO
$patch
directivesdelete
,replace
,merge
,$retainKeys
directive,$deleteFromPrimitiveList
directive,$setElementOrder
directive still relevant forkubectl patch --type strategic
and if not, are there equivalent ways to specify with the input patchkubectl patch
andkubectl apply
Issue