mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Ignore empty pod port spec.
This commit is contained in:
parent
fd5a908070
commit
7640280284
@ -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 {
|
||||
|
@ -285,6 +285,10 @@ func TestMakePorts(t *testing.T) {
|
||||
{HostPort: 443, ContainerPort: 444},
|
||||
},
|
||||
},
|
||||
{
|
||||
"",
|
||||
[]api.Port{},
|
||||
},
|
||||
}
|
||||
for _, tt := range testCases {
|
||||
ports := portsFromString(tt.spec)
|
||||
|
Loading…
Reference in New Issue
Block a user