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: add namePattern field in discovery PV #187

Merged

Conversation

andyzhangx
Copy link
Member

@andyzhangx andyzhangx commented May 20, 2020

This PR is to add a namePattern field, with following config, only /dev/nvm* device names would be discovered, by default namePattern field is empty, it won't do any matching, so it's backward compatible.

apiVersion: v1
kind: ConfigMap
metadata:
  name: local-provisioner-config
  namespace: default
data:
  storageClassMap: |
    fast-disks:
       hostDir: /dev
       mountDir:  /dev
       blockCleanerCommand:
         - "/scripts/shred.sh"
         - "2"
       volumeMode: Filesystem
       fsType: ext4
       namePattern: "nvme*"

/assign @cofyc

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 20, 2020
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 20, 2020
if config.DeviceNameMatching != "" && !strings.Contains(file, config.DeviceNameMatching) {
klog.Infof("file(%s) under(%s) does not match %s", file, config.MountDir, config.DeviceNameMatching)
continue
}
Copy link
Member

@cofyc cofyc May 20, 2020

Choose a reason for hiding this comment

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

how about making it generic?

  1. rename DeviceNameMatching to NamePattern (filesystem mount points are also matched here)
  2. use filepath.Match to match on file name
  3. default value is * if not specified (matching all names)

Copy link
Member

Choose a reason for hiding this comment

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

in your case, the pattern will be nvm*, the same pattern used in the shell.

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good, will change the PR soon

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, it's done. To make sure it's backward compatible, when namePattern is empty string, it would not invoke filepath.Match, so empty == "*" here.

Copy link
Member

Choose a reason for hiding this comment

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

LGTM, btw can you add a helm value for this configuration (see example, e.g. classes.[n].fsType)? you can do it in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, thanks for the review

fix comments

typo
@andyzhangx andyzhangx changed the title feat: add deviceNameMatching field feat: add namePattern field in discovery PV May 21, 2020
@cofyc
Copy link
Member

cofyc commented May 21, 2020

/lgtm
/approve
Thanks!

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

[APPROVALNOTIFIER] This PR is APPROVED

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

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 May 21, 2020
@k8s-ci-robot k8s-ci-robot merged commit cd56ec6 into kubernetes-sigs:master May 21, 2020
davidmccormick pushed a commit to davidmccormick/sig-storage-local-static-provisioner that referenced this pull request Mar 31, 2021
…tching

feat: add namePattern field in discovery PV
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. 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