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

Update NodeJS Helm v3 to use native client #1279

Merged
merged 4 commits into from
Sep 1, 2020

Conversation

lblackstone
Copy link
Member

@lblackstone lblackstone commented Aug 27, 2020

Proposed changes

Related issues (optional)

Part of #920

@lblackstone lblackstone force-pushed the lblackstone/helm-ts-sdk branch 4 times, most recently from 3408c3e to b0028b5 Compare August 28, 2020 20:37
@lblackstone lblackstone marked this pull request as ready for review August 28, 2020 21:35
...config,
releaseName,

toJSON() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if there's a simpler way to handle the translation from the input interfaces to the JSON string, but I had to add cases for all of the camelCase fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

I had to add cases for all of the camelCase fields.

camelCase and snake_case are both conventions that are valid JSON.
What is the need for the translation?
Would we have to manually support these entries for future options, or can we avoid that all together?

Also, TIL about toJSON(). The embedding of logic on the config props like this is stylistically new to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

The invoke call is expecting a JSON string that it unmarshals to the Helm structs in the provider, so I need the keys to match. I'm not sure if there's a better way to handle this, but the data was complex enough that I thought JSON was nicer than using individual fields.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, TIL about toJSON(). The embedding of logic on the config props like this is stylistically new to me.

Courtesy of https://www.executeprogram.com/courses/modern-javascript/lessons/customizing-json-serialization

tests/sdk/nodejs/examples/helm/step2/index.ts Show resolved Hide resolved

const allConfig = pulumi.output(config);

(<any>allConfig).isKnown.then((isKnown: boolean) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since allConfig is an output, why not use it in an apply like is done below with this.resources?

Relatedly, using <any> is loose on typing, can we preserve it by using it within the apply?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I'm not sure why it's like this. I copy-pasted this code from the original implementation. I'll leave it alone for this PR for the sake of not accidentally breaking something.

...config,
releaseName,

toJSON() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to add cases for all of the camelCase fields.

camelCase and snake_case are both conventions that are valid JSON.
What is the need for the translation?
Would we have to manually support these entries for future options, or can we avoid that all together?

Also, TIL about toJSON(). The embedding of logic on the config props like this is stylistically new to me.

}
}

interface BaseChartOpts {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are BaseChartOpts and ChartOpts interfaces that could exist at the top of the Helm namespace given that the options are shared, or is it best to keep these versioned as we've done?

apiVersions is new, so that's prob a case to keep them versioned.

Copy link
Member Author

Choose a reason for hiding this comment

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

They could probably be shared, but I think I'll leave them separate in case we want to diverge in the future given the upcoming deprecation plan for v2.

sdk/nodejs/helm/v3/helm.ts Show resolved Hide resolved
Copy link
Contributor

@metral metral left a comment

Choose a reason for hiding this comment

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

Overall LGTM.

Could use extra 👀 from @justinvp for good measure.

@@ -1,3 +1,4 @@
apiVersion: v2
Copy link
Contributor

Choose a reason for hiding this comment

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

should these be v3?

Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently this is correct. v1 corresponds to Helm v2, and v2 corresponds to Helm v3. 🤷‍♂️

Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants