vmware-labs / reconciler-runtime

⚠️ Maintenance suspended. Please, migrate to the active fork reconciler.io/runtime. See https://github.com/reconcilerio/runtime/releases/tag/v0.20.0 for instructions. This repository will be archived eventually.
Other
81 stars 18 forks source link

Allow resources to contain unexported fields #487

Closed scothis closed 4 months ago

scothis commented 4 months ago

Using unexported fields in Kubernetes resources is not common, but does happen. Previously, these fields would cause cmp.Diff to panic. Now, we ignore the content of unexported fields when computing a diff. As the diff is for logging and test assertions this is relatively safe.

Semantic equality is used for detecting when a managed resource needs to be updated. Custom equality func can be defined separately as needed.

Refs #484

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 61.12%. Comparing base (3180680) to head (09436ab).

Files Patch % Lines
testing/subreconciler.go 0.00% 2 Missing :warning:
testing/webhook.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #487 +/- ## ========================================== + Coverage 61.03% 61.12% +0.09% ========================================== Files 27 28 +1 Lines 2556 2562 +6 ========================================== + Hits 1560 1566 +6 Misses 909 909 Partials 87 87 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mamachanko commented 4 months ago

[question, non-blocking]: @scothis when you say

Custom equality func can be defined separately as needed.

are you meaning that there could potentially be a follow-up PR? I am asking because afaik there's currently no way to provide a custom equality func, or is there?

scothis commented 4 months ago

@mamachanko I was basing it on this comment https://github.com/vmware-labs/reconciler-runtime/issues/484#issuecomment-1958682986

neowulf commented 4 months ago

@scothis this fix works! Thank you again for the quick turnaround!

scothis commented 4 months ago

@neowulf cool, I'll circle back to Max's feedback tomorrow.

mamachanko commented 4 months ago

Thank you @scothis !

vmwclabot commented 3 months ago

@scothis, VMware has approved your signed contributor license agreement.