Skip to content
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 #4543

Closed
wants to merge 1 commit into from

Conversation

Skarlso
Copy link
Contributor

@Skarlso Skarlso commented Oct 5, 2023

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

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Release note:

 Ability to specify Availability Zones from the VPCSpec object.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 5, 2023
@k8s-ci-robot k8s-ci-robot added needs-priority size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 5, 2023
@Skarlso
Copy link
Contributor Author

Skarlso commented Oct 5, 2023

Oh totally forgot all the conversion shenanigans.

@Skarlso
Copy link
Contributor Author

Skarlso commented Oct 6, 2023

/test ?

@k8s-ci-robot
Copy link
Contributor

@Skarlso: The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-aws-build
  • /test pull-cluster-api-provider-aws-test
  • /test pull-cluster-api-provider-aws-verify

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-aws-apidiff-main
  • /test pull-cluster-api-provider-aws-e2e
  • /test pull-cluster-api-provider-aws-e2e-blocking
  • /test pull-cluster-api-provider-aws-e2e-clusterclass
  • /test pull-cluster-api-provider-aws-e2e-conformance
  • /test pull-cluster-api-provider-aws-e2e-conformance-with-ci-artifacts
  • /test pull-cluster-api-provider-aws-e2e-eks
  • /test pull-cluster-api-provider-aws-e2e-eks-gc
  • /test pull-cluster-api-provider-aws-e2e-eks-testing

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-aws-apidiff-main
  • pull-cluster-api-provider-aws-build
  • pull-cluster-api-provider-aws-test
  • pull-cluster-api-provider-aws-verify

In response to this:

/test ?

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.

@Skarlso
Copy link
Contributor Author

Skarlso commented Oct 6, 2023

/test pull-cluster-api-provider-aws-e2e-blocking

Comment on lines 327 to 330
// AvailabilityZoneList defines a list of Availability Zones in which to create network resources in.
// If defined, both AvailabilityZoneUsageLimit and AvailabilityZoneSelection are ignored.
// +optional
AvailabilityZoneList []string `json:"availabilityZoneList,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// AvailabilityZoneList defines a list of Availability Zones in which to create network resources in.
// If defined, both AvailabilityZoneUsageLimit and AvailabilityZoneSelection are ignored.
// +optional
AvailabilityZoneList []string `json:"availabilityZoneList,omitempty"`
// AvailabilityZoneList defines a list of Availability Zones in which to create network resources in.
// Cannot be defined alongside AvailabilityZoneUsageLimit and AvailabilityZoneSelection.
// +optional
AvailabilityZones []string `json:"availabilityZones,omitempty"`

We should probably refuse usage when both fields are set, that can cause confusion. We could check in a validation webhook, and given that this field is new, the change is backward compatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, both fields have mandatory defaults. They are always defined. Meaning we cannot differentiate between deliberately set or the default value defined. Which means we cannot have a validation against them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move the defaults in the defaulting webhook instead of openapi schema? That way, the defaulting logic can be conditional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a 100% sure how that works. It wouldn't break existing clusters, right? Like, the default in the kubebuilder results in a different yaml, while the defaulting webhook... doesn't? Or does it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also... Okay. So... Kubebuilder Markers GENERATE default values so the generated output will be different. But mutating admission webhooks change values in flight so the output OBJECT's value will be different.

Unless I'm super mistaken these two scenarios ARE different.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The yaml is going to be different, although the defaulting logic moves to the webhook, which historically we have not treated as a breaking change, but as a compatible one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, what I was suggesting is to validate this new field in the webhook, and reject it when the other two colliding fields are set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but validating it would require removing the defaults from here. And that's what started this conversation. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's not a breaking change, @fabriziopandini @sbueringer from the upstream project can keep me honest though.

@Skarlso Skarlso force-pushed the availability-zone-list branch 2 times, most recently from 545ecd3 to 67ad355 Compare October 9, 2023 08:04
@Skarlso Skarlso requested a review from vincepri October 11, 2023 08:23
@richardcase
Copy link
Member

/test pull-cluster-api-provider-aws-e2e
/test pull-cluster-api-provider-aws-e2e-eks

@richardcase
Copy link
Member

#4575 is probably needed for the eks e2e to pass.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vincepri for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Skarlso
Copy link
Contributor Author

Skarlso commented Nov 16, 2023

/test pull-cluster-api-provider-aws-e2e-eks

@cnmcavoy
Copy link
Contributor

/retest

@cnmcavoy
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 20, 2023
Copy link
Contributor

@AndiDog AndiDog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except one minor remark

AvailabilityZone: aws.String("us-east-1b"),
MapPublicIpOnLaunch: aws.Bool(false),
},
}, nil).After(zone1PublicSubnet)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor]

Isn't it an implementation detail in which order private and public subnets are created i.e. we shouldn't check for private.After(public) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it matters that much here? I copied this entire section from previous tests. :) So whatever they do this one does as well. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not a blocker at all

@AndiDog
Copy link
Contributor

AndiDog commented Nov 23, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 16, 2024
@synthe102
Copy link
Contributor

Hey !
Thanks a lot for doing the implementation of this feature. Could it be possible to have it merged in the coming month?

@Skarlso
Copy link
Contributor Author

Skarlso commented Apr 3, 2024

I can rebase and the rest is up to the capa team. :)

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 3, 2024
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2024
@Skarlso Skarlso changed the title feat: create vpc objects in explicitly provided availability zones ✨ feat: create vpc objects in explicitly provided availability zones Apr 3, 2024
@Skarlso
Copy link
Contributor Author

Skarlso commented Apr 3, 2024

Interesting, I ran generate

@vincepri
Copy link
Member

The only thing left in this PR is to adjust the webhook validation like mentioned above

@Skarlso
Copy link
Contributor Author

Skarlso commented Apr 23, 2024

Yeah, not gonna do that. Someone else can pick this up.

@synthe102
Copy link
Contributor

I picked up where @Skarlso stopped and added the validating and mutating webhook changes @vincepri requested here: #4950

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to specify Availability Zones from the VPCSpec object
7 participants