vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.
Apache License 2.0
727 stars 62 forks source link

update: Fall back to JSON merge patch when strategic merge patch preparation fails #260

Closed seh closed 5 years ago

seh commented 5 years ago

Kubernetes custom resources do not support strategic merge patch. Since it is difficult to discern which objects belong to custom resources, instead interpret a failure to prepare a strategic merge patch as a likely indicator that the API server does not support the patch type for the object, and fall back to trying a JSON merge patch instead.

See pulumi/pulumi-kubernetes#622 for the basis of inspiration. See kubernetes/kubernetes#81515 for a related fix that may allow us to refine our detection approach in the future.

Fixes #259

seh commented 5 years ago

Note that I did not add a test for this case, not being sure what's in that testdata/schema.pb file that could provoke this branch. Please let me know if you'd me to try to force such a test case.

seh commented 5 years ago

See #261 for a more precise treatment.