The Go strategic-merge-patch reference is the source of truth for algorithmic
parity. The files under k8s.io-apimachinery/strategicpatch/ are a
read-only snapshot of the upstream package at a pinned commit (recorded in
PINNED_COMMIT). They are never compiled or executed in this
repo — they exist solely as documentation we port from.
Everything in k8s.io-apimachinery/ retains the upstream Apache-2.0 license
(see the original repository for the LICENSE file).
When bumping the pin:
-
Pick the new tag, e.g.
v0.37.0. -
Resolve to its commit SHA (annotated tags require dereferencing):
gh api repos/kubernetes/apimachinery/git/refs/tags/v0.37.0 --jq .object.sha \ | xargs -I{} gh api repos/kubernetes/apimachinery/git/tags/{} --jq .object.sha -
Re-fetch the package files at that SHA:
commit=<sha> for f in OWNERS errors.go meta.go patch.go patch_test.go types.go; do curl -sf "https://raw.githubusercontent.com/kubernetes/apimachinery/$commit/pkg/util/strategicpatch/$f" \ -o "reference/k8s.io-apimachinery/strategicpatch/$f" done
-
git diffthe result. Any new test cases added upstream get ported into the C# corpus (tagged with[TestCategory("go:OriginalTestName")]). -
Update PINNED_COMMIT and commit alongside the test ports.