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

Correctly detect newly created Volume[Group]SnapshotClasses #1100

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

leonardoce
Copy link
Contributor

What type of PR is this?

/kind bug

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 cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

This PR makes the controller process newly created default VolumeSnapshotClasses and VolumeGroupSnapshotClasses, correctly using them or raising an error when appropriate.

Which issue(s) this PR fixes:

Fixes #1099

Special notes for your reviewer:

The controller is using an informer to get VolumeGroupSnapshotClasses and VolumeSnapshotClasses.
Unfortunately, objects returned by that will not have the API Kind info set (see kubernetes/client-go#308).

This prevented the IsDefaultAnnotation function from working correctly.

This patch avoids relying on the object Kind to know whether a VolumeGroupSnapshotClass or a VolumeSnapshotClass is set as default.

The semantics of the groupsnapshot.storage.kubernetes.io/is-default-class have been preserved, with true being true and everything else being false (this is slightly different from Kubernetes).

Does this PR introduce a user-facing change?:

The controller will now detect new default VolumeSnapshotClasses and VolumeGroupSnapshotClasses.
If multiple classes exist for the same CSI driver, VolumeSnapshot and VolumeGroupSnapshots
will be marked as failed when provisioned dynamically.

@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/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 28, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 28, 2024
@xing-yang
Copy link
Collaborator

Please rebase.

The controller is using an informer to get VolumeGroupSnapshotClasses
and VolumeSnapshotClasses. Unfortunately, objects returned by that will
not have the API Kind info set.

This prevented the IsDefaultAnnotation function from working correctly.

This patch avoid relying on the object Kind to know whether a
VolumeGroupSnapshotClass or a VolumeSnapshotClass is set as default.

See: kubernetes/client-go#308

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
@leonardoce
Copy link
Contributor Author

Done @xing-yang

@xing-yang
Copy link
Collaborator

/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 Jun 18, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leonardoce, 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 Jun 18, 2024
@k8s-ci-robot k8s-ci-robot merged commit af43adc into kubernetes-csi:master Jun 18, 2024
6 of 8 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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controller does not detect new Volume[Group]SnapshotClass set as default
3 participants