pulumi / pulumi-kubernetes

A Pulumi resource provider for Kubernetes to manage API resources and workloads in running clusters
https://www.pulumi.com/docs/reference/clouds/kubernetes/
Apache License 2.0
406 stars 115 forks source link

Fix value merging for empty lists #2995

Closed blampe closed 3 months ago

blampe commented 5 months ago

This fixes our behavior to match upstream's when merging empty lists. We now produce an empty list instead of a no-op.

The bug was due to this logic which initialized a slice as nil. This was then passed to mergo.Merge which ignores zero values by default, hence why the original value was not overridden.

This PR changes our allowNullValues logic to use upstream's merge behavior more directly since the intention behind that flag is to match upstream as closely as possible.

Importantly, this doesn't fix https://github.com/pulumi/pulumi-kubernetes/issues/2034 because we're still unmarshaling inputs with SkipNulls: true. In practice allowNullValues behaves more like allowEmptyValues because our unmarshaling strips away all of the meaningful nil values. That fix will be in another PR.

Fixes https://github.com/pulumi/pulumi-kubernetes/issues/2731. Refs https://github.com/pulumi/pulumi-kubernetes/issues/2034. Refs https://github.com/pulumi/pulumi-kubernetes/pull/2963.

github-actions[bot] commented 5 months ago

Does the PR have any schema changes?

Looking good! No breaking changes found. No new resources/functions.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 36.65%. Comparing base (3d211b9) to head (a092c68).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2995 +/- ## ========================================== - Coverage 36.74% 36.65% -0.09% ========================================== Files 71 71 Lines 9270 9249 -21 ========================================== - Hits 3406 3390 -16 + Misses 5525 5522 -3 + Partials 339 337 -2 ```

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

pulumi-bot commented 2 months ago

This PR has been shipped in release v4.14.0.