mirror of https://github.com/k3s-io/k3s
kubenet: Update empty ip check
The previous check was incorrect because the `IP.String` method returns `<nil>` and other non-empty-strings on error conditions.pull/6/head
parent
c4b8959a75
commit
93487867ac
|
@ -317,7 +317,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if res.IP4 == nil || res.IP4.IP.IP.String() == "" {
|
||||
if res.IP4 == nil || len(res.IP4.IP.IP) != net.IPv4len {
|
||||
return fmt.Errorf("CNI plugin reported no IPv4 address for container %v.", id)
|
||||
}
|
||||
plugin.podIPs[id] = res.IP4.IP.IP.String()
|
||||
|
|
Loading…
Reference in New Issue