Don't include port in config when not specified.

When no port is specified the flag default of "-1" is taken.

Fixes #4305
This commit is contained in:
Victor Marmol
2015-02-11 13:20:51 -08:00
parent d10ae1ee89
commit 6a80553d7b
2 changed files with 9 additions and 4 deletions

View File

@@ -79,10 +79,14 @@ func (BasicReplicationController) Generate(params map[string]string) (runtime.Ob
if err != nil {
return nil, err
}
controller.Spec.Template.Spec.Containers[0].Ports = []api.Port{
{
ContainerPort: port,
},
// Don't include the port if it was not specified.
if port > 0 {
controller.Spec.Template.Spec.Containers[0].Ports = []api.Port{
{
ContainerPort: port,
},
}
}
}
return &controller, nil