pulumi-kubernetes icon indicating copy to clipboard operation
pulumi-kubernetes copied to clipboard

Make v2 YAML more forgiving when checking GVK for namespaced-ness

Open blampe opened this issue 1 year ago • 2 comments

This changes our error handling in Normalize to degrade gracefully in the case when we can't determine namespaced-ness, probably due to the CRD not existing yet. Instead of failing, we assume the resource is namespaced to allow the preview to succeed.

This is consistent with our error handling for this case elsewhere:

  • Check https://github.com/pulumi/pulumi-kubernetes/blob/0f834c8b0d89e0003f0dc2d527d4ca8e2cde26e9/provider/pkg/provider/provider.go#L1481-L1488
  • Diff https://github.com/pulumi/pulumi-kubernetes/blob/0f834c8b0d89e0003f0dc2d527d4ca8e2cde26e9/provider/pkg/provider/provider.go#L1666-L1674
  • Invoke: https://github.com/pulumi/pulumi-kubernetes/blob/0f834c8b0d89e0003f0dc2d527d4ca8e2cde26e9/provider/pkg/provider/invoke_decode_yaml.go#L49-L56

Added a failing unit test.

Fixes #3176

blampe avatar Aug 22 '24 21:08 blampe

Does the PR have any schema changes?

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

github-actions[bot] avatar Aug 22 '24 21:08 github-actions[bot]

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 39.41%. Comparing base (0f834c8) to head (0f429e4). Report is 22 commits behind head on master.

Files with missing lines Patch % Lines
provider/pkg/provider/yaml/v2/yaml.go 66.66% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3186      +/-   ##
==========================================
+ Coverage   39.34%   39.41%   +0.07%     
==========================================
  Files          82       82              
  Lines        9631     9633       +2     
==========================================
+ Hits         3789     3797       +8     
+ Misses       5481     5475       -6     
  Partials      361      361              

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

codecov[bot] avatar Aug 22 '24 21:08 codecov[bot]

@blampe I'm closing this PR in favor of different solution(s), e.g.

  • https://github.com/pulumi/pulumi-kubernetes/issues/3299
  • https://github.com/pulumi/pulumi-kubernetes/issues/3300

EronWright avatar Oct 31 '24 21:10 EronWright