Ignore empty pod port spec.

This commit is contained in:
Deyuan Deng 2014-10-03 21:38:29 -04:00
parent fd5a908070
commit 7640280284
2 changed files with 7 additions and 0 deletions

View File

@ -159,6 +159,9 @@ func ResizeController(ctx api.Context, name string, replicas int, client client.
}
func portsFromString(spec string) []api.Port {
if spec == "" {
return []api.Port{}
}
parts := strings.Split(spec, ",")
var result []api.Port
for _, part := range parts {

View File

@ -285,6 +285,10 @@ func TestMakePorts(t *testing.T) {
{HostPort: 443, ContainerPort: 444},
},
},
{
"",
[]api.Port{},
},
}
for _, tt := range testCases {
ports := portsFromString(tt.spec)