mon: fix bind addr when IPv6 and msgr2 are enabled (backport #14248) #14261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When IPv6-only network mode is enabled and when mons are configured to listen only on msgrV2 port, Rook has to add the port to the mon --public-bind-addr in order to force mons to stop listening on the msgrV1 port. This can cause problems for IPv6 clusters where adding ':' to the end of an IP addr looks like a valid IPv6 address.
In IPv6 mode, Rook needs to set this to
[<ip>]:<port>
with the brackets to be a non-ambiguous IPv6 address.In IPv4 mode, Rook needs to keep its existing behavior. IPv4 mode should also continue to be the defualt assumption if the network config isn't specified.
If
dualStack: true
is specified, Rook is informed that the environment is dual stack, but Rook doesn't know which IP family to expect from the pod IP. In this scenario, it is safest for Rook not to apply the port, since assuming either IPv4 or IPv6 format could be incorrect. In this scenario, mons may still listen on msgrV1 ports, but this is preferable to an environment where mons perpetually crash.Checklist:
This is an automatic backport of pull request #14248 done by [Mergify](https://mergify.com).