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

Normalize x-kubernetes-* fields for outputs #3348

Merged
merged 7 commits into from
Dec 5, 2024

Conversation

rquitales
Copy link
Member

@rquitales rquitales commented Dec 4, 2024

Proposed changes

This PR normalizes outputs so that any x-kubernetes-* fields are stored in their respective underscored forms. When creating a CRD with Pulumi, we are able to set the x-kubernetes-* fields correctly during create/update (except in Java). However, if we attempt to read this field as an output, it would fail since the stored state is not normalized to the underscored forms. In other languages (Go/Python/TS), this was fine - but in Java, this fails as the builder pattern we use for codegen is unable to set the x-kubernetes-* fields since we only have setters for the underscored versions.

This also fixes the issue where we cannot read the values of x_kubernetes_* fields from outputs.

This PR adds additional unit tests, expands on the existing nodejs e2e test to verify that we can now read x_kubernetes_* fields, and creates a new Java e2e test to ensure we can successfully create CRDs that contain x_kubernetes_* fields.

Related issues (optional)

Closes: #3325

Copy link

github-actions bot commented Dec 4, 2024

Does the PR have any schema changes?

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

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.24%. Comparing base (e065015) to head (15631b8).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3348      +/-   ##
==========================================
+ Coverage   41.11%   41.24%   +0.12%     
==========================================
  Files          85       85              
  Lines       12741    12740       -1     
==========================================
+ Hits         5238     5254      +16     
+ Misses       7113     7096      -17     
  Partials      390      390              

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

@blampe
Copy link
Contributor

blampe commented Dec 4, 2024

This PR normalizes outputs so that any x-kubernetes-* fields are stored in their respective underscored forms

To clarify -- we currently store dashes in state, and will continue to store dashes, right? So underscores are only ever exposed to the SDK?

@rquitales
Copy link
Member Author

This PR normalizes outputs so that any x-kubernetes-* fields are stored in their respective underscored forms

To clarify -- we currently store dashes in state, and will continue to store dashes, right? So underscores are only ever exposed to the SDK?

I believe that it is necessary to store underscores for it to be exposed to the SDK. This should not be a breaking change for users.

@EronWright
Copy link
Contributor

Complementary to: #2128

@rquitales rquitales force-pushed the rquitales/fix-x_kubernetes-normalization branch from 955ca9e to 5d359f8 Compare December 5, 2024 00:41
@rquitales rquitales changed the title WIP: Also normalize x-kubernetes-* fields for outputs Normalize x-kubernetes-* fields for outputs Dec 5, 2024
Copy link
Contributor

@EronWright EronWright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me.

@rquitales rquitales merged commit 2595beb into master Dec 5, 2024
19 checks passed
@rquitales rquitales deleted the rquitales/fix-x_kubernetes-normalization branch December 5, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants