csi-driver-nfs icon indicating copy to clipboard operation
csi-driver-nfs copied to clipboard

Add --enable-snapshot-compression flag to control snapshot compression

Open Copilot opened this issue 5 months ago • 3 comments

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds --enable-snapshot-compression driver parameter to control whether gzip compression is applied when creating volume snapshots. Users storing already-compressed data can set this to false to skip redundant compression, significantly speeding up snapshot creation and restoration.

Changes:

  • Add EnableSnapshotCompression to DriverOptions and Driver structs
  • Add --enable-snapshot-compression CLI flag (default: true)
  • Update CreateSnapshot to use .tar or .tar.gz based on setting
  • Update copyFromSnapshot to auto-detect archive format for backward compatibility
  • Add Helm chart support via controller.enableSnapshotCompression

Usage:

# Disable compression for pre-compressed data
--enable-snapshot-compression=false
# Helm values
controller:
  enableSnapshotCompression: false

Which issue(s) this PR fixes:

Fixes #891

Special notes for your reviewer:

  • Default true preserves existing behavior
  • Snapshot restoration auto-detects format (tries .tar.gz first, then .tar) ensuring backward compatibility with existing compressed snapshots
  • Both Go library (TarPack/TarUnpack) and external tar command paths updated

Does this PR introduce a user-facing change?:

Add --enable-snapshot-compression flag to control whether gzip compression is performed when creating volume snapshots. Set to false to skip compression for volumes containing already-compressed data.
Original prompt

This section details on the original issue you should resolve

<issue_title>Add a parameter to control whether compression is performed when creating volumesnapshots.</issue_title> <issue_description>Is your feature request related to a problem?/Why is this needed

I stores some large compressed files with PVCs. Creating volumesnapshot would compress those files again that is very time-consuming and the compression effect is quite limited.

Describe the solution you'd like in detail

Add a driver parameter to control whether compression is performed when creating volumesnapshots. If no compression,snapshot-controller would do tar (untar) without -z when creating (restoring) a volumesnapshot.

</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes kubernetes-csi/csi-driver-nfs#998

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Dec 01 '25 01:12 Copilot

Hi @Copilot. Thanks for your PR.

I'm waiting for a github.com 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-sigs/prow repository.

k8s-ci-robot avatar Dec 01 '25 01:12 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Copilot Once this PR has been reviewed and has the lgtm label, please ask for approval from andyzhangx. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Dec 01 '25 02:12 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Copilot Once this PR has been reviewed and has the lgtm label, please ask for approval from andyzhangx. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Dec 01 '25 02:12 k8s-ci-robot