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/network/rtb: delete rtb handling err when failed to create routes #4899

Merged

Conversation

mtulio
Copy link
Contributor

@mtulio mtulio commented Apr 3, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

This fix creates an error handler when the route table reconcile loop returns error when creating routes. It will prevent left the route table behind.

Currently this issue is triggered when an invalid route entry is added, creating a new stale table every new reconciliation, growing to hundreds in a few minutes. This is one example triggering the issue (a subset of Carrier Gateway support adding in #4901):

E0403 01:04:42.329759 1157154 awscluster_controller.go:327] "failed to reconcile network" err=<
	failed to create route in route table "rtb-067f352c09371fe71": {
	  CarrierGatewayId: "cagw-0ac129c044b2cd1b6",
	  DestinationCidrBlock: "0.0.0.0/0"
	}: MissingParameter: The request must contain exactly one of gatewayId, natGatewayId, networkInterfaceId, vpcPeeringConnectionId, egressOnlyInternetGatewayId, transitGatewayId, localGatewayId, carrierGatewayId, vpcEndpointId, coreNetworkArn or instanceId
		status code: 400, request id: 570b91c9-e228-4ee9-a939-1f5fe0313165

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 #

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:

Fix the error handling by deleting the created route table on errors when creating routes.

@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 3, 2024
@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 3, 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.

@mtulio mtulio force-pushed the CORS-3214-fix-clean-rtb-onfailure branch from 369a275 to affd00b Compare April 3, 2024 04:07
@mtulio
Copy link
Contributor Author

mtulio commented Apr 3, 2024

/assign @vincepri

@mtulio
Copy link
Contributor Author

mtulio commented Apr 3, 2024

@vincepri @damdo would you mind to stamp labels to test?

@damdo
Copy link
Member

damdo commented Apr 3, 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 3, 2024
@mtulio
Copy link
Contributor Author

mtulio commented Apr 3, 2024

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

@mtulio
Copy link
Contributor Author

mtulio commented Apr 3, 2024

/assign @damdo

e2e passing. Unsure why GH checks failed (no logs).

I am happy to introduce units for those functions. Let me know if that approach is feasible before writing more code.

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.

Left a comment but the approach LGTM.
I think, yes, if you can add a unit test that covers this, it would be great.
Thanks!

Route tables must be deleted after fail to create, otherwise it will
generate a new route table every new reconciliator loop.

This fix ensure route table is deleted when failed to create, raising a
wanring to the recorder when failed to create, and eventually, failed to
delete.
@mtulio mtulio force-pushed the CORS-3214-fix-clean-rtb-onfailure branch from affd00b to 8639688 Compare April 4, 2024 13:01
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 4, 2024
@mtulio mtulio force-pushed the CORS-3214-fix-clean-rtb-onfailure branch from 8639688 to be8658b Compare April 4, 2024 13:34
@mtulio mtulio force-pushed the CORS-3214-fix-clean-rtb-onfailure branch from be8658b to 283c07b Compare April 4, 2024 14:33
@mtulio
Copy link
Contributor Author

mtulio commented Apr 4, 2024

Left a comment but the approach LGTM. I think, yes, if you can add a unit test that covers this, it would be great. Thanks!

@damdo unit tests added, and everything is passing now.

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.

Thanks @mtulio
/lgtm

Assigning approvers
/assign @dlipovetsky @vincepri @richardcase @Ankitasw

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

damdo commented Apr 4, 2024

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

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

@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 4, 2024
@k8s-ci-robot k8s-ci-robot merged commit 240df04 into kubernetes-sigs:main Apr 4, 2024
19 of 20 checks passed
@mtulio mtulio deleted the CORS-3214-fix-clean-rtb-onfailure branch April 4, 2024 17:31
@damdo
Copy link
Member

damdo commented Apr 8, 2024

/cherry-pick release-2.4

@k8s-infra-cherrypick-robot

@damdo: new pull request created: #4912

In response to this:

/cherry-pick release-2.4

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.

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 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.

8 participants