Closed SparkYuan closed 2 years ago
Kubernetes support 4 types of PATCH type:
application/json-patch+json
: JSON Patch,as defined in RFC6902
A JSON patch is a sequence of operations that are executed on the resource;
for example {"op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ]}
.application/merge-patch+json
: JSON Merge Patch, as defined in RFC7386.
A JSON Merge Patch is essentially a partial representation of the resource.
The submitted JSON is combined with the current resource to create a new one, then the new one is saved.application/apply-patch+yaml
: Server Side Apply YAML (a Kubernetes-specific extension, based on YAML).
All JSON documents are valid YAML, so you can also submit JSON using this media type.
See Server Side Apply serialization for more details.application/strategic-merge-patch+json
: JSON Merge Patch, as defined in RFC7386.
A JSON Merge Patch is essentially a partial representation of the resource.
The submitted JSON is combined with the current resource to create a new one, then the new one is saved.And application/strategic-merge-patch+json
only supports built-in types, not available to CRs.
kusion apply aims to support kinds of runtime. For kubernetes resources, we can try ServerSideApply first, or else back to JSON Merge Patch which is available to k8s and non k8s resources. Manifests for 3-way merge come from Modified(user specified this time), Original(applied last time, stored in kusion_state.json) and Current(live state in runtime).
we have a preview stage in kusion apply process, which can see the changed details differ with Modified and Original, now we can perform a 3-way diff among Modified/Original/Current.
prior
, plan
and live
configpredictable
configpredictable
to live
predictable
and live
dry-run
flag to get predictable result: #90
Enhancement
Ref: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/#how-apply-calculates-differences-and-merges-changes