Skip to content

feat: enable btrfs #2001

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

Merged
merged 1 commit into from
Mar 21, 2025
Merged

Conversation

motiejus
Copy link
Contributor

@motiejus motiejus commented Mar 19, 2025

This change is enough to provision and run a btrfs filesystems.

Tested workflows:
[x] provisioning (formatting)
[x] disk expansion

/kind feature

Fixes #2000

What this PR does / why we need it:

Enables formatting new PVCs using btrfs filesystem.

Mount options like compress=zstd work as expected.

Does this PR introduce a user-facing change?: YES

ubuntu-only: specifying `fsType: btrfs` in the PVC definition now formats & mounts a btrfs filesystem. btrfs support is experimental.

Non-btrfs users are not impacted by this change.

It is not explicitly supported in GCP docs, and it does not have to be, at least in the interim. This PR allows users easily experiment with the FS.

The integration tests are not updated to run btrfs, because as of writing COS does not support btrfs.

@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 Mar 19, 2025
Copy link

linux-foundation-easycla bot commented Mar 19, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: motiejus / name: Motiejus Jakštys (d51a58d)

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @motiejus!

It looks like this is your first PR to kubernetes-sigs/gcp-compute-persistent-disk-csi-driver 🎉. 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-sigs/gcp-compute-persistent-disk-csi-driver 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 cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 19, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @motiejus. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 19, 2025
@motiejus motiejus changed the title enable btrfs feat: enable btrfs Mar 19, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 19, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2025
@sunnylovestiramisu
Copy link
Contributor

Hmm so supporting btrfs resizing on Hyperdisk volumes requires creating a smaller volume, migrating data, and deleting the original. This seems like a half supported feature for PDCSI driver, I am not sure if we want to have it enable.

/assign @mattcary

@mattcary
Copy link
Contributor

/ok-to-test

Since this is just adding another option to the storage class and not changing any of the control flow, I'm inclined to go ahead and enable it. Although if resizing is not working the tests probably need to be updated to skip them -- let's see what the CI does.

@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 19, 2025
@mattcary
Copy link
Contributor

@motiejus can you update the README with details of support? Including any quirks around usage, like resize as Sunny mentioned (I haven't verified any of this myself).

@motiejus
Copy link
Contributor Author

motiejus commented Mar 19, 2025

Hmm so supporting btrfs resizing on Hyperdisk volumes requires creating a smaller volume, migrating data, and deleting the original. This seems like a half supported feature for PDCSI driver, I am not sure if we want to have it enable.

AFAIK CSI API only supports expansion? From here:

Note that, although you can specify a lower amount of storage than what was requested previously,
the new value must still be higher than .status.capacity. Kubernetes does not support shrinking a PVC
to less than its current size.

Let me know if this is wrong, I would be very happy to stand corrected. As far as I understand, btrfs is the only filesystem out of the 3 (others of course being xfs and ext4) that supports online shrinking. If there is an API I can hook into, I would be more than happy to implement it for btrfs.

@motiejus can you update the README with details of support? Including any quirks around usage, like resize as Sunny mentioned (I haven't verified any of this myself).

As far as I have tried, all the features present in ext4 and xfs are working just as well in btrfs, thanks to already-present support in mount-utils.

@motiejus
Copy link
Contributor Author

motiejus commented Mar 19, 2025

Those failing tests seem like flakes? Windows-2019 and Windows-2022.

To @mattcary 's comment

Including any quirks around usage

Early in testing we realized that the default 50MiB RAM limit is not enough to mount larger btrfs volumes (1TiB++). So we bumped the limit to 256MiB internally and didn't have any issues since. It is different from #1782, since that was the mount call that caused the OOM (the linked ticket is fsck).

Given that the memory limits are not part of this repository, do you think this warrants an entry in the README?

@mattcary
Copy link
Contributor

I think updating the readme to say that btrfs is available, but it's new and has not been production-tested. Things like increased memory needs would also be helpful.

@motiejus
Copy link
Contributor Author

I think updating the readme to say that btrfs is available, but it's new and has not been production-tested. Things like increased memory needs would also be helpful.

Added a note in the README. If you prefer other wording, please let me know how, so I'll update it, or feel free to change it yourself.

Thanks!

@mattcary
Copy link
Contributor

I think updating the readme to say that btrfs is available, but it's new and has not been production-tested. Things like increased memory needs would also be helpful.

Added a note in the README. If you prefer other wording, please let me know how, so I'll update it, or feel free to change it yourself.

Thanks!

That looks great, thanks

@mattcary
Copy link
Contributor

Hmm, it didn't look like the integration test ran with your sc-btrfs. I'm not sure why, can you take a look?

@motiejus
Copy link
Contributor Author

motiejus commented Mar 20, 2025

Hmm, it didn't look like the integration test ran with your sc-btrfs. I'm not sure why, can you take a look?

Tried to take a look. tests/run-k8s-integration-ci.sh wasn't executed, thus xfs tests also didn't run. Seems like we have a bigger problem, but I don't know where to check: I can't find an entrypoint to the integration tests: .github directory does not have anything related.

Are we missing a big chunk of integration tests? Anyhow, this seems to be a bigger problem than btrfs. Happy to help, but my knowledge of the test setup is lacking.

@sunnylovestiramisu
Copy link
Contributor

Hmm, it didn't look like the integration test ran with your sc-btrfs. I'm not sure why, can you take a look?

Tried to take a look. tests/run-k8s-integration-ci.sh wasn't executed, thus xfs tests also didn't run. Seems like we have a bigger problem, but I don't know where to check: I can't find an entrypoint to the integration tests: .github directory does not have anything related.

Are we missing a big chunk of integration tests? Anyhow, this seems to be a bigger problem than btrfs. Happy to help, but my knowledge of the test setup is lacking.

You should try to replace the --storageclass-files=sc-balanced.yaml in the run-k8s-integration.sh and see if the integ tests run.

motiejus added a commit to motiejus/gcp-compute-persistent-disk-csi-driver that referenced this pull request Mar 20, 2025
@motiejus
Copy link
Contributor Author

The integration test failed with this:


  Mounting arguments: -t btrfs -o defaults /dev/disk/by-id/google-pvc-85a0c313-7a48-4daa-988a-9a4a5aeeabfb /var/lib/kubelet/plugins/kubernetes.io/csi/pd.csi.storage.gke.io/747f7ed65f8237a1726b5c15909179a6908fa3157bc2bfaf1aaf06a4e0362f27/globalmount
  Output: mount: /var/lib/kubelet/plugins/kubernetes.io/csi/pd.csi.storage.gke.io/747f7ed65f8237a1726b5c15909179a6908fa3157bc2bfaf1aaf06a4e0362f27/globalmount: unknown filesystem type 'btrfs'.
         dmesg(1) may have more information after failed mount system call. 

cos_containerd does not have a btrfs kernel module (we also stumbled upon this internally). I am changing to ubuntu_containerd for the sake of the test.

@motiejus
Copy link
Contributor Author

Integration test doesn't like non-COS:

setting environment vars for bringing up ubuntu cluster on GCE is unimplemented

i will add a note in the README that CSI does not currently have btrfs kernel driver, thus only Ubuntu is supported (from the list of GCP-blessed OS images). If the OCI team asks, I would appreciate if you could support the clause.

This change is enough to provision and run a btrfs filesystems on
Ubuntu.

Tested workflows:
[x] provisioning (formatting)
[x] disk expansion

The integration tests are not updated to run btrfs, because as of writing [COS does not support btrfs](https://cloud.google.com/container-optimized-os/docs/concepts/supported-filesystems).
@k8s-ci-robot
Copy link
Contributor

@motiejus: 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-gcp-compute-persistent-disk-csi-driver-e2e-windows-2019 d51a58d link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2019
pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2022 d51a58d link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2022

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

@mattcary
Copy link
Contributor

i will add a note in the README that CSI does not currently have btrfs kernel driver, thus only Ubuntu is supported (from the list of GCP-blessed OS images). If the OCI team asks, I would appreciate if you could support the clause.

We've started the process internally, we'll see what happens.

Tried to take a look. tests/run-k8s-integration-ci.sh wasn't executed, thus xfs tests also didn't run.

If you go to the prow job yaml from the build details page, you see the following:

image

So it's the run-integration-test.sh script that's executed for presubmit. The -ci script is run periodically to make the following: https://testgrid.k8s.io/provider-gcp-compute-persistent-disk-csi-driver. Sorry, I misremembered what was what.

Anyway it looks like for the presubmit we only run on one storage class anyway, to save presubmit time. That's probably a good idea, ie we wouldn't want to add btrfs to the presumbit anyway. Thank you for arranging a one-off run to confirm the COS issue.

Since we've listed this support as experimental, and the presubmit run does confirm that enabling btrfs doesn't break anything else (not that we would have expected to but that's what testing is for....), I think we can submit this.

Thanks for your contribution!

/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 Mar 21, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattcary, motiejus

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 Mar 21, 2025
@k8s-ci-robot k8s-ci-robot merged commit 3e06d63 into kubernetes-sigs:master Mar 21, 2025
7 of 9 checks passed
@mattcary
Copy link
Contributor

@motiejus are you on slack? I have a couple questions to ask. Thanks!

@motiejus motiejus deleted the btrfs-progs branch March 21, 2025 16:57
@motiejus
Copy link
Contributor Author

motiejus commented Mar 21, 2025

@motiejus are you on slack? I have a couple questions to ask. Thanks!

Sent you an email to your @google.com address.

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/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.

btrfs support
4 participants