cisco-open / k8s-objectmatcher

A Kubernetes object matcher library to avoid unnecessary K8s object updates
Apache License 2.0
157 stars 29 forks source link

Apply unstructured patches and recreate the patch based on the difference #46

Closed pepov closed 3 years ago

pepov commented 3 years ago
Q A
Bug fix? yes
New feature? no
API breaks? no
Deprecations? no
License Apache 2.0

What's in this PR?

Apply the patch on the current object and create a patch between the old and the new version to see if the patch has made any difference.

An example for this is when the original object holds a reference to a field that doesn't exist either in current neither in the modified version. Based on the comparison between original and modified a deletion will be generated, which is not what we want, since it will have no effect on current.

The same is already done for structured objects, but it was missing for unstructured.