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

feat: archive on delete support #530

Merged

Conversation

navilg
Copy link
Contributor

@navilg navilg commented Oct 24, 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 feature

What this PR does / why we need it:

This allows parameter onDelete: archive which will archive the the volume in nfs server when PV is deleted. Other two values, delete and retain are retained and serves their purpose.

This is helpful when we want to retain the nfs volume upon deletion of PV, but we also want to distinguish/separate the volume name in nfs server for deleted PVs from the in-use nfs volumes. This will prefix archived- in the folder name of PV in nfs server when PV is deleted.

Which issue(s) this PR fixes:

Fixes #522

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

To archive the volumes on deletion of PV, create storage class with parameter `ondelete: archive`. For e.g.

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-csi
mountOptions:
- nfsvers=4.1
parameters:
  onDelete: archive    # <----------------------------------------------------- Archive on delete policy
  server: mynfsserver.io
  share: /var/nfs/k8s_pvs
provisioner: nfs.csi.k8s.io
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer


To make the archive on deletion behaviour default, install with below value set in helm.

--set controller.defaultOnDeletePolicy=archive

@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. labels Oct 24, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 24, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @navilg. 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 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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 Oct 24, 2023
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/ok-to-test

pkg/nfs/controllerserver.go Outdated Show resolved Hide resolved
@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 Nov 4, 2023
@andyzhangx andyzhangx changed the title Feature: archive on delete feat: archive on delete support Nov 4, 2023
@andyzhangx
Copy link
Member

@navilg could you fix the ut failure? thanks.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6798767808

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 17 of 21 (80.95%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 78.277%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/nfs/controllerserver.go 17 21 80.95%
Totals Coverage Status
Change from base Build 6588984870: 0.3%
Covered Lines: 854
Relevant Lines: 1091

💛 - Coveralls

navilg and others added 3 commits November 8, 2023 14:16
fix: failed to archive subdirectory: no such file or dir

fix: failed to rename archive pvc

archived-pvc-1234

fix: volume name

doc: include archive on delete in doc
@navilg
Copy link
Contributor Author

navilg commented Nov 8, 2023

@andyzhangx Thanks for fixing ut. I could not make time last weekend.

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, navilg

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 9, 2023
@k8s-ci-robot k8s-ci-robot merged commit be6ca6f into kubernetes-csi:master Nov 9, 2023
19 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/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.

Implement archiveOnDelete feature which was provided by nfs-subdir-external-provisioner
4 participants