mirror of https://github.com/kubernetes/kops.git
Alicloud: fix comparison failures for vswitchSNAT
This commit is contained in:
parent
77e35aef2f
commit
563cb2f861
|
@ -57,8 +57,8 @@ func (v *VSwitchSNAT) Find(c *fi.Context) (*VSwitchSNAT, error) {
|
|||
klog.V(4).Infof("NatGateway / NatGatewayId not found for %s, skipping Find", fi.StringValue(v.Name))
|
||||
return nil, nil
|
||||
}
|
||||
if v.EIP == nil || v.EIP.IpAddress == nil {
|
||||
klog.V(4).Infof("EIP / EIP not found for %s, skipping Find", fi.StringValue(v.Name))
|
||||
if v.EIP == nil || v.EIP.Name == nil {
|
||||
klog.V(4).Infof("EIP / EIPName not found for %s, skipping Find", fi.StringValue(v.Name))
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,28 @@ func (v *VSwitchSNAT) Find(c *fi.Context) (*VSwitchSNAT, error) {
|
|||
actual.Name = v.Name
|
||||
actual.Lifecycle = v.Lifecycle
|
||||
|
||||
describeEIPArgs := &ecs.DescribeEipAddressesArgs{
|
||||
RegionId: common.Region(cloud.Region()),
|
||||
EipAddress: snatEntry.SnatIp,
|
||||
}
|
||||
|
||||
eips, _, err := cloud.VpcClient().DescribeEipAddresses(describeEIPArgs)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error listing EIP: %v", err)
|
||||
}
|
||||
|
||||
if len(eips) == 0 {
|
||||
klog.V(4).Infof("EIP not found for %s, skipping Find", snatEntry.SnatIp)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
eip := eips[0]
|
||||
|
||||
actual.EIP = &EIP{
|
||||
ID: &eip.AllocationId,
|
||||
IpAddress: &eip.IpAddress,
|
||||
}
|
||||
|
||||
return actual, nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue