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

Fix relationship between node service and mounter interface #1997

Merged

Conversation

torredil
Copy link
Member

@torredil torredil commented Apr 5, 2024

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

This patch is 2/2, designed to improve the architecture of the code base with the goal of promoting a more cohesive and understandable design that makes it easier to reason about the driver and make future modifications or extensions more intuitive.

More specifically, this PR fixes the relationship between the node service and mounter interface, allowing for a platform agnostic node service.

Summary of Changes

  • Integrate resizeFs functionality into mounter package
    • Updated the NodeStageVolume and NodeExpandVolume RPCs to use the Resize method directly from the Mounter interface, instead of creating a new ResizeFs instance.
  • Remove DeviceIdentifier interface
    • Replaced the usage of deviceIdentifier with direct calls to os.Lstat and filepath.EvalSymlinks.
  • Refactor node service to be platform agnostic
    • Moved platform-specific code from node_linux.go and node_windows.go to mount_linux.go and mount_windows.go.
  • Refactor node service initialization and dependency injection
    • Improved modularity and testability by injecting dependencies (metadata.MetadataService, Mounter, metadata.KubernetesAPIClient) into the NewDriver() and NewNodeService() functions.

What testing is done?

  • manual
  • make test && make verify
  • CI

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 5, 2024
Copy link

github-actions bot commented Apr 5, 2024

Code Coverage Diff

File Old Coverage New Coverage Delta
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/node.go 80.6% 92.0% 11.4
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/mounter/mount.go Does not exist 75.0%
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/mounter/mount_linux.go Does not exist 45.7%
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/mounter/safe_mounter.go Does not exist 100.0%

Copy link
Contributor

@AndrewSirenko AndrewSirenko left a comment

Choose a reason for hiding this comment

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

Few initial questions/comments, will review once more when unit tests are ready. Thanks for this!

pkg/driver/mount_linux.go Outdated Show resolved Hide resolved
pkg/driver/mount_windows.go Show resolved Hide resolved
pkg/driver/mount.go Show resolved Hide resolved
pkg/driver/mount.go Show resolved Hide resolved
pkg/driver/driver.go Show resolved Hide resolved
@torredil torredil force-pushed the csi-refactor-mounter-node-v2 branch 3 times, most recently from 7e4089b to b090dc2 Compare April 10, 2024 17:13
@torredil
Copy link
Member Author

/retest

@torredil torredil force-pushed the csi-refactor-mounter-node-v2 branch from b090dc2 to bd4b87d Compare April 10, 2024 18:46
@torredil
Copy link
Member Author

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2024
@torredil torredil force-pushed the csi-refactor-mounter-node-v2 branch from f974271 to a993baa Compare April 15, 2024 12:20
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2024
pkg/mounter/mount_linux.go Outdated Show resolved Hide resolved
hack/update-mockgen.sh Show resolved Hide resolved
cmd/main.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@torredil torredil force-pushed the csi-refactor-mounter-node-v2 branch 2 times, most recently from edf4395 to 88e5cd6 Compare April 16, 2024 17:05
Makefile Outdated Show resolved Hide resolved
cmd/main.go Outdated Show resolved Hide resolved
pkg/driver/node.go Show resolved Hide resolved
pkg/mounter/mount.go Show resolved Hide resolved
pkg/mounter/mount_linux.go Outdated Show resolved Hide resolved
@torredil torredil force-pushed the csi-refactor-mounter-node-v2 branch 2 times, most recently from f3da9b4 to 5d75342 Compare April 16, 2024 18:52
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.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 16, 2024
Signed-off-by: torredil <torredil@amazon.com>
@torredil torredil force-pushed the csi-refactor-mounter-node-v2 branch from 5d75342 to fe51533 Compare April 16, 2024 19:43
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 16, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 16, 2024
@torredil
Copy link
Member Author

/approve

Thank you very much for all of the great effort in reviewing all the changes made across the refactoring PRs @ConnorJC3 @AndrewSirenko

@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 Apr 16, 2024
@k8s-ci-robot k8s-ci-robot merged commit 64772f0 into kubernetes-sigs:master Apr 16, 2024
19 checks passed
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.

None yet

4 participants