Skip to content

Commit 0ab38d5

Browse files
authored
feat(VPCPeeringConnection): add support for custom resource and additional fields for Modify OP and auto-accepting (#158)
## Changes This PR adds the `vpcpeeringconnections` custom resource via the standard code-generator output, but with a few custom additions: - Adds the possibility to use an ACK VPC resource as a [Reference](https://aws-controllers-k8s.github.io/community/docs/contributor-docs/code-generator-config/#references-making-a-field-refer-to-another-resource) for the fields `spec.vpcRef` (instead of `spec.vpcId`) and `spec.peerVpcRef` (instead of `spec.peerVpcId`). - Adds the `spec.accepterPeeringConnectionOptions` and `spec.requesterPeeringConnectionOptions` fields, which come from the `ModifyVpcPeeringConnectionOptions` API call, to allow the use of the `allowDnsResolutionFromRemoteVpc`, `AllowEgressFromLocalVpcToRemoteClassicLink` and `AllowEgressFromLocalClassicLinkToRemoteVpc` sub-fields. - Adds the `spec.acceptRequest` (boolean) which will allow the VPC Peering Connection Request to automatically switch from status `pending-acceptance` to `active` without manual intervention. (Inspired by Crossplane's implementation ([Ref](https://doc.crds.dev/github.com/crossplane/provider-aws/ec2.aws.crossplane.io/VPCPeeringConnection/[email protected]))) - Adds the field `spec.routes.vpcPeeringConnectionRef` to the Route Table CR > Note: In [a separate PR](#159), we add the fields `spec.acceptVPCPeeringRequestsFromVPCID` and `spec.acceptVPCPeeringRequestsFromVPCRefs` to the VPC CRD, to allow you to add a list of VPC's from which you'd like to automatically accept incoming VPC Peering requests from. ## References - [Slack Thread](https://kubernetes.slack.com/archives/C0402D8JJS1/p1700682197552809) - Github Issue: aws-controllers-k8s/community#1943 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent dc920e9 commit 0ab38d5

39 files changed

+3974
-45
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2023-09-18T23:03:44Z"
3-
build_hash: 892f29d00a4c4ad21a2fa32919921de18190979d
4-
go_version: go1.20.3
5-
version: v0.27.1
6-
api_directory_checksum: 6e2d850d97f2f72db31c9bef522eca4ab95b3fcd
2+
build_date: "2023-12-06T21:00:34Z"
3+
build_hash: 1cc9b5172d3d1676af578a3411e8672698ec29ce
4+
go_version: go1.21.0
5+
version: 1cc9b51
6+
api_directory_checksum: d452bf19bfd1496aacdc215bf7cc9ea86c55c122
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: c474e6cdec9622afad4b4cef415483a7bd0eda41
10+
file_checksum: 86b3e3aa1ff4769894d475244d0cc5902bcb258f
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ ignore:
3636
- CreateVpcEndpointInput.DryRun
3737
- CreateVpcEndpointInput.TagSpecifications
3838
- CreateVpcEndpointInput.ClientToken
39+
- CreateVpcPeeringConnectionInput.DryRun
40+
- CreateVpcPeeringConnectionInput.TagSpecifications
3941
- DeleteRouteInput.DryRun
4042
- DeleteRouteInput.RouteTableId
4143
# support EC2-VPC only
@@ -122,7 +124,7 @@ ignore:
122124
#- VpcEndpoint
123125
#- Vpc
124126
- VpcCidrBlock
125-
- VpcPeeringConnection
127+
#- VpcPeeringConnection
126128
- VpnConnectionRoute
127129
- VpnConnection
128130
- VpnGateway
@@ -184,6 +186,10 @@ operations:
184186
operation_type:
185187
- Delete
186188
resource_name: Instance
189+
ModifyVpcPeeringConnectionOptions:
190+
operation_type:
191+
- Update
192+
resource_name: VpcPeeringConnection
187193
resources:
188194
DhcpOptions:
189195
exceptions:
@@ -468,6 +474,10 @@ resources:
468474
references:
469475
resource: VPCEndpoint
470476
path: Status.VPCEndpointID
477+
Routes.VPCPeeringConnectionID:
478+
references:
479+
resource: VPCPeeringConnection
480+
path: Status.VPCPeeringConnectionID
471481
hooks:
472482
delta_pre_compare:
473483
code: customPreCompare(delta, a, b)
@@ -779,5 +789,45 @@ resources:
779789
sdk_file_end:
780790
template_path: hooks/vpc_endpoint/sdk_file_end.go.tpl
781791
update_operation:
782-
custom_method_name: customUpdateVPCEndpoint
783-
792+
custom_method_name: customUpdateVPCEndpoint
793+
VpcPeeringConnection:
794+
fields:
795+
VpcId:
796+
references:
797+
resource: VPC
798+
path: Status.VPCID
799+
peerVpcId:
800+
references:
801+
resource: VPC
802+
path: Status.VPCID
803+
AcceptRequest:
804+
type: bool
805+
AccepterPeeringConnectionOptions:
806+
from:
807+
operation: ModifyVpcPeeringConnectionOptions
808+
path: AccepterPeeringConnectionOptions
809+
RequesterPeeringConnectionOptions:
810+
from:
811+
operation: ModifyVpcPeeringConnectionOptions
812+
path: RequesterPeeringConnectionOptions
813+
Tags:
814+
from:
815+
operation: CreateTags
816+
path: Tags
817+
compare:
818+
is_ignored: True
819+
update_operation:
820+
omit_unchanged_fields: true
821+
hooks:
822+
delta_pre_compare:
823+
code: compareTags(delta, a, b)
824+
sdk_create_post_build_request:
825+
template_path: hooks/vpc_peering_connection/sdk_create_post_build_request.go.tpl
826+
sdk_create_post_set_output:
827+
template_path: hooks/vpc_peering_connection/sdk_create_post_set_output.go.tpl
828+
sdk_update_pre_build_request:
829+
template_path: hooks/vpc_peering_connection/sdk_update_pre_build_request.go.tpl
830+
sdk_read_many_post_set_output:
831+
template_path: hooks/vpc_peering_connection/sdk_read_many_post_set_output.go.tpl
832+
sdk_file_end:
833+
template_path: hooks/vpc_peering_connection/sdk_file_end.go.tpl

apis/v1alpha1/types.go

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

apis/v1alpha1/vpc_peering_connection.go

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

0 commit comments

Comments
 (0)