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

🐛 fix: update network subnets prio tag failures #4917

Conversation

mtulio
Copy link
Contributor

@mtulio mtulio commented Apr 10, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

The subnet information from unmanaged subnets, like the Availability Zone name discovered when reconciling subnets, is not updated for additional subnets when the are failures to tag subnets for the preceding subnets.

For example, given subnetId1 and subnetId2, if the subnet tag failed when setting tags on subnetId1, the subnetId2 will not be discovered and attributes not be correctly set.

This change enforces subnet updates before trying to apply tags and does not skip the loop when checking existing subnets.

Additionally, a new option was added to the unit for reconcileSubnets(), allowing to ensure expected SubnetSpec attributes from Subnets{} post reconciliation.

Which issue(s) this PR fixes

References:

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation (N/A)
  • includes emojis
  • adds unit tests
  • adds or updates e2e tests (N/A)

Release note:

NONE

The subnet information from unmanaged subnets, like Availability Zone
name discovered when reconciling subnets, is not updated for additional
subnets when the are failures to tag subnets for the preceding subnets.

For example, given subnetId1 and subnetId2, if the subnet tag failed
when setting tags on subnetId1, the subnetId2 will not be discovered and
attributes not correctly set.

This change enforce subnet updates before trying to apply tags, and
not skip the lopp when checking existing subnets.

Additionally, a new option was added to the unit for
reconcileSubnets(), allowing to ensure expected SubnetSpec attributes
from Subnets{} post reconciliation.
@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/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Apr 10, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 10, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @mtulio. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 10, 2024
@mtulio
Copy link
Contributor Author

mtulio commented Apr 10, 2024

Hey folks, PTAL and let me know if it's ok? This is a subset of changes captured when validating scenarios in Wavelength zones #4901
/assign vincepri @damdo @damdo

@damdo
Copy link
Member

damdo commented Apr 10, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 10, 2024
@mtulio
Copy link
Contributor Author

mtulio commented Apr 10, 2024

@mtulio: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-aws-test 42e6c00 link true /test pull-cluster-api-provider-aws-test
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Is it flake in TestAWSMachinePoolReconciler/Reconciling_an_AWSMachinePool?!

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

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 10, 2024
@mtulio
Copy link
Contributor Author

mtulio commented Apr 10, 2024

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

@mtulio
Copy link
Contributor Author

mtulio commented Apr 10, 2024

@mtulio: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-aws-e2e 42e6c00 link false /test pull-cluster-api-provider-aws-e2e
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Sounds like a flake in the cloudformation stack when creating IAM to bootstrap the node:

STEP: Event details for AWSIAMUserBootstrapper : Resource: AWS::IAM::User, Status: CREATE_FAILED, Reason: Resource handler returned message: "Resource of type 'AWS::IAM::User' with identifier 'bootstrapper.cluster-api-provider-aws.sigs.k8s.io' already exists." (RequestToken: 51ce0dfe-b7d3-96d3-760a-3bec0d80d9c2, HandlerErrorCode: AlreadyExists) @ 04/10/24 12:28:03.836

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

@mtulio
Copy link
Contributor Author

mtulio commented Apr 10, 2024

@damdo @vincepri all green. This PR is ready for review. PTAL?

@mtulio mtulio changed the title 🐛 fix/network/subnets: update subnets before tag failures 🐛 fix: update network subnets prio tag failures Apr 10, 2024
Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

/lgtm

/assign @vincepri

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

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 11, 2024
@k8s-ci-robot k8s-ci-robot merged commit dd2962d into kubernetes-sigs:main Apr 11, 2024
48 checks passed
@mtulio mtulio deleted the CORS-3214-wavelength-zones-fix-zoneinfo branch April 11, 2024 14:54
Comment on lines +142 to +146
// Update subnet spec with the existing subnet details
existingSubnet.DeepCopyInto(sub)

// Make sure tags are up-to-date.
subnetTags := sub.Tags
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that tags were not being applied when running CAPA v2.5.2, and I found this PR changing the subnet tagging behaviour.

Shouldn't subnetTags := sub.Tags run before existingSubnet.DeepCopyInto(sub)? Otherwise, we basically ignore the tags specified in the subnet spec, because they are overwritten by the tags found in the AWS Subnet. /cc @mtulio @vincepri @damdo

Copy link
Member

Choose a reason for hiding this comment

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

Yeah looks that way. Although not looked too deeply into the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Created this to fix it #5175

mtulio added a commit to mtulio/cluster-api-provider-aws that referenced this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. 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.

6 participants