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

Route updates don't work in when two routes have same value for one of the route fields #2090

Open
nnbu opened this issue Jun 14, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. service/route53 Indicates issues or PRs that are related to route53-controller.

Comments

@nnbu
Copy link

nnbu commented Jun 14, 2024

Describe the bug
When we change the routes (e.g. delete some of the routes) from the route table CR, the CR status goes to out of sync for the remaining routes.

Steps to reproduce
This happens in specific case where route comparison logic does not work. E.g. when we have two routes with say, same vpcPeeringConnectionID.

  1. Create following route table CR. Note that there are 2 routes with different destinationCIDRBlock , but same vpcPeeringConnectionID.
apiVersion: ec2.services.k8s.aws/v1alpha1
kind: RouteTable
metadata:
  name: rt1
spec:
  routes:
  - destinationCIDRBlock: 172.29.0.0/16
    gatewayID: igw-<xxx>
  - destinationCIDRBlock: 172.30.0.0/16
    vpcPeeringConnectionID: pcx-05f31992c7ca70be5
  - destinationCIDRBlock: 172.28.0.0/16
     vpcPeeringConnectionID: pcx-05f31992c7ca70be5
  tags:
  - key: Name
    value: abc
  vpcID: vpc-<xxxx>
  1. All 3 routes would get created correctly in aws and CR status will be sync
  2. Delete route 172.29.0.0/16 (without changing two routes with same vpcPeeringConnectionID ). This triggers update and controller tries to find what needs to be deleted/added.
  3. CR goes to out of sync state with error something like
RouteAlreadyExists: The route identified by 172.30.0.0/16 already exists.\n\tstatus
      code: 400, request id: a471eeab-5aa3-43c7-a146-ceb380c6b50f

This suggests that update tried to create route 172.30.0.0/16 and failed with RouteAlreadyExists error.

On prima facie, there appears to be two issues

  1. getMatchingRoute logic has issues when there is one field (vpcPeeringConnectionID) having same value for two routes. Due to this same value, it thinks, the route is getting updated from 172.28.0.0/16 to 172.30.0.0/16. So, it tries add 172.30.0.0/16 and fails with the error.

Ideally, this logic should not have determined any update for these two routes with vpcPeeringConnectionID.

  1. When update determines that there is a route to be deleted and added, it creates toAdd and toDelete lists.
    Ideally, delete should happen first and then add should happen later. But current logic is reverse.

Expected outcome
CR should not go into out of sync state.

Environment

  • Kubernetes version
  • Using EKS (yes/no), if so version?
  • AWS service targeted (S3, RDS, etc.)
@nnbu
Copy link
Author

nnbu commented Jun 14, 2024

In fact, this happens when any kind of update is performed on the CR.
e.g. If we add a new tag (keeping routes section untouched), that also triggers the update. and getMatchingRoute logic fails to understand routes have not been modified. Result is that CR goes out of sync with the above mentioned error.

So, as long as we have two routes with same value for one of the fields (in this case, vpcPeeringConnectionID field), we hit this issue

@nnbu nnbu changed the title Route updates don't work in specific cases Route updates don't work in when two routes have same value for one of the route fields Jun 14, 2024
@a-hilaly a-hilaly added service/route53 Indicates issues or PRs that are related to route53-controller. kind/bug Categorizes issue or PR as related to a bug. labels Jun 17, 2024
@a-hilaly
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. service/route53 Indicates issues or PRs that are related to route53-controller.
Projects
None yet
Development

No branches or pull requests

2 participants