Commit 5d501f4
authored
Fix for Circular dependency while creating RouteTable and a VPCEndpoint (#142)
Issue: aws-controllers-k8s/community#1817
Description of changes:
This is for fixing circular dependency bug while creating a new RouteTable and a VPCEndpoint. As per the changes in this PR, any route to `DestinationPrefixList` which is owned by "AWS" will be ignored while syncing routes and will be used as is.
Tested via following :
```
apiVersion: ec2.services.k8s.aws/v1alpha1
kind: VPC
metadata:
name: circular-dependency-vpc
spec:
cidrBlocks:
- 10.10.0.0/16
enableDNSSupport: True
enableDNSHostnames: True
tags:
- key: Name
value: circular-dependency-vpc
---
apiVersion: ec2.services.k8s.aws/v1alpha1
kind: RouteTable
metadata:
name: circular-dependency-rtb
spec:
routes:
- destinationCIDRBlock: 0.0.0.0/0
gatewayRef:
from:
name: circular-dependency-igw
vpcRef:
from:
name: circular-dependency-vpc
---
apiVersion: ec2.services.k8s.aws/v1alpha1
kind: VPCEndpoint
metadata:
name: circular-dependency-vpc-endpoint-s3
spec:
serviceName: com.amazonaws.us-west-2.s3
vpcRef:
from:
name: circular-dependency-vpc
routeTableRefs:
- from:
name: circular-dependency-rtb
tags:
- key: Name
value: circular-dependency-vpc-endpoint-s3
---
apiVersion: ec2.services.k8s.aws/v1alpha1
kind: InternetGateway
metadata:
name: circular-dependency-igw
spec:
vpcRef:
from:
name: circular-dependency-vpc
tags:
- key: "Adobe.Owner"
value: "Ethos"
- key: Name
value: circular-dependency-igw
```
Status (before reconciliation i.e. before ACK synced from AWS actual resources):
```
$ kubectl get routetable circular-dependency-rtb -o json | jq .status.routeStatuses
[
{
"destinationCIDRBlock": "10.10.0.0/16",
"gatewayID": "local",
"origin": "CreateRouteTable",
"state": "active"
},
{
"destinationCIDRBlock": "0.0.0.0/0",
"gatewayID": "igw-06d5825a3e9ba9dee",
"origin": "CreateRoute",
"state": "active"
}
]
```
Status (after reconciliation i.e. after ACK synced from AWS actual resources):
```
[
{
"destinationCIDRBlock": "10.10.0.0/16",
"gatewayID": "local",
"origin": "CreateRouteTable",
"state": "active"
},
{
"destinationCIDRBlock": "0.0.0.0/0",
"gatewayID": "igw-06d5825a3e9ba9dee",
"origin": "CreateRoute",
"state": "active"
},
{
"destinationPrefixListID": "pl-68a54001",
"gatewayID": "vpce-017f902c0d2c007e3",
"origin": "CreateRoute",
"state": "active"
}
]
```
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.1 parent 5f6b119 commit 5d501f4
1 file changed
+56
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
| |||
290 | 299 | | |
291 | 300 | | |
292 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
293 | 349 | | |
294 | 350 | | |
295 | 351 | | |
| |||
0 commit comments