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

Prep for Windows support: Copy pkg/mounter and refactor to use k8s.io/mount-utils #786

Merged
merged 4 commits into from
Mar 11, 2021

Conversation

wongma7
Copy link
Contributor

@wongma7 wongma7 commented Mar 9, 2021

Is this a bug fix or adding new feature? new

What is this PR about? / Why do we need it? As mentioned in pkg/mounter/README I have copied the csi-proxy implementation of mount.Interface from https://github.com/kubernetes-sigs/azuredisk-csi-driver/tree/master/pkg/mounter . Basically it is a platform independent package where on unix the mounter will be the same SafeFormatAndMount implementation as before and on windows the mounter will be the newer csi-proxy implementation. Since GCE PD also has their own similar implementation, we might want to consider moving it to its own k8s repo, but in meantime copy/pasting the code is the least painful way to consume it IMO. I don't want to depend on azure/gce repos and pull in a mountain of dependencies.

Since pkg/mounter implements the latest mount interface from k8s.io/mount-utils, not k8s.io/utils/mount, I have to do some refactoring to use it.

I also refactored NodeStage tests to be table driven but it's too much effort to refactor them all. The length of the test file and amount of code repetition is becoming too much IMO.

What testing is done?
unit testing locally go test ./pkg/driver/...

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wongma7

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 9, 2021
@coveralls
Copy link

coveralls commented Mar 9, 2021

Pull Request Test Coverage Report for Build 1708

  • 44 of 87 (50.57%) changed or added relevant lines in 5 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 81.695%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/driver/mount.go 12 13 92.31%
pkg/driver/node.go 9 15 60.0%
pkg/driver/node_linux.go 15 51 29.41%
Files with Coverage Reduction New Missed Lines %
pkg/driver/mount.go 1 65.52%
pkg/driver/node.go 1 77.57%
Totals Coverage Status
Change from base Build 1679: -0.02%
Covered Lines: 1745
Relevant Lines: 2136

💛 - Coveralls

@wongma7 wongma7 changed the title Prep for Windows support: Refactor to use k8s.io/mount-utils and pkg/mounter Prep for Windows support: Copy pkg/mounter and refactor to use k8s.io/mount-utils Mar 9, 2021
@wongma7
Copy link
Contributor Author

wongma7 commented Mar 9, 2021

https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_aws-ebs-csi-driver/786/pull-aws-ebs-csi-driver-migration-test-latest/1369405539636744192


Mar  9 22:15:21.859: INFO: At 2021-03-09 22:15:21 +0000 UTC - event for awsf9sz7: {external-resizer ebs.csi.aws.com } FileSystemResizeRequired: Require file system resize of volume on node
Mar  9 22:15:21.859: INFO: At 2021-03-09 22:15:21 +0000 UTC - event for awsf9sz7: {external-resizer ebs.csi.aws.com } VolumeResizeFailed: Mark PVC "volume-expand-269/awsf9sz7" as file system resize required failed: can't patch status of  PVC volume-expand-269/awsf9sz7 with Operation cannot be fulfilled on persistentvolumeclaims "awsf9sz7": the object has been modified; please apply your changes to the latest version and try again 

migration is failing because external-resizer can't mark PVC required? This test doesnt involve the node plugin at all so I don't think it's related to my changes

Also unsure if external-resizer will retry in case of transient patch error like this or if it's a legit bug

/retest

@wongma7
Copy link
Contributor Author

wongma7 commented Mar 9, 2021

/test pull-aws-ebs-csi-driver-migration-test-latest

ExistsPath(filename string) (bool, error)

// Implemented by NodeMounter.SafeFormatAndMount.Exec
// TODO this won't make sense on Windows with csi-proxy
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the TODOs here? Remove them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't know yet what if anything needs to be done on windows until i actually test it which could take a while so I droped a lot of these windows-related TODOS throughout the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so far I've only tested up to the point where it gets the device path (device number on windows) . All of the subsequent execs and mkdirs and mkfiles, i expect to fail, but exactly how to fix that I don't kno

return "", err
}

// If the path exists, assume it is not nvme device
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put a link to the source of this assumption and/or explain why it's safe to do so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have no clue, keep in mind this is copy/pasted from node.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks. You can do it on the next PR if you like, up to you.

@ayberk
Copy link
Contributor

ayberk commented Mar 11, 2021

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2021
@k8s-ci-robot k8s-ci-robot merged commit af75b0f into kubernetes-sigs:master Mar 11, 2021
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants