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

Changes to snapshot controller to add sourceVolumeMode #679

Merged

Conversation

RaunakShah
Copy link
Contributor

@RaunakShah RaunakShah commented Mar 31, 2022

What type of PR is this?
/kind feature

What this PR does / why we need it:

This PR adds changes to snapshot-controller to read the volume mode of the source PV and add it to the Spec.SourceVolumeMode field of the to-be-created VolumeSnapshotContent object.

Also introduce a feature flag for this feature.

KEP - https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/3141-prevent-volume-mode-conversion

Testing

  1. Deploy Hostpath CSI driver with v6.0.0-rc2 version of csi-snapshotter and VolumeSnapshotContent CRD. Set prevent-volume-mode-conversion to true in snapshot-controller.
% kubectl get deployment -n kube-system -o yaml snapshot-controller
apiVersion: apps/v1
kind: Deployment
...
spec:
  minReadySeconds: 15
  progressDeadlineSeconds: 600
...
spec:
      containers:
      - args:
        - --v=5
        - --leader-election=true
        - --prevent-volume-mode-conversion=true
        image: snapshot-controller:latest
...
  1. Create a VolumeSnapshot object from an existing PVC:
% kubectl get volumesnapshot -A
NAMESPACE   NAME                   READYTOUSE   SOURCEPVC   SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS               SNAPSHOTCONTENT                                    CREATIONTIME   AGE
default     new-snapshot-demo-v1   true         hpvc                                1Gi           csi-hostpath-snapclass-v1   snapcontent-f4161ad9-9279-4e77-93ee-f8b5898b6010   4d             4d
  1. Verify VolumeSnapshotContent object for SourceVolumeMode field:
% kubectl get volumesnapshotcontent -o yaml
apiVersion: v1
items:
- apiVersion: snapshot.storage.k8s.io/v1
  kind: VolumeSnapshotContent
...
  spec:
    deletionPolicy: Delete
    driver: hostpath.csi.k8s.io
    source:
      volumeHandle: 37a4f46e-afe9-11ec-b141-8ed1e89c66d6
    sourceVolumeMode: Filesystem
    volumeSnapshotClassName: csi-hostpath-snapclass-v1
...
  1. Verify logs of snapshot-controller:
I0404 08:10:53.813378       1 snapshot_controller.go:698] snapcontent snapcontent-bbf7be38-ccb9-46bf-a420-f1a436bf10e4 has volume mode Filesystem

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Changes to snapshot controller to add SourceVolumeMode to VolumeSnapshotContents

@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 31, 2022
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 31, 2022
@RaunakShah
Copy link
Contributor Author

/hold until #683 is merged

1 similar comment
@RaunakShah
Copy link
Contributor Author

/hold until #683 is merged

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Apr 5, 2022
… mode conversion

- Changes to snapshot controller to read the volume mode from the PV and add it to SourceVolumeMode field in VolumeSnapshotContent
@RaunakShah
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 8, 2022
@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 Apr 12, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RaunakShah, 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 Apr 12, 2022
@k8s-ci-robot k8s-ci-robot merged commit 817c319 into kubernetes-csi:master Apr 12, 2022
@xing-yang
Copy link
Collaborator

Can you backport this to release-6.0?

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 Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants