From 4ec1a65e3ac8dd558206e5a36ad01d910a7b41bd Mon Sep 17 00:00:00 2001 From: ChrisLiu <70144550+chrisliu1995@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:48:41 +0800 Subject: [PATCH] fix AlibabaCloud-NATGW network ready condition when multi-ports (#94) Signed-off-by: ChrisLiu --- cloudprovider/alibabacloud/natgw.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cloudprovider/alibabacloud/natgw.go b/cloudprovider/alibabacloud/natgw.go index ce289da1..324ff53a 100644 --- a/cloudprovider/alibabacloud/natgw.go +++ b/cloudprovider/alibabacloud/natgw.go @@ -122,7 +122,12 @@ func (n NatGwPlugin) OnPodUpdated(c client.Client, pod *corev1.Pod, ctx context. } networkStatus.InternalAddresses = internalAddresses networkStatus.ExternalAddresses = externalAddresses - networkStatus.CurrentNetworkState = gamekruiseiov1alpha1.NetworkReady + + // NetworkReady when all ports have external addresses + if len(strings.Split(pod.Annotations[PortsAnsKey], ",")) == len(podDNat.Status.Entries) { + networkStatus.CurrentNetworkState = gamekruiseiov1alpha1.NetworkReady + } + pod, err = networkManager.UpdateNetworkStatus(*networkStatus, pod) return pod, errors.ToPluginError(err, errors.InternalError) }