fix AlibabaCloud-NATGW network ready condition when multi-ports (#94)

Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
ChrisLiu 2023-08-30 10:48:41 +08:00 committed by GitHub
parent 3d523f9611
commit 4ec1a65e3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -122,7 +122,12 @@ func (n NatGwPlugin) OnPodUpdated(c client.Client, pod *corev1.Pod, ctx context.
} }
networkStatus.InternalAddresses = internalAddresses networkStatus.InternalAddresses = internalAddresses
networkStatus.ExternalAddresses = externalAddresses 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) pod, err = networkManager.UpdateNetworkStatus(*networkStatus, pod)
return pod, errors.ToPluginError(err, errors.InternalError) return pod, errors.ToPluginError(err, errors.InternalError)
} }