Skip to content
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 e2e endpoints tests on Mesos #12410

Conversation

sttts
Copy link
Contributor

@sttts sttts commented Aug 7, 2015

Before this PR endpoints were validated by container IP and port in a number of e2e tests.
Depending on the endpoint controller logic neither of the two must match for a valid endpoint (e.g. in a Mesos setup).

This PR fixes the service.go e2e tests to compare the pod ID of an endpoint instead of the IP.

Moreover, it makes sure the compared port is the actual container port, not the host port.
The implemented solution for recovering the container ports from an endpoint in the case of Mesos clusters are annotations on the endpoints. These are applied by the Mesos endpoint conroller to be able to lookup the container port which is not part of the EndpointPort struct.

sttts added 3 commits August 7, 2015 20:13
Before this patch endpoints were validated by container IP and port.
Depending on the endpoint controller logic neither of the two must match for a
valid endpoint (e.g. in a Mesos setup).

This patch checks that the endpoint targetRef points to the right pod by UID,
instead of comparing IPs.

A later patch will make sure the
compared port is the actual container port, not the host port.

/xref d2iq-archive/kubernetes-mesos#365
The EndpointPort struct only stores one port: the port which is used
to connect to the container from outside. In the case of the Mesos
endpoint controller this is the host port. The container port is not part
of the endpoint structure at all.

A number of e2e tests need the container port information to validate correct
endpoint creation. Therefore this patch annotates the Endpoint struct with a
number of annotations mapping "<HostIP>:<HostPort>" to "<ContainerPort>". In a
follow-up commit these annotations are used to validate endpoints in a Mesos
setup.
@k8s-bot
Copy link

k8s-bot commented Aug 7, 2015

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.

@sttts
Copy link
Contributor Author

sttts commented Aug 7, 2015

/cc @jdef for internal review


// use endpoint annotations to recover the container port in a Mesos setup
// compare contrib/mesos/pkg/service/endpoints_controller.syncService
// TODO(sttts): add ContainerPort to EndpointPort struct, defaulting to (host) Port
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure about this TODO, doesn't really seem like the right way to solve this. perhaps remove the TODO here and add an issue for tracking this idea in the k8s-mesos repo?

@jdef
Copy link
Contributor

jdef commented Aug 7, 2015

minor doc nit, otherwise lgtm.

/cc @thockin

@sttts sttts changed the title WIP/MESOS: Non unique endpoint ip no port names Fix e2e endpoints tests on Mesos Aug 7, 2015
@satnam6502 satnam6502 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2015
@satnam6502 satnam6502 assigned satnam6502 and jdef and unassigned satnam6502 Aug 7, 2015
@thockin
Copy link
Member

thockin commented Aug 8, 2015

LGTM

a-robinson added a commit that referenced this pull request Aug 10, 2015
…ort-names

Fix e2e endpoints tests on Mesos
@a-robinson a-robinson merged commit 1ad9015 into kubernetes:master Aug 10, 2015
@sttts sttts deleted the non-unique-endpoint-ip-no-port-names branch September 14, 2015 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants