Conversation
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
@@ -250,7 +250,7 @@ func (d *Driver) Create() error { | |||
} | |||
|
|||
for _, s := range subnets { | |||
if s.AvailabilityZone == regionZone { | |||
if s.AvailabilityZone == regionZone && s.VpcId == d.VpcId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both availability zone and VPC id can be passed as Filter.N
params in the call to DescribeSubnets
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might also be reasonable to see if one of the subnets is the default for the AZ and prefer that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to both :) - i wanted to try not to do too much in our ec2 implementation as eventually we will be moving to the official sdk but i think this works better for this case. thanks!
This fixes my problem from #663 👍 |
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
@md5 PTAL |
@md5 it should "fallback" safely. It will only check for the default if there is more than one and will only set it if there is one marked. Otherwise, it uses the first one it finds. |
@md5 i'm not sure what you mean by log the err -- if an error occurs while waiting on the IP, it's returned. |
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
It's possible to have more than one subnet with none marked as
defaultForAz, I believe.
Regarding my other concern, I misspoke. I meant the case where ip keeps
being "" and err is also nil.
|
Correct. In the case where one is marked as default it will use that one. Otherwise it will just use the one already set. We need a retry and timeout function in the amz lib itself. I'll look into this for better retry and timeout support. Thanks! |
Ah gotcha. Good point. |
LGTM I had missed the |
ec2: check subnet exists in vpc
Fixes #663
This also fixes the IP allocation eventual consistency.