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

Support specifying inode size for filesystem format #1661

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

fgksgf
Copy link
Contributor

@fgksgf fgksgf commented Jun 28, 2023

Is this a bug fix or adding new feature?
New feature

What is this PR about? / Why do we need it?
Close #1660

What testing is done?
UT and manual test

Manual Test

  • Create a EKS cluster, deploy ebs-csi-driver, replace the image with the one built from this PR
  • Create a pod with the manifests (no parameters):
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-claim
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ebs-sc
  resources:
    requests:
      storage: 2Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  containers:
  - name: app
    image: ubuntu
    securityContext:
      privileged: true
    tty: true
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 30; done"]
    volumeMounts:
    - name: persistent-storage
      mountPath: /data
    - mountPath: /host/var/lib/kubelet
      mountPropagation: Bidirectional
      name: kubelet-dir
    - mountPath: /host/dev
      name: device-dir
  volumes:
  - name: persistent-storage
    persistentVolumeClaim:
      claimName: ebs-claim
  - hostPath:
      path: /var/lib/kubelet
      type: Directory
    name: kubelet-dir
  - hostPath:
      path: /dev
      type: Directory
    name: device-dir
  • Run kubectl exec -it app -- tune2fs -l /dev/nvme1n1, get the output, save it as base.txt, then delete them.

inodeSize

  • Create a pod with the manifests but do some modification (set the parameter inodeSize: "512"), get the output of tune2fs, save it as inode-size.txt, then delete the resources
  • Diff base.txt with inode-size.txt:
- Inode blocks per group:   512
+ Inode blocks per group:   1024
 
- Inode size:	        256
+ Inode size:	        512

bytesPerINode

  • Create a pod with the manifests but do some modification (set the parameter bytesPerINode: "8192"), get the output of tune2fs:
tune2fs 1.46.5 (30-Dec-2021)
...
Inode count:              262144
Block count:              524288
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      255
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16384
Inode blocks per group:   1024
Flex block group size:    16
...
Inode size:	        256
...
  • Since bytes-per-inode = (total blocks * block size) / inode count, i.e. 524288 * 4096 / 262144 = 8192, we can confirm the parameter works.

numberOfINodes

  • Create a pod with the manifests but do some modification (set the parameter numberOfINodes: "200000"), get the output of tune2fs, save it as inode-num.txt, then delete the resources
  • Diff base.txt with inode-num.txt:
- Inode count:              131072
+ Inode count:              200192

- Inodes per group:         8192
+ Inodes per group:         12512

- Inode blocks per group:   512
+ Inode blocks per group:   782

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 28, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @fgksgf!

It looks like this is your first PR to kubernetes-sigs/aws-ebs-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/aws-ebs-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
Copy link
Contributor

Hi @fgksgf. 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 28, 2023
@ConnorJC3
Copy link
Contributor

/ok-to-test

@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 Jun 28, 2023
@hanyuel
Copy link
Contributor

hanyuel commented Jun 28, 2023

Hi @fgksgf , thanks for submitting the PR. Can you add (in the PR description) what testings have been done?

@ConnorJC3
Copy link
Contributor

Feel free to ignore the Windows test failure, it's due to a separate ongoing issue we're working on.

Based on a rough skim of the PR it looks good to me, but I'd like to do an in-depth review and manually test this locally before I give the official lgtm - I'll report back when I get to do that (probably later this week)

@fgksgf
Copy link
Contributor Author

fgksgf commented Jun 29, 2023

Hi @fgksgf , thanks for submitting the PR. Can you add (in the PR description) what testings have been done?

@hanyuel Ok, before that I want to add other inode related parameters those are only supported by ext2, ext3, and ext4, including -i bytes-per-inode and -N number-of-inodes, what do you think? Do i need to file an another PR?

/cc @ConnorJC3

Feel free to ignore the Windows test failure, it's due to a separate ongoing issue we're working on.

Thank you for the kind reminder.

@fgksgf
Copy link
Contributor Author

fgksgf commented Jul 10, 2023

@hanyuel @ConnorJC3 Hello, I just added what testings I have been done, PTAL :)

@fgksgf
Copy link
Contributor Author

fgksgf commented Jul 10, 2023

/test pull-aws-ebs-csi-driver-e2e-single-az

Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

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

I think the current approach is fine for a few exclusion types, but it's not very scalable. I'm also not a big fan of exposing these maps globally. Is it unreasonable to expect that we will add more exclusion types in the future?

Rather than having multiple maps each tracking the support for a single parameter, we should use a single map that tracks the support for all parameters:

type FileSystemConfig struct {
	SupportedParams map[string]bool
}

var FileSystemConfigs = make(map[string]FileSystemConfig)

// FSTypeExt2 config
// FSTypeExt3 config
// FSTypeExt4 config
// FSTypeXfs config

// FSTypeNtfs config
FileSystemConfigs[FSTypeNtfs] = FileSystemConfig{
	SupportedParams: map[string]bool{
		"blockSize":       false,
		"inodeSize":       false,
		"bytesPerInode":   false,
		"numberOfInodes":  false,
	},
}

and then we can just do

func (fsConfig FileSystemConfig) isParameterSupported(paramName string) bool {
	supported, _ := fsConfig.SupportedParams[paramName]
	return supported
}

This is easier to reason about and extend. Whenever a new param or fsType is introduced we only have to update FileSystemConfigs, everything else should work with no further modifications.

Copy link
Contributor

@ConnorJC3 ConnorJC3 left a comment

Choose a reason for hiding this comment

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

This is awesome, lgtm as far as I'm concerned

cc @torredil for review

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

@torredil torredil left a comment

Choose a reason for hiding this comment

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

This is looking very clean now @fgksgf, perfect!

Thank you for your contribution and the very detailed testing section in the PR description, appreciate that.

@torredil
Copy link
Member

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 27, 2023
@torredil
Copy link
Member

One last request: Will merge this PR once the commits have been squashed.

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

@fgksgf: The following test 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-aws-ebs-csi-driver-test-e2e-external-eks-windows 996d1a9 link false /test pull-aws-ebs-csi-driver-test-e2e-external-eks-windows

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

@torredil
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: torredil

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 Jul 31, 2023
@ConnorJC3
Copy link
Contributor

/lgtm
/remove-hold

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jul 31, 2023
@k8s-ci-robot k8s-ci-robot merged commit dbe9c18 into kubernetes-sigs:master Jul 31, 2023
9 of 10 checks passed
@fgksgf fgksgf deleted the custom-inode-size branch August 1, 2023 02:37
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. 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. 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.

Support specifying inode size for filesystem format
5 participants