-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat: create vpc objects in explicitly provided availability zones #4950
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @synthe102. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
2f7fce6
to
fab5efd
Compare
/ok-to-test |
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.
Please change the release note to something that's readable by users (.spec.vpc
) instead of developers (VPCSpec
), and best use a verb to describe the change.
3e9ce4e
to
ca10c55
Compare
@AndiDog Thanks a lot for this initial review. I addressed all your comments, all the tests are OK so far. |
/test pull-cluster-api-provider-aws-verify |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
I have a few minor suggestions that can mostly be included directly. Looks good overall. Only a rebase is needed after those changes, so the PR is mergeable (you may just have some conflicts that go away with git rebase origin/main && make generate
).
// by default, we will take the set availability zones, if they are defined. | ||
// if not, we fall back to the two other settings. |
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.
"the two other" is a statement that could easily become outdated. Let's prefer absolute terms in documentation and comments:
// by default, we will take the set availability zones, if they are defined. | |
// if not, we fall back to the two other settings. | |
// By default, take the set availability zones. If they are not defined, | |
// fall back to `availabilityZoneUsageLimit`/`availabilityZoneSelection` |
} | ||
if selectionScheme == infrav1.AZSelectionSchemeOrdered { |
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.
} | |
if selectionScheme == infrav1.AZSelectionSchemeOrdered { | |
} else if selectionScheme == infrav1.AZSelectionSchemeOrdered { |
@@ -3071,6 +3071,176 @@ func TestReconcileSubnets(t *testing.T) { | |||
stubMockCreateTagsWithContext(m, "test-cluster", "subnet-az-1a-private", "us-east-1a", "private", false).AnyTimes() | |||
}, | |||
}, | |||
{ | |||
name: "Managed VPC, no existing subnets exist, one az is explicitly defined, expect one private and one public from default", |
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.
name: "Managed VPC, no existing subnets exist, one az is explicitly defined, expect one private and one public from default", | |
name: "Managed VPC, no subnets exist, one az is explicitly defined, expect one private and one public from default", |
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | ||
Return(&ec2.DescribeAvailabilityZonesOutput{ | ||
AvailabilityZones: []*ec2.AvailabilityZone{ | ||
{ | ||
ZoneName: aws.String("us-east-1b"), | ||
ZoneType: aws.String("availability-zone"), | ||
}, | ||
}, | ||
}, nil) | ||
|
||
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | ||
Return(&ec2.DescribeAvailabilityZonesOutput{ | ||
AvailabilityZones: []*ec2.AvailabilityZone{ | ||
{ | ||
ZoneName: aws.String("us-east-1b"), | ||
ZoneType: aws.String("availability-zone"), | ||
}, | ||
}, | ||
}, nil) | ||
|
||
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | ||
Return(&ec2.DescribeAvailabilityZonesOutput{ | ||
AvailabilityZones: []*ec2.AvailabilityZone{ | ||
{ | ||
ZoneName: aws.String("us-east-1b"), | ||
ZoneType: aws.String("availability-zone"), | ||
}, | ||
}, | ||
}, nil) |
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.
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | |
Return(&ec2.DescribeAvailabilityZonesOutput{ | |
AvailabilityZones: []*ec2.AvailabilityZone{ | |
{ | |
ZoneName: aws.String("us-east-1b"), | |
ZoneType: aws.String("availability-zone"), | |
}, | |
}, | |
}, nil) | |
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | |
Return(&ec2.DescribeAvailabilityZonesOutput{ | |
AvailabilityZones: []*ec2.AvailabilityZone{ | |
{ | |
ZoneName: aws.String("us-east-1b"), | |
ZoneType: aws.String("availability-zone"), | |
}, | |
}, | |
}, nil) | |
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | |
Return(&ec2.DescribeAvailabilityZonesOutput{ | |
AvailabilityZones: []*ec2.AvailabilityZone{ | |
{ | |
ZoneName: aws.String("us-east-1b"), | |
ZoneType: aws.String("availability-zone"), | |
}, | |
}, | |
}, nil) | |
m.DescribeAvailabilityZonesWithContext(context.TODO(), gomock.Any()). | |
Return(&ec2.DescribeAvailabilityZonesOutput{ | |
AvailabilityZones: []*ec2.AvailabilityZone{ | |
{ | |
ZoneName: aws.String("us-east-1b"), | |
ZoneType: aws.String("availability-zone"), | |
}, | |
}, | |
}, nil).Times(3) // short comment why this is called multiple times (e.g. current implementation detail, loop through 3 objects, ... – this otherwise looks like a bug 🤷) |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #4333, continues the work started by @Skarlso in this PR by:
AvailabilityZoneSelection
andAvailabilityZoneUsageLimit
into defaulting webhooks instead of CRDsAvailabilityZoneUsageLimit
andAvailabilityZoneSelection
withAvailabilityZones
Special notes for your reviewer:
Checklist:
Release note: