-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
run, create, connect: add support for gw-priority #5664
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably a bit late realising, but should this have been a uint, or do we expect negative values to be ok? 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an int on purpose as it allows to set the priority to a negative value when some existing endpoints have the default priority
0
set. @robmry wrote about that here: moby/moby#48936 (comment)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But wasn't higher higher priority, so if I want a new network to become the default, I need to give it a higher priority?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. But if one of the current network give you a default gateway, and you want to stick with it, you can connect new networks with a negative priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(mostly considering if it's zero, then I did not consider it a priority (and alphabetic order is used), and only if I would explicitly want a network to take priority, I'd probably set a non-zero value; any value lower (including zero) would not take priority in that case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might consider priority of existing endpoints only when you connect a new network. In that case, having the ability to set a negative priority gives you a way to not touch the existing endpoint(s), but still get the behavior you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm good with this for now; perhaps we should brainstorm next week to see if there's still things to be done here.
ddd
) withoutgw_priority
; this becomes the default gatewayccc
) withoutgw_priority
; this sorts beforeddd
, so now takes over default gatewaygw_priority=-999
to make sure it doesn't capture the gatewayaaa
. I don't want that to take over the default gateway, so I setgw_priority=-999
.-999
was already set forccc
, so those are now "same priority", except for name.bbb
), but do NOT set agw_priority
, it would takeover the default gateway fromddd
(as those both have0
priority)So, yes, there's some more controls here, but it's also shifting the goal-posts, and we may now end up with something similar to
z-index
oroomscore-adjust
; "let's pick a high enough value" or "low enough value" that probably no other network has picked. Or at least, these numbers will become rather complicated to use, without eitherI think at least we should consider setting a limit (which could be same as oom-score-adjust, e.g.
-999 - 999
); not sure if we need the whole range of +/- MAXINT32.But perhaps we need to look at some other logic as well; I think in most cases, I'd expect the gateway to not change unless I want it to (i.e., once it's set, connecting another network should not change it, unless I want that new one to take over); almost considering if some of the enumerating could be handled daemon-side ("put me first, shift others one position down"), but that would mostly be for connecting to an existing container (for "create container with multiple networks", I could see a more declarative aproach being good).