Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Make the invoke calls for Helm charts and YAML config resilient to the value being None or an empty dict #2665

Merged
merged 7 commits into from
Nov 15, 2023

Conversation

justinvp
Copy link
Member

@justinvp justinvp commented Nov 10, 2023

Note: The changes are broken up into multiple commits for easier review.

Proposed changes

In v3.92.0 of the core pulumi Python SDK, invokes were changed to return an empty dict rather than None for empty results, which is consistent with other language SDKs and the original behavior of the Python SDK, and makes generated provider Python SDKs work with empty results. However, the hand-rolled invoke code in the Kubernetes Python SDK for Helm and YAML are not resilient to it getting an empty dict. This change fixes Helm and YAML to be resilient, in the same way that the invoke for Kustomize was updated in a907bdd.

An invoke will return empty results when called on an unconfigured provider (i.e. a provider whose configuration contains an unknown value). The first three commits add regression tests that pass an unknown value as a provider's configuration. The Helm and YAML regression tests fail before the fix and succeed after the fix. The test for Kustomize already succeeds because of the change in a907bdd. The new tests are based on existing tests.

To ensure older versions of pulumi-kubernetes continue to work with newer versions of pulumi, we're planning to patch the pulumi SDK to return None for empty invoke returns when the function is one of the affected kubernetes function tokens. This is tracked by pulumi/pulumi#14508 (PR: pulumi/pulumi#14535).

Related issues

Fixes #2664

This is based on the existing `helm-local` test.
Copy link

Does the PR have any schema changes?

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

Copy link

codecov bot commented Nov 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1944a52) 18.31% compared to head (37219c1) 18.31%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2665   +/-   ##
=======================================
  Coverage   18.31%   18.31%           
=======================================
  Files          47       47           
  Lines        9644     9644           
=======================================
  Hits         1766     1766           
  Misses       7779     7779           
  Partials       99       99           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This is based on the existing `yaml-test` test.
The invoke used for Kustomize was already fixed to be resilient to `None` or empty dicts being returned in a907bdd. This test, which is based on the existing `kustomize` test is to ensure it continues to work without an error being raised.
Make the hand-rolled invoke code resilient to `invoke` returning either `None` or an empty dict for empty results. This aligns all invokes with the same pattern as introduced by a907bdd.
@justinvp justinvp merged commit 9b2f918 into master Nov 15, 2023
20 checks passed
@justinvp justinvp deleted the justin/invoke branch November 15, 2023 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python: Error raised when using Helm Chart or YAML ConfigFile with an unconfigured provider with pulumi 3.92.0
3 participants