mesosphere/kubernetes-mesos — pull request #103 by jdef (2014-12-08 20:40:33+00:00)
Title: k8sm:expose label to indicate that hostPort==0 should be exposed on an available port

This branch attempts to implement a solution for #59.

A special label `k8sm:expose` may be used to auto-publish a container port to the host, using any non-conflicting port in a mesos resource offer. Non-conflicting means that (a) it's in the "ports" resource range of the offer, and; (b) no other container in the pod has directly specified that pod as its HostPort.

`k8sm:expose` currently accepts a single value `'*'`, which auto-publishes all container ports with HostPort == 0 (wildcard ports). Current thinking is that the value of this label could also be a comma-delimited list of Port.ContainerPort's (int or string) to which the auto-publish rule would be applied.

TODOs:
- [ ] endpoint controller currently uses DesiredState to derive endpoints: this is a **problem** because currently the pod_task implementation doesn't overwrite DesiredState, which means that findPort() will return 0 for wildcard ports. perhaps our implementation of endpoint controller could query /boundPods on the kubelet? (would need to wait for rebase to 05x (see #88)).