fix ports panic (#6179)
Signed-off-by: rokkiter <101091030+rokkiter@users.noreply.github.com>
This commit is contained in:
parent
5b5a6ac6ad
commit
6e1263d3d9
1 changed files with 13 additions and 2 deletions
|
@ -66,7 +66,19 @@ func EndpointSliceToEndpoints(obj meta.Object) (meta.Object, error) {
|
||||||
} else {
|
} else {
|
||||||
e.Subsets[0].Ports = make([]EndpointPort, len(ends.Ports))
|
e.Subsets[0].Ports = make([]EndpointPort, len(ends.Ports))
|
||||||
for k, p := range ends.Ports {
|
for k, p := range ends.Ports {
|
||||||
ep := EndpointPort{Port: *p.Port, Name: *p.Name, Protocol: string(*p.Protocol)}
|
port := int32(-1)
|
||||||
|
name := ""
|
||||||
|
protocol := ""
|
||||||
|
if p.Port != nil {
|
||||||
|
port = *p.Port
|
||||||
|
}
|
||||||
|
if p.Name != nil {
|
||||||
|
name = *p.Name
|
||||||
|
}
|
||||||
|
if p.Protocol != nil {
|
||||||
|
protocol = string(*p.Protocol)
|
||||||
|
}
|
||||||
|
ep := EndpointPort{Port: port, Name: name, Protocol: protocol}
|
||||||
e.Subsets[0].Ports[k] = ep
|
e.Subsets[0].Ports[k] = ep
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +158,6 @@ func (e *Endpoints) DeepCopyObject() runtime.Object {
|
||||||
ep := EndpointPort{Port: p.Port, Name: p.Name, Protocol: p.Protocol}
|
ep := EndpointPort{Port: p.Port, Name: p.Name, Protocol: p.Protocol}
|
||||||
sub.Ports[k] = ep
|
sub.Ports[k] = ep
|
||||||
}
|
}
|
||||||
|
|
||||||
e1.Subsets[i] = sub
|
e1.Subsets[i] = sub
|
||||||
}
|
}
|
||||||
return e1
|
return e1
|
||||||
|
|
Loading…
Add table
Reference in a new issue