Skip to content

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

Merged
merged 10 commits into from
Feb 16, 2024

Conversation

Sneha-at
Copy link
Contributor

@Sneha-at Sneha-at commented Feb 2, 2024

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test

/kind feature

/kind flake

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?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 2, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 2, 2024
@leiyiz
Copy link
Contributor

leiyiz commented Feb 2, 2024

/retest

@Sneha-at Sneha-at force-pushed the add_staging_support branch from 4006ce7 to 2d40591 Compare February 2, 2024 23:56
@Sneha-at Sneha-at force-pushed the add_staging_support branch from 2d40591 to f5071fa Compare February 2, 2024 23:59
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 3, 2024
@Sneha-at
Copy link
Contributor Author

Sneha-at commented Feb 5, 2024

/test pull-gcp-compute-persistent-disk-csi-driver-e2e

@sunnylovestiramisu
Copy link
Contributor

/retest

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 6, 2024
@Sneha-at Sneha-at force-pushed the add_staging_support branch from fd460d3 to fe0f8dd Compare February 13, 2024 23:25
@Sneha-at Sneha-at force-pushed the add_staging_support branch from fe0f8dd to ce810c4 Compare February 14, 2024 00:18
if err != nil {
return nil, err
}
endpoint := computeURL.JoinPath(computeEnvironmentSuffix).String()
Copy link
Contributor

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 {
Copy link
Contributor

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)
Copy link
Contributor

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")
Copy link
Contributor

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?

Copy link
Contributor

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.

@sunnylovestiramisu
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 15, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 15, 2024
@pwschuurman
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2024
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 16, 2024
@k8s-ci-robot k8s-ci-robot merged commit 05d893a into kubernetes-sigs:master Feb 16, 2024
@amacaskill
Copy link
Member

/cherry-pick release-1.13

@k8s-infra-cherrypick-robot

@amacaskill: #1586 failed to apply on top of branch "release-1.13":

Applying: update driver to support staging compute
Applying: add logs for testing
Applying: add logs for PID
Applying: Add checks for compute environment flags and url checks
Using index info to reconstruct a base tree...
M	test/e2e/tests/single_zone_e2e_test.go
Falling back to patching base and 3-way merge...
Auto-merging test/e2e/tests/single_zone_e2e_test.go
CONFLICT (content): Merge conflict in test/e2e/tests/single_zone_e2e_test.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0004 Add checks for compute environment flags and url checks
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.13

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.

@pwschuurman
Copy link
Contributor

@amacaskill Can you also cherrypick #1609 once that PR is merged? Something like:

~/go/src/k8s.io/kubernetes/hack/cherry_pick_pull.sh upstream/release-1.13 1586 1609

k8s-ci-robot added a commit that referenced this pull request Feb 20, 2024
…1609-upstream-release-1.13

Automated cherry pick of #1586: update driver to support staging compute
#1609: fix pointer issue for GCE staging support
amacaskill added a commit that referenced this pull request Feb 20, 2024
…ing compute

#1609: fix pointer issue for GCE staging support"
k8s-ci-robot added a commit that referenced this pull request Feb 20, 2024
…herry-pick-of-#1586-#1609-upstream-release-1.13

Revert "Automated cherry pick of #1586: update driver to support staging compute#1609: fix pointer issue for GCE staging support"
k8s-ci-robot added a commit that referenced this pull request Feb 20, 2024
…1609-upstream-release-1.13

Automated cherry pick of #1586: update driver to support staging compute
#1609: fix pointer issue for GCE staging support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants