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 ipv6 startup fail #81870 #87108
fix ipv6 startup fail #81870 #87108
Conversation
Does it still work when you provide the IP in [] brackets? Wouldn't want to break peoples setups. |
I think it should be backwards compatible as a few people might already specify ip addresses with brackets. |
There are a few different concerns here, firstly with the current code an ipv6 address wrapped in square brackets will fail because net.ParseIP will fail and return nil in that case, so we can at least exclude that possibility. The first thing we should likely do is to correctly handle an error parsing the provided address, but to fix that we'll need to update the applyGrafanaConfig function so it can return an error. With that change, if net.ParseIP returns nil we can return an error. Once we have a valid IP, we can use netip.AddrFromSlice to get a valid Addr from our IP (and handle any errors), then pass that to netip.AddrPortFrom (together with the port) and finally use MarshalText on the returned AddrPort to generate the host string with ipv6 addresses properly wrapped in square brackets (again checking that the returned string is not empty and returning an error). |
i think this suggestion is very helpeful, i will update my code. |
new pr is compatible |
Hello @toddtreece!
Please, if the current pull request addresses a bug fix, label it with the |
This PR must be merged before a backport PR will be created. |
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.
LGTM
@yincongcyincong it looks like your earlier commits have an email address that doesn't match your github account, which is causing the CLA bot to reject the PR. I think you can fix that by adding your baidu email address to your github profile here. |
thanks, bro. i have added my baidu email. |
Which issue(s) does this PR fix?:
When the ipv6 configuration is not enclosed in square brackets,apiserver printed a fatal log and exited.
https://github.com/kubernetes/apiserver/blob/master/pkg/server/config.go#L686
I solve the issue. When the ip is ipv6, it enclose in square brackets.
Fixes #81870 #81870