-
Notifications
You must be signed in to change notification settings - Fork 76
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
Changes to support Go SDK #519
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
examples/cluster-go/main.go
Outdated
package main | ||
|
||
import ( | ||
"github.com/pulumi/pulumi-eks/go/eks" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, one thing I've been wondering...
All our other providers put the SDK files under <repo>/sdk
, e.g.:
pulumi/pulumi-aws/sdk/dotnet
pulumi/pulumi-aws/sdk/go
pulumi/pulumi-aws/sdk/nodejs
pulumi/pulumi-aws/sdk/python
However, since this repo (eks) was originally only Node.js, it didn't have an sdk
dir -- all the Node.js files were in a nodejs
dir in the root fo the repo (pulumi/pulumi-eks/nodejs
).
When I went to add Python and .NET, I contemplated moving the existing Node.js files under a new sdk
dir, but ended up holding off and instead creating python
and dotnet
dirs in the root of the repo (with the idea that I'd eventually go back and clean this up). In hindsight, I probably should have just gone ahead and created the sdk
dir and moved all the sdk files under it.
The structure of the repo doesn't matter much for using these language SDKs, but with Go, you're importing paths in the repo, and all our other repos put the go files under sdk
.
I'm wondering if we should just go ahead and do that for the Go SDK now, before anyone has taken a dependency on the import path.
I think this means reworking the existing go.mod/sum in the root of the repo, something like:
- Add
sdk
dir - Generate Go files under
sdk/go
. - Remove
go.mod/sum
in repo root. - Add
go.mod/sum
insdk
dir (with just dependencies needed for the SDK) - Add
go.mod/sum
underexamples
(with just dependencies needed to run the tests) - Move
utils/utils.go
toexamples/utils/utils.go
- Add
go.mod/sum
underprovider
(with just dependencies necessary for the provider and code generator program)
Ideally, we'd then also move the nodejs
, python
, and dotnet
dirs under sdk
, but we can do that later, as a separate change (will need to ensure all the paths are fixed up across the tests, GHA, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we should move Go at least to live in the sdk directory since codegen has that assumption baked in several places (e.g., the PkgVersion function regex).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Will try this out and update the PR shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated things as you recommended @justinvp. I haven't quite run the tests yet after the reorg but things build. Will look to add a simple starting go test integration test wrapper as well.
RE: utils/testvpc/index.ts → examples/utils/testvpc/index.ts Note the tests depend on the path to the pulumi-eks/examples/examples_test.go Lines 66 to 71 in a1031f9
And the Makefile: Lines 87 to 88 in a1031f9
|
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
4447629
to
8b667b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some feedback about unnecessary package renames as well as the go tests not working in CI
@@ -13,7 +13,7 @@ | |||
// limitations under the License. | |||
// +build dotnet all | |||
|
|||
package examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should stay as examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I failed to revert after running into some go mod issues. Fixed now across the examples.
examples/examples_go_test.go
Outdated
// limitations under the License. | ||
// +build go all | ||
|
||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be package examples
examples/examples_nodejs_test.go
Outdated
@@ -13,7 +13,7 @@ | |||
// limitations under the License. | |||
// +build nodejs all | |||
|
|||
package examples | |||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changing?
examples/examples_py_test.go
Outdated
@@ -13,7 +13,7 @@ | |||
// limitations under the License. | |||
// +build python all | |||
|
|||
package examples | |||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above
github.com/pulumi/pulumi/sdk/v2 v2.18.2 | ||
) | ||
|
||
replace github.com/pulumi/pulumi-eks/sdk => ../../sdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this won't run in CI as it creates a temp GOPATH and it won't be able to traverse the ../../ notation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this won't run in CI as it creates a temp GOPATH and it won't be able to traverse the ../../ notation
The reason for this to exist currently is because we don't actually have github.com/pulumi/pulumi-eks/sdk
- this change adds it. I added a TODO. I could also exclude the example and add it in a separate PR. Let me know if you have a strong preference either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO works for me. 👍
examples/examples_go_test.go
Outdated
"aws:region": region, | ||
}, | ||
Dependencies: []string{ | ||
"Pulumi.Eks", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is specific to DotnEt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to fix this up, but we can do that when we hook up the test to CI, separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the change but I expect to need to fiddle here as part of CI work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
These changes are based on @justinvp's branch here: #457.
I have split things up to separate commits to ease review: https://github.com/pulumi/pulumi-eks/pull/519/commits