-
Notifications
You must be signed in to change notification settings - Fork 325
Create a new instance of aws cloud #129
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
Create a new instance of aws cloud #129
Conversation
Hi @HaibaraAi96. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @andrewsykim |
pkg/providers/v2/interface.go
Outdated
@@ -41,6 +48,86 @@ var _ cloudprovider.Interface = (*cloud)(nil) | |||
type cloud struct { | |||
} | |||
|
|||
type awsSDKProvider struct { | |||
creds *credentials.Credentials |
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.
Not sure we need a new type like awsSDKProvider
yet, seems premature. Can we have creds
and the region field be in cloud
instead?
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.
that sounds reasonable, will update!
|
||
// Derives the region from a valid az name. | ||
// Returns an error if the az is known invalid (empty) | ||
func azToRegion(az string) (string, error) { |
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.
Can we add a unit test for this?
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.
sure, will add soon!
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.
@andrewsykim Updated!
I add a new file called interface_test.go and include the unit test for it
I also delete the type awsSDKProvider and call metadataClient directly in newCloud()
d61dc55
to
564146c
Compare
@@ -39,6 +46,71 @@ var _ cloudprovider.Interface = (*cloud)(nil) | |||
|
|||
// cloud is the AWS v2 implementation of the cloud provider interface | |||
type cloud struct { |
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.
Line 36 above needs to be updated to call newCloud as part of RegisterCloudProvider
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.
/ok-to-test
pkg/providers/v2/interface.go
Outdated
} | ||
|
||
// newCloud creates a new instance of AWSCloud. | ||
func newCloud() (*cloud, error) { |
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 return the interface it implements instead
func newCloud() (cloudprovider.Interface, error)
564146c
to
60c7fa0
Compare
/retest |
60c7fa0
to
a3ccd4a
Compare
cloudprovider "k8s.io/cloud-provider" | ||
) | ||
|
||
func init() { | ||
cloudprovider.RegisterCloudProvider(ProviderName, func(config io.Reader) (cloudprovider.Interface, error) { | ||
return &cloud{}, nil | ||
return newCloud() |
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.
@andrewsykim updated!
Also passed the unit test, let me know if you have any other suggestions :)
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.
/approve
/lgtm
thanks @nicolehanjing
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: andrewsykim, nicolehanjing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR creates a new instance of aws cloud, which helps future PRs to commit in parallel with fewer conflicts
Which issue(s) this PR fixes:
Part of #125
Special notes for your reviewer:
Does this PR introduce a user-facing change?: