Skip to content

Commit

Permalink
enhance: Kubernetes-HostPort plugin support to wait for network ready (
Browse files Browse the repository at this point in the history
…#136)

Signed-off-by: ChrisLiu <chrisliu1995@163.com>
  • Loading branch information
chrisliu1995 authored Apr 26, 2024
1 parent 4829414 commit 56d9071
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions cloudprovider/kubernetes/hostPort.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 56d9071

Please sign in to comment.