21 ms·
The Kubernetes API implements patch correctly FWIW. Patching objects in k8s is advisable where possible instead of replacing as it allows the control plane to g
by ojhughes 5y ago
The Kubernetes API implements patch correctly FWIW. Patching objects in k8s is advisable where possible instead of replacing as it allows the control plane to gracefully update the resources (without downtime).
https://blog.atomist.com/kubernetes-apply-replace-patch/ https://blog.atomist.com/kubernetes-apply-replace-patch/
- mleonhard 5y agoI found nothing in the docs [0, 1] about downtime due to Replace or Patch. Both commands change the spec. Downtime from a spec change seems to be unrelated to the manner of changing the spec. The standard way to implement optimistic concurrency with HTTP REST APIs is using the If-Match header [2]. The Kubernetes authors chose to use a 'resourceVersion' query parameter instead [0]. Kubernetes Team decided to implement *three* different kinds of patches: JSON patch, JSON merge patch, and strategic merge patch. Kubernetes Team also chose to put 1,500 pages of docs on a single page, making searching extremely difficult or impossible. Bazel team [3] and Flutter team [4] also make their docs difficult to search. Kubernete's Patch implementation may be technically correct, but it has a lot of usability problems, which translate into wasted engineering effort maintaining integrations with it. [0] https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.21/#resource-operations-update https://kubernetes.io/docs/reference/generated/kubernetes-ap... [1] https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/ https://kubernetes.io/docs/tasks/manage-kubernetes-objects/u... [2] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If... [3] https://docs.bazel.build/versions/main/command-line-reference.html https://docs.bazel.build/versions/main/command-line-referenc... [4] https://github.com/flutter/flutter/issues/80849 https://github.com/flutter/flutter/issues/80849