-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Uses both binded HostIP and HostPort when useBindPortIP=true #3638
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
Conversation
provider/docker/config.go
Outdated
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.
could you return a pointer (*nat.PortBinding) instead of a struct?
provider/docker/config.go
Outdated
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.
return nil.
https://github.com/golang/go/wiki/CodeReviewComments#error-strings
fmt.Errorf("unable to find the external IP:Port for the container %q", container.Name)
provider/docker/config.go
Outdated
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.
could you create a function that returns an error to replace the continue
provider/docker/config.go
Outdated
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.
fail fast: could you invert the condition:
if portBinding.HostIP == "0.0.0.0" {
// ...
}
// ...The else is not needed.
provider/docker/config.go
Outdated
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.
the map initialization must be done before.
provider/docker/deprecated_config.go
Outdated
| "getPort": getPortV1, | ||
| "getWeight": getFuncIntLabelV1(label.TraefikWeight, label.DefaultWeight), | ||
| "getProtocol": getFuncStringLabelV1(label.TraefikProtocol, label.DefaultProtocol), | ||
| "getDeprecatedIPAddress": p.getDeprecatedIPAddress, |
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.
Should be "getIPAddress" instead of "getDeprecatedIPAddress"
provider/docker/config.go
Outdated
| "getBuffering": label.GetBuffering, | ||
| "getCircuitBreaker": label.GetCircuitBreaker, | ||
| "getLoadBalancer": label.GetLoadBalancer, | ||
| "getDeprecatedIPAddress": p.getDeprecatedIPAddress, // TODO: Should we expose getIPPort instead? |
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.
Should be "getIPAddress" instead of "getDeprecatedIPAddress"
ldez
left a 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.
LGTM
mmatur
left a 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.
LGTM
nmengin
left a 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.
LGTM 🐳 👏
What does this PR do?
Context: docker provider with usebindportip
Currently:
traefik.portis specified, it is used both for selecting the binding and in the routeThis PR:
traefik.portis used to select the binding (which enables the use of segments)To sum it up:
traefik.portnot setIP_E1:P_E1:P_I1IP_E1:P_E1traefik.portnot setP_E1:P_I10.0.0.0)traefik.portnot settraefik.port=P_I1IP_E1:P_E1:P_I1IP_E1:P_E1traefik.port=P_I2IP_E1:P_E1:P_I1XX:XX:P_I2)traefik.port=P_I2IP_E1:P_E1:P_I1&IP_E2:P_E2:P_I2IP_E2:P_E2traefik.port=P_I1Motivation
Fixes #3622
(kudos to @systemmonkey42 for the awesome description in the issue)
More
Examples
docker-compose.yml
traefik/api
{ "docker": { "backends": { "backend-whoami": { "servers": { "server-issue-3622-whoami-1-1-7c60b6958b968de9998659c11d7406a0": { "url": "http://xx.xx.xx.xx:8082", "weight": 1 } }, }, "backend-whoami-4": { "servers": { "server-issue-3622-whoami-4-1-5dcf432359cd6ad04e1779a85d45314a": { "url": "http://xx.xx.xx.xx:8085", "weight": 1 } }, }, "backend-whoami-6": { "servers": { "server-issue-3622-whoami-6-1-554f0078ab3c259e14fc03848f9f8ce4": { "url": "http://xx.xx.xx.xx:8088", "weight": 1 } }, } }, } }