-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Don't wrongly identify endpoint addresses only due to equal IP #10390
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
Don't wrongly identify endpoint addresses only due to equal IP #10390
Conversation
/cc @jdef |
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
/cc @thockin |
There's a documented known k8s-mesos issue that requires users to name service ports. Related? |
@jdef it's related. This PR does two things:
|
Is this dependent on #10049? |
No dependency on #10049. |
Can you show me an example input that produces wrong output and explain? I am terrified of touching this code, given the bugs we had in crafting it in the first place. |
test/e2e/service.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.
I don't understand this batch of changes?
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.
If endpoints for a pod do not inherit container IP and container port, we have to use something like the service port name to find the correct endpoints for the test. That's why I changed the port into the port name and adapted the test condition accordingly.
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 not quite sure I understand - is this because the port numbers in the pod.spec.containers[].ports[].port are not th actual port numbers exposed by endpoints (because of your host port remapping?)
This is a pretty significant change to this test and likely to get broken - most ports are NOT named, especially in tests - can you comment this requirement near the place we create pods in this test?
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 endpoint might have a different IP than the container IP and a different port than the service port. The change above uses named port in order to get the matching right in the test between the service and the endpoint b/c this is verified in the test. And because the port is not suitable anymore for the matching, we need these names as an alternative.
It's important to note that this change is only necessary for these very tests which check the existence of correct endpoints. Of course other services in different tests don't need named ports.
I will add proper comments.
@thockin an example of input for RepackSubsets which fails: [
{
"Addresses": [
{ "IP": "192.168.0.1", "TargetRef": { "Kind": "Pod", "Name": "pod1", "UID": "1" } },
],
"Ports": [ { "Name": "http", "Port": 8080, "Protocol": "TCP" } ]
}, {
"Addresses": [
{ "IP": "192.168.0.1", "TargetRef": { "Kind": "Pod", "Name": "pod2", "UID": "2" } },
],
"Ports": [ { "Name": "redis", "Port": 6379, "Protocol": "TCP" } ]
}
] Before this PR this is repacked to [
{
"Addresses": [
{ "IP": "192.168.0.1", "TargetRef": { "Kind": "Pod", "Name": "pod1", "UID": "1" } },
],
"Ports": [
{ "Name": "http", "Port": 8080, "Protocol": "TCP" },
{ "Name": "redis", "Port": 6379, "Protocol": "TCP" }
]
}
] In the endpoint e2e tests (in
With this PR the UID is assumed to be different if the pod is different and taken into consideration when identifying addresses and when sorting them. |
I see the problem now, of course. |
@thockin can you send me or paste the shippable output which fails? |
!!! 'gofmt -s' needs to be run on the following files: On Mon, Jun 29, 2015 at 6:53 AM, Dr. Stefan Schimanski <
|
Fixed the gofmt issues. |
LGTM |
Shippable says:
|
c8f22d7
to
a50e228
Compare
2df3501
to
6d73a04
Compare
Assigning to @thockin to sequester to post-v1 or review. |
ca65323
to
1a099e2
Compare
GCE e2e build/test failed for commit 1a099e2ebe322c26bbafe39b4b2b6bed3aa1aadc. |
GCE e2e build/test failed for commit d3131eb56b40540240bdeb8edfffcb7202c11cd0. |
@thockin could you paste the failing e2e test here? |
d3131eb
to
1a08e4b
Compare
GCE e2e build/test failed for commit 1a08e4b0613b379a58368b2b9da199efa80815ff. |
1a08e4b
to
6da82a9
Compare
GCE e2e build/test failed for commit 6da82a94d6d59304c2f4e77f3f9c8a41c2b1cb1c. |
@k8s-bot test this please |
GCE e2e build/test failed for commit 6da82a94d6d59304c2f4e77f3f9c8a41c2b1cb1c. |
6da82a9
to
82b4c11
Compare
I removed everything not directly related to the actual IP->UID change in the endpoint repacking algorithm. Everything related to fixing the e2e tests is moved to the mesosphere-backup#41 PR. |
GCE e2e build/test passed for commit 82b4c114c5c0cce3d5e3e003e3576c007507cc41. |
lgtm @thockin, does this still look good? |
needs rebase |
Before this patch the endpoint IP was used to identify endpoint addresses. This leads to wrong unification of endpoints of different pods having the same IP (e.g. non container IP in case of Mesos). This patch takes the EndpointAddress.targetRef.UID into consideration as well.
82b4c11
to
79e54c2
Compare
GCE e2e build/test passed for commit 79e54c2. |
Rebased. |
Don't wrongly identify endpoint addresses only due to equal IP
Before this PR the endpoint IP was used to identify endpoint addresses. This
leads to wrong unification of endpoints of different pods having the same IP (e.g.
non container IP in case of Mesos). This PR takes the EndpointAddress.targetRef.UID
into consideration instead of the IP.
In combination with the followup PR mesosphere-backup#41 this fixes the following e2e tests for
KUBERNETES_PROVIDER=mesos/docker
: