-
Notifications
You must be signed in to change notification settings - Fork 579
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: allow for specifying subnet type for az #4464
Conversation
Hi @davidspek. 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. |
3e75891
to
1fbc21f
Compare
Likely, no new feature is needed. Please try this: apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachinePool
spec:
subnets:
- filters:
- name: tag:kubernetes.io/cluster/mycluster
values:
- shared
- owned
- name: tag:sigs.k8s.io/cluster-api-provider-aws/role
values:
- private
# [...] |
We are using |
@AndiDog Also, I don't think the subnet filter works alongside the specified availability zones. We need to be able to specify the type of subnet ( |
Code-wise, for I'd love if EKS types became more consistent with non-EKS. At best, we would implement You said in chat
Can you explain what that means? Did you hit a roadblock implementing that? |
The So in short The |
/ok-to-test |
/retest |
1fbc21f
to
7b55113
Compare
@richardcase The tests pass now. |
All true! I think on top of the tag |
@richardcase The above ideas (not what the PR currently implements) would be breaking changes and probably we can consider that on top of the |
@@ -52,6 +52,11 @@ type AWSMachinePoolSpec struct { | |||
// AvailabilityZones is an array of availability zones instances can run in | |||
AvailabilityZones []string `json:"availabilityZones,omitempty"` | |||
|
|||
// AvailabilityZoneSubnetType specifies which type of subnets to use when an availability zone is specified. | |||
// +kubebuilder:validation:Enum:=public;private |
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.
Should we also add the existing situation as well explicitly (i.e. all
or publicandprivate
)?
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.
So that people can explicitly choose that.
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 can definitely add that. Currently not setting the value does that, but we could add an explicit toggle for it as well in case the default logic changes in the future.
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.
@richardcase I've rebased and added an option for all
along with updated unit tests.
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.
Thanks @davidspek ...i'll take a look
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.
Thanks!
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
3d4ec2a
to
10d8620
Compare
@richardcase Have you been able to take another look at this? |
@AndiDog Maybe you can also have a look here since you've just become a member. |
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.
/lgtm
Looks good. Did you also test this successfully for your use case?
@AndiDog Yes, I've built an image for the controller and been able to successfully deploy AWSManagedMachinePool resources that specify the AZs as well as the new |
@AndiDog @richardcase What's left before this can be merged? |
Friendly ping @richardcase @AndiDog |
/test pull-cluster-api-provider-aws-e2e |
/approve until tests passes. @davidspek feel free to unhold once tests passes |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Ankitasw The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/unhold |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Currently when specifying the availability zone(s) for a (managed) machine pool, all the subnets in the zone(s) will be used. By default CAPI creates both a public and a private subnet in each availability zone. So when a machine pool specifies an availability zone, both the public and private subnets for the zone are used for the machine pool. It seems as though the private subnet is preferred in the ASG, however, I haven't been able to find any documentation regarding which subnet an instance gets launched in when an ASG contains both a private and public subnet. This means it's nondeterministic in which subnet an instance of the ASG will be launched in.
To solve for this, a new optional parameter
AvailabilityZoneSubnetType
is added to theAWSManagedMachinePool
andAWSMachinePool
specs allowing administrators to choose if the machine pool should use public or private subnets in the requested availability zones. If the parameter isn't specified the current behavior is kept where both public and private subnets in the availability zone(s) are used. This is also related to #2191 where the preferred subnet type isprivate
when no options are specified, but doing this currently isn't possible when specifying availability zone(s) for a machine pool.Which issue(s) this PR fixes:
Fixes #2991
Special notes for your reviewer:
Checklist:
Release note: