-
Notifications
You must be signed in to change notification settings - Fork 159
Update driver to support compute staging #1586
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 driver to support compute staging #1586
Conversation
/retest |
4006ce7
to
2d40591
Compare
2d40591
to
f5071fa
Compare
/test pull-gcp-compute-persistent-disk-csi-driver-e2e |
/retest |
fd460d3
to
fe0f8dd
Compare
fe0f8dd
to
ce810c4
Compare
if err != nil { | ||
return nil, err | ||
} | ||
endpoint := computeURL.JoinPath(computeEnvironmentSuffix).String() |
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.
Rather than JoinPath, I think we should ignore the path and just construct it ourselves. This will make the logic backwards compatible for anything that a calling process that runs the driver with --compute-endpoint
string that includes a path.
computeURL.Path = computeEnvironmentSuffix
endpoint := computeURL.String()
You may need to update your getPath()
function to include a leading /
character when constructing the path.
return computeOpts, nil | ||
} | ||
|
||
func getPath(env Environment, version Version) string { |
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.
nit: I would call this constructComputeEndpointPath, rather than getPath. The name getPath
is genericvery generic, and get
implies we're either fetching a field from an object, or we're retrieving specific data from a higher level resource.
if computeEndpoint != "" { | ||
v1Endpoint := fmt.Sprintf("%s/compute/v1/", computeEndpoint) | ||
computeOpts = append(computeOpts, option.WithEndpoint(v1Endpoint)) | ||
computeURL, err := url.ParseRequestURI(computeEndpoint) |
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.
The validation of computeEndpoint could be done at the initialization layer. You could do something very similar to your enumFlag() call, where you validate the computeEndpoint string set a computeURL value (pointer) with either the value, or nil if no computeURL is provided.
This allows you to avoid needing to check for err
here, and your function on the construction of the URL and path.
@@ -1295,15 +1295,6 @@ var _ = Describe("GCE PD CSI Driver", func() { | |||
|
|||
klog.Infof("Creating new driver and client for node %s\n", i.GetName()) | |||
|
|||
// Create new driver and client w/ invalid endpoint | |||
tcInvalid, err := testutils.GCEClientAndDriverSetup(i, "invalid-string") |
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 we drop the invalid endpoint case?
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.
Yes, IMO this should be treated as input validation for the program rather than the RPC layer. Passing an invalid endpoint should crash the program, rather than cause a delayed RPC error.
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pwschuurman, Sneha-at 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 |
/cherry-pick release-1.13 |
@amacaskill: #1586 failed to apply on top of branch "release-1.13":
In response to this:
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. |
@amacaskill Can you also cherrypick #1609 once that PR is merged? Something like:
|
…ing compute #1609: fix pointer issue for GCE staging support"
What type of PR is this?
/kind feature
What this PR does / why we need it:
The PR updates PDCSI driver to support GCE staging compute for internal testing.
Which issue(s) this PR fixes:
Fixes #
NA
Special notes for your reviewer:
Does this PR introduce a user-facing change?: