From f33f0182bf2d43bb5e53d745721255f386ea8646 Mon Sep 17 00:00:00 2001 From: ChrisLiu Date: Tue, 9 Apr 2024 15:20:23 +0800 Subject: [PATCH] enhance: Kubernetes-HostPort plugin support to wait for network ready Signed-off-by: ChrisLiu --- cloudprovider/kubernetes/hostPort.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cloudprovider/kubernetes/hostPort.go b/cloudprovider/kubernetes/hostPort.go index b8c47e51..36031189 100644 --- a/cloudprovider/kubernetes/hostPort.go +++ b/cloudprovider/kubernetes/hostPort.go @@ -130,10 +130,6 @@ func (hpp *HostPortPlugin) OnPodUpdated(c client.Client, pod *corev1.Pod, ctx co nodeIp := getAddress(node) networkManager := utils.NewNetworkManager(pod, c) - status, _ := networkManager.GetNetworkStatus() - if status != nil { - return pod, nil - } iNetworkPorts := make([]gamekruiseiov1alpha1.NetworkPort, 0) eNetworkPorts := make([]gamekruiseiov1alpha1.NetworkPort, 0) @@ -157,7 +153,7 @@ func (hpp *HostPortPlugin) OnPodUpdated(c client.Client, pod *corev1.Pod, ctx co } // network not ready - if len(iNetworkPorts) == 0 || len(eNetworkPorts) == 0 { + if len(iNetworkPorts) == 0 || len(eNetworkPorts) == 0 || pod.Status.PodIP == "" { pod, err := networkManager.UpdateNetworkStatus(gamekruiseiov1alpha1.NetworkStatus{ CurrentNetworkState: gamekruiseiov1alpha1.NetworkNotReady, }, pod)