Skip to content

Commit 1f0642e

Browse files
authored
Prevent incorrect change in routeTable CR spec after adding route addition having vpcEndpointID (#170)
Fixes [#1935](aws-controllers-k8s/community#1935) Description of changes: This fix accomodates an aws api bug so as to prevent routeTable CR spec from changing. Details explained in the issue description. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 157e3dc commit 1f0642e

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ack_generate_info:
2-
build_date: "2024-09-12T18:02:26Z"
2+
build_date: "2024-09-17T17:53:28Z"
33
build_hash: f8f98563404066ac3340db0a049d2e530e5c51cc
44
go_version: go1.22.6
55
version: v0.38.1

pkg/resource/route_table/sdk.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/hooks/route_table/sdk_read_many_post_set_output.go.tpl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,17 @@
77
// if resource's initial tags and response tags are equal,
88
// then assign resource's tags to maintain tag order
99
ko.Spec.Tags = r.ko.Spec.Tags
10-
}
10+
}
11+
12+
// Even if route is created with arguments as VPCEndpointID,
13+
// when aws api is called to describe the route (inside skdFind), it
14+
// returns VPCEndpointID as GatewayID. Due to this bug, spec section for
15+
// routes is populated incorrectly in above auto-gen code.
16+
// To solve this, if 'GatewayID' has prefix 'vpce-', then the entry is
17+
// moved from 'GatewayID' to 'VPCEndpointID'.
18+
for i, route := range ko.Spec.Routes {
19+
if route.GatewayID != nil && strings.HasPrefix(*route.GatewayID, "vpce-") {
20+
ko.Spec.Routes[i].VPCEndpointID = route.GatewayID
21+
ko.Spec.Routes[i].GatewayID = nil
22+
}
23+
}

0 commit comments

Comments
 (0)