GoogleCloudPlatform/kubernetes — pull request #2166 by claire921 (2014-11-05 05:26:09+00:00)
Title: Refactor PodFitsPorts

The previous implementation of `PodFitsPorts` is not intuitive. It contains a deep for loop calling another deep for loop. Also the `containPort` function is not covered by test.

This pull request refactors the `PodFitPorts` function. It first gets all the ports used by existingPods and the ports potentially used by the new pod. And then check if there is a conflict. It improve the clarity and testability.

To sum up, this pull request:

1. Refactor the podFitsPorts function

2. Add tests for the utility function