mirror of https://github.com/k3s-io/k3s
Don't include port in config when not specified.
When no port is specified the flag default of "-1" is taken. Fixes #4305pull/6/head
parent
d10ae1ee89
commit
6a80553d7b
|
@ -79,11 +79,15 @@ func (BasicReplicationController) Generate(params map[string]string) (runtime.Ob
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't include the port if it was not specified.
|
||||||
|
if port > 0 {
|
||||||
controller.Spec.Template.Spec.Containers[0].Ports = []api.Port{
|
controller.Spec.Template.Spec.Containers[0].Ports = []api.Port{
|
||||||
{
|
{
|
||||||
ContainerPort: port,
|
ContainerPort: port,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return &controller, nil
|
return &controller, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ func TestGenerate(t *testing.T) {
|
||||||
"name": "foo",
|
"name": "foo",
|
||||||
"image": "someimage",
|
"image": "someimage",
|
||||||
"replicas": "1",
|
"replicas": "1",
|
||||||
|
"port": "-1",
|
||||||
},
|
},
|
||||||
expected: &api.ReplicationController{
|
expected: &api.ReplicationController{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
|
Loading…
Reference in New Issue