mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +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 {
|
func portsFromString(spec string) []api.Port {
|
||||||
|
if spec == "" {
|
||||||
|
return []api.Port{}
|
||||||
|
}
|
||||||
parts := strings.Split(spec, ",")
|
parts := strings.Split(spec, ",")
|
||||||
var result []api.Port
|
var result []api.Port
|
||||||
for _, part := range parts {
|
for _, part := range parts {
|
||||||
|
@ -285,6 +285,10 @@ func TestMakePorts(t *testing.T) {
|
|||||||
{HostPort: 443, ContainerPort: 444},
|
{HostPort: 443, ContainerPort: 444},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"",
|
||||||
|
[]api.Port{},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range testCases {
|
for _, tt := range testCases {
|
||||||
ports := portsFromString(tt.spec)
|
ports := portsFromString(tt.spec)
|
||||||
|
Loading…
Reference in New Issue
Block a user