Skip to content

Commit

Permalink
Prevent incorrect change in routeTable CR spec after adding route add…
Browse files Browse the repository at this point in the history
…ition 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.
  • Loading branch information
nnbu authored Sep 17, 2024
1 parent 157e3dc commit 1f0642e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ack_generate_info:
build_date: "2024-09-12T18:02:26Z"
build_date: "2024-09-17T17:53:28Z"
build_hash: f8f98563404066ac3340db0a049d2e530e5c51cc
go_version: go1.22.6
version: v0.38.1
Expand Down
14 changes: 14 additions & 0 deletions pkg/resource/route_table/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion templates/hooks/route_table/sdk_read_many_post_set_output.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,17 @@
// if resource's initial tags and response tags are equal,
// then assign resource's tags to maintain tag order
ko.Spec.Tags = r.ko.Spec.Tags
}
}

// Even if route is created with arguments as VPCEndpointID,
// when aws api is called to describe the route (inside skdFind), it
// returns VPCEndpointID as GatewayID. Due to this bug, spec section for
// routes is populated incorrectly in above auto-gen code.
// To solve this, if 'GatewayID' has prefix 'vpce-', then the entry is
// moved from 'GatewayID' to 'VPCEndpointID'.
for i, route := range ko.Spec.Routes {
if route.GatewayID != nil && strings.HasPrefix(*route.GatewayID, "vpce-") {
ko.Spec.Routes[i].VPCEndpointID = route.GatewayID
ko.Spec.Routes[i].GatewayID = nil
}
}

0 comments on commit 1f0642e

Please sign in to comment.