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

Add GroupControllerServer interface for VolumeGroupSnapshot API #399

Merged
merged 8 commits into from
Nov 27, 2023

Conversation

nixpanic
Copy link
Member

@nixpanic nixpanic commented Mar 10, 2023

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:

VolumeGroupSnapshots have been added to the CSI Spec with version 1.8.0. This PR implements the new API.

Which issue(s) this PR fixes:

Fixes #417
Closes #426 a copy of this PR with kubernetes-csi/csi-test#467 to run CSI Sanity validation

Special notes for your reviewer:

The Kubernetes CSI external-snapshotter does not have the full functionality at this time. The implementation of the VolumeGroupSnapshot functions is largely untested at the moment.

Does this PR introduce a user-facing change?:

Together with the Kubernetes CSI external-snapshotter, the csi-driver-host-path provides ALPHA support for the VolumeGroupSnapshot functionality.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 Mar 10, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @nixpanic!

It looks like this is your first PR to kubernetes-csi/csi-driver-host-path 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-csi/csi-driver-host-path has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 10, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @nixpanic. Thanks for your PR.

I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 10, 2023
@xing-yang
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 10, 2023
@xing-yang
Copy link
Contributor

/assign

pkg/hostpath/controllerserver.go Outdated Show resolved Hide resolved
pkg/hostpath/controllerserver.go Outdated Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
pkg/state/state.go Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
pkg/state/state.go Outdated Show resolved Hide resolved
@nixpanic
Copy link
Member Author

Addressed all typos in pkg/state/state.go.

I do not see an issue with the use of the hostPath.mutex in the newly added CSI RPC functions.

@nixpanic
Copy link
Member Author

In case someone wants to test this PR, a container image is available at quay.io/nixpanic/csi-driver-host-path:GroupControllerServer.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 5, 2023
@xing-yang
Copy link
Contributor

This missed adding a Type: csi.PluginCapability_Service_GROUP_CONTROLLER_SERVICE here:
https://github.com/kubernetes-csi/csi-driver-host-path/blob/v1.11.0/pkg/hostpath/identityserver.go#L54

Copy link
Contributor

@RaunakShah RaunakShah left a comment

Choose a reason for hiding this comment

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

Also, GetPluginCapabilities in hostpath/identityserver.go needs to return the group controller capability

pkg/hostpath/hostpath.go Outdated Show resolved Hide resolved
@nixpanic nixpanic force-pushed the GroupControllerServer branch from a65d484 to 83ee41f Compare April 25, 2023 12:36
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 25, 2023
@nixpanic
Copy link
Member Author

Thanks for the reviews @xing-yang and @RaunakShah! Your comments should have been addressed now.

The PR has been rebased so that conflicts with go.mod from the master branch are resolved too.

@nixpanic
Copy link
Member Author

A container-image with the current PR is at quay.io/nixpanic/csi-driver-host-path:GroupControllerServer_v2

@nixpanic
Copy link
Member Author

FYI, tests will fail until kubernetes-csi/csi-test#450 is merged and used by the CI.

Copy link
Member

@ggriffiths ggriffiths left a comment

Choose a reason for hiding this comment

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

Looks like the builds are failing here, feel free to re-request review when this is ready.

@leonardoce
Copy link
Contributor

Hi. I'm testing this PR (thanks, @xing-yang, for pointing me at this).
I realized that Group Snapshots are failing with failed to take group snapshot of the volumes [...]: “rpc error: code = AlreadyExists desc = group snapshot with the same name: ... but with different SourceVolumeIds already exist).

In the code, it looks like we're comparing PV handle IDs against snapshot handle IDs (see the MatchesSourceVolumeIDs function and the CreateVolumeGroupSnapshot function).

Doing this, the first CreateVolumeGroupSnapshot call will work correctly since the internal state is empty, and the subsequent calls will fail. I had positive results adding this commit that makes the GroupSnapshot struct keep track of both snapshot IDs and source volumes IDs.

Happy to help. Thank you!

@leonardoce
Copy link
Contributor

I'd also consider this commit, setting the GroupSnapshotId field in the ListSnapshots GRPC response

@nixpanic
Copy link
Member Author

I'd also consider this commit, setting the GroupSnapshotId field in the ListSnapshots GRPC response

Thanks! Will include that in the next update for this PR.

nixpanic added a commit to nixpanic/csi-driver-host-path that referenced this pull request Nov 23, 2023
@nixpanic
Copy link
Member Author

Thanks @leonardoce, your commits have been added in test-only PR #426 now.

@nixpanic nixpanic force-pushed the GroupControllerServer branch from f784917 to 138c85f Compare November 24, 2023 09:29
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 24, 2023
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Nov 24, 2023

@nixpanic: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubernetes-csi-csi-driver-host-path-1-24-on-kubernetes-1-24 f784917 link true /test pull-kubernetes-csi-csi-driver-host-path-1-24-on-kubernetes-1-24
pull-kubernetes-csi-csi-driver-host-path-1-24-test-on-kubernetes-1-24 f784917 link false /test pull-kubernetes-csi-csi-driver-host-path-1-24-test-on-kubernetes-1-24
pull-kubernetes-csi-csi-driver-host-path-1-25-test-on-kubernetes-1-25 f784917 link false /test pull-kubernetes-csi-csi-driver-host-path-1-25-test-on-kubernetes-1-25
pull-kubernetes-csi-csi-driver-host-path-1-25-on-kubernetes-1-25 f784917 link true /test pull-kubernetes-csi-csi-driver-host-path-1-25-on-kubernetes-1-25

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@nixpanic
Copy link
Member Author

nixpanic commented Nov 24, 2023

Ah! tests fail as release-tools/prow.sh still uses CSI_PROW_SANITY_VERSION v5.0.0. That needs to be v5.1.0 or newer.

This driver reports the new capability, bit the v5.0.0 version of the tests do not know about it.
image

kubernetes-csi/csi-release-tools#240 has already been merged, but it needs to be sync'd into this repository.

@xing-yang
Copy link
Contributor

Submitted this PR to update release-tools: #474

@xing-yang
Copy link
Contributor

/retest

@nixpanic nixpanic force-pushed the GroupControllerServer branch from 138c85f to 7d3bdf0 Compare November 27, 2023 08:04
@nixpanic
Copy link
Member Author

/retest

Everything has passed, but there it still a comment from the k8s-ci-bot about earlier failed tests, maybe this updates it?

@xing-yang
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 Nov 27, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nixpanic, xing-yang

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 Nov 27, 2023
@k8s-ci-robot k8s-ci-robot merged commit 2caefc6 into kubernetes-csi:master Nov 27, 2023
10 checks passed
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sample implementation in CSI hostpath mock driver
6 participants