mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #4345 from vmarmol/noports
Don't include port in config when not specified.
This commit is contained in:
commit
b9d6b3b547
@ -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
|
||||
|
@ -34,6 +34,7 @@ func TestGenerate(t *testing.T) {
|
||||
"name": "foo",
|
||||
"image": "someimage",
|
||||
"replicas": "1",
|
||||
"port": "-1",
|
||||
},
|
||||
expected: &api.ReplicationController{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
|
Loading…
Reference in New Issue
Block a user