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

Remove inappropriate allocator import #2855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dperny
Copy link
Collaborator

@dperny dperny commented May 7, 2019

Removes inappropriate import of manager/allocator/cnmallocator into node/node.go. The consequence of this is that in upstream moby/moby, we can remove that import as well. manager/allocator/cnmallocator is an implementation detail, and importing it so high in the stack creates an unacceptably high degree of coupling.

Specifically, the moby/moby code in question is here: https://github.com/moby/moby/blob/master/daemon/cluster/noderunner.go#L16

and also here:

https://github.com/moby/moby/blob/master/daemon/cluster/noderunner.go#L127-L130

The long-pending long-awaited allocator rewrite on the new-allocator branch removes cnmallocator, and doing this refactoring in an earlier commit will simplify that operation greatly.

/cc @selansen

@codecov
Copy link

codecov bot commented May 7, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@36866a9). Click here to learn what that means.
The diff coverage is 52.94%.

@@            Coverage Diff            @@
##             master    #2855   +/-   ##
=========================================
  Coverage          ?   61.82%           
=========================================
  Files             ?      139           
  Lines             ?    22182           
  Branches          ?        0           
=========================================
  Hits              ?    13715           
  Misses            ?     6995           
  Partials          ?     1472

m.allocator, err = allocator.New(s, m.config.PluginGetter, m.config.NetworkConfig)
// Toss all this info into a netCfg, so that the allocator can do its
// thing.
netCfg := &cnmallocator.NetworkConfig{

Choose a reason for hiding this comment

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

why are you creating a new config instead of using m.config.NetworkConfig?

Copy link
Member

Choose a reason for hiding this comment

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

^^ @dperny good point; especially in light of;

The long-pending long-awaited allocator rewrite on the new-allocator branch removes cnmallocator, and doing this refactoring in an earlier commit will simplify that operation greatly.

Copy link

@jtestard jtestard left a comment

Choose a reason for hiding this comment

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

Looks good, a few question to improve my understanding

@thaJeztah
Copy link
Member

ping @selansen ptal

Copy link
Contributor

@selansen selansen left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning it up @dperny

LGTM

// NetworkConfig stores network related config for the cluster
NetworkConfig *cnmallocator.NetworkConfig
// DefaultAddrPool specifies default subnet pool for global scope networks
DefaultAddrPool []string
Copy link
Member

Choose a reason for hiding this comment

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

Previously, a pointer was used; are there situations where these could be nil (and for a reason?)

Actually wondering; should we just copy the NetworkConfig type here, and use that instead of defining these fields both here, and in node/node.go ?

Removes inappropriate import of manager/allocator/cnmallocator into
node/node.go. The consequence of this is that in upstream moby/moby, we
can remove that import as well. manager/allocator/cnmallocator is an
implementation detail, and importing it so high in the stack creates an
unacceptably high degree of coupling.

Signed-off-by: Drew Erny <[email protected]>
@dperny dperny force-pushed the remove-inappropriate-imports branch from c20d5e2 to dceb997 Compare February 17, 2023 15:20
@neersighted
Copy link
Member

PTAL @corhere

Copy link
Contributor

@corhere corhere left a comment

Choose a reason for hiding this comment

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

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants