-
Notifications
You must be signed in to change notification settings - Fork 60
fix(VPCPeeringConnection): Fix update code path #163
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
Changes from all commits
47736fa
180b277
b0f8238
447b7dc
ada138c
6d17e81
edcbf16
3531194
bb7ae0a
38b46f5
74c7f03
d132e08
6e24e35
ca33e7b
0871455
85e151d
c66870c
6d596bd
944d3aa
013d6af
735055c
e89f614
3afb3f5
5961085
b2f56cb
579848e
bd2cd19
8d7c8d6
ce38866
bb6f50c
a84f03a
5b2c50d
3c56676
93e3747
2e99b66
015a285
c3865d8
8c28eb5
a6068cd
a7bb876
1b50ed0
abb07dc
78eeaaf
57158a7
2f16cf3
de61ee2
3410131
7b04fbd
32cb8eb
8dde2e8
e6acaab
bea960c
ad5b4fb
68942ee
dfe4918
8f8bd9d
e05b575
ab67513
d135721
1c3d165
3e0fbf1
d176998
5a15b2d
5b339dc
d8d28a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| ack_generate_info: | ||
| build_date: "2023-12-06T21:43:43Z" | ||
| build_hash: 892f29d00a4c4ad21a2fa32919921de18190979d | ||
| go_version: go1.21.1 | ||
| version: v0.27.1 | ||
| api_directory_checksum: 6e2d850d97f2f72db31c9bef522eca4ab95b3fcd | ||
| build_date: "2023-12-12T12:34:35Z" | ||
| build_hash: 3653329ceeb20015851b8776a6061a3fb0ec2935 | ||
| go_version: go1.21.0 | ||
| version: "3653329" | ||
| api_directory_checksum: d452bf19bfd1496aacdc215bf7cc9ea86c55c122 | ||
| api_version: v1alpha1 | ||
| aws_sdk_go_version: v1.44.93 | ||
| generator_config_info: | ||
| file_checksum: d10a62517f87bacf988184f8c454b90b42dee732 | ||
| file_checksum: df1057de840147701c11acfdbed0e28e9b0ddd96 | ||
| original_file_name: generator.yaml | ||
| last_modification: | ||
| reason: API generation |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,42 @@ | ||
|
|
||
|
|
||
| if r.ko.Spec.AccepterPeeringConnectionOptions != nil { | ||
| f0 := &svcapitypes.PeeringConnectionOptionsRequest{} | ||
| if r.ko.Spec.AccepterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC != nil { | ||
| f0.AllowEgressFromLocalClassicLinkToRemoteVPC = r.ko.Spec.AccepterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC | ||
| } | ||
| if r.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC != nil { | ||
| f0.AllowEgressFromLocalClassicLinkToRemoteVPC = r.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC | ||
| } | ||
| if r.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink != nil { | ||
| f0.AllowEgressFromLocalVPCToRemoteClassicLink = r.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink | ||
| } | ||
| ko.Spec.AccepterPeeringConnectionOptions = f0 | ||
| } else { | ||
| ko.Spec.AccepterPeeringConnectionOptions = nil | ||
| } | ||
| if r.ko.Spec.RequesterPeeringConnectionOptions != nil { | ||
| f1 := &svcapitypes.PeeringConnectionOptionsRequest{} | ||
| if r.ko.Spec.RequesterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC != nil { | ||
| f1.AllowDNSResolutionFromRemoteVPC = r.ko.Spec.RequesterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC | ||
| } | ||
| if r.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC != nil { | ||
| f1.AllowEgressFromLocalClassicLinkToRemoteVPC = r.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC | ||
| } | ||
| if r.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink != nil { | ||
| f1.AllowEgressFromLocalVPCToRemoteClassicLink = r.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink | ||
| } | ||
| ko.Spec.RequesterPeeringConnectionOptions = f1 | ||
| } else { | ||
| ko.Spec.RequesterPeeringConnectionOptions = nil | ||
| } | ||
|
|
||
| // Artificially trigger detection by delta.DifferentAt("Spec.AcceptRequest") | ||
| res := &resource{ko} | ||
| if isVPCPeeringConnectionPendingAcceptance(res) { | ||
| res.ko.Spec.AcceptRequest = aws.Bool(false) | ||
| } else if isVPCPeeringConnectionActive(res) || isVPCPeeringConnectionProvisioning(res) { | ||
| res.ko.Spec.AcceptRequest = aws.Bool(true) | ||
| } else if isVPCPeeringConnectionCreating(res) { | ||
| return nil, requeueWaitWhileCreating | ||
| } | ||
| return res, requeueWaitWhileCreating | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,20 @@ | ||
|
|
||
| if isVPCPeeringConnectionCreating(desired) { | ||
| if isVPCPeeringConnectionCreating(latest) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
| return desired, requeueWaitWhileCreating | ||
| } | ||
| if isVPCPeeringConnectionProvisioning(desired) { | ||
| if isVPCPeeringConnectionProvisioning(latest) { | ||
| return desired, requeueWaitWhileProvisioning | ||
| } | ||
| if isVPCPeeringConnectionDeleting(desired) { | ||
| if isVPCPeeringConnectionDeleting(latest) { | ||
| return desired, requeueWaitWhileDeleting | ||
| } | ||
|
|
||
| // in case of pending acceptance or accepted state we make the updates. | ||
| // If the VPC Peering Connection is Pending Acceptance or Active, continue | ||
|
|
||
| if delta.DifferentAt("Spec.Tags") { | ||
| if err := rm.syncTags(ctx, desired, latest); err != nil { | ||
| return nil, err | ||
| // This causes a requeue and the rest of the fields will be synced on the next reconciliation loop | ||
| ackcondition.SetSynced(desired, corev1.ConditionFalse, nil, nil) | ||
| return desired, err | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -44,8 +46,38 @@ | |
| } | ||
| } | ||
|
|
||
| // Only continue if something other than Tags or certain fields has changed in the Spec | ||
| if !delta.DifferentExcept("Spec.Tags", "Spec.AcceptRequest") { | ||
| return desired, nil | ||
| } | ||
|
|
||
| // Only continue if something other than Tags or certain fields has changed in the Spec | ||
| if !delta.DifferentExcept("Spec.Tags", "Spec.AcceptRequest") { | ||
| return desired, nil | ||
| } | ||
| if desired.ko.Spec.AccepterPeeringConnectionOptions != nil { | ||
| f0 := &svcapitypes.PeeringConnectionOptionsRequest{} | ||
| if desired.ko.Spec.AccepterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC != nil { | ||
| f0.AllowDNSResolutionFromRemoteVPC = desired.ko.Spec.AccepterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC | ||
| } | ||
| if desired.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC != nil { | ||
| f0.AllowEgressFromLocalClassicLinkToRemoteVPC = desired.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC | ||
| } | ||
| if desired.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink != nil { | ||
| f0.AllowEgressFromLocalVPCToRemoteClassicLink = desired.ko.Spec.AccepterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink | ||
| } | ||
| desired.ko.Spec.AccepterPeeringConnectionOptions = f0 | ||
| } else { | ||
| desired.ko.Spec.AccepterPeeringConnectionOptions = nil | ||
| } | ||
| if desired.ko.Spec.RequesterPeeringConnectionOptions != nil { | ||
| f1 := &svcapitypes.PeeringConnectionOptionsRequest{} | ||
| if desired.ko.Spec.RequesterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC != nil { | ||
| f1.AllowDNSResolutionFromRemoteVPC = desired.ko.Spec.RequesterPeeringConnectionOptions.AllowDNSResolutionFromRemoteVPC | ||
| } | ||
| if desired.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC != nil { | ||
| f1.AllowEgressFromLocalClassicLinkToRemoteVPC = desired.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalClassicLinkToRemoteVPC | ||
| } | ||
| if desired.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink != nil { | ||
| f1.AllowEgressFromLocalVPCToRemoteClassicLink = desired.ko.Spec.RequesterPeeringConnectionOptions.AllowEgressFromLocalVPCToRemoteClassicLink | ||
| } | ||
| desired.ko.Spec.RequesterPeeringConnectionOptions = f1 | ||
| } else { | ||
| desired.ko.Spec.RequesterPeeringConnectionOptions = nil | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,14 +6,6 @@ spec: | |
| vpcID: $VPC_ID | ||
| peerVPCID: $PEER_VPC_ID | ||
| acceptRequest: true | ||
| requesterPeeringConnectionOptions: | ||
| allowDNSResolutionFromRemoteVPC: true | ||
| allowEgressFromLocalClassicLinkToRemoteVPC: true | ||
| allowEgressFromLocalVPCToRemoteClassicLink: true | ||
| accepterPeeringConnectionOptions: | ||
| allowDNSResolutionFromRemoteVPC: true | ||
| allowEgressFromLocalClassicLinkToRemoteVPC: true | ||
| allowEgressFromLocalVPCToRemoteClassicLink: true | ||
|
Comment on lines
-9
to
-16
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This "simple" test only tests creation and Acceptance of the VPC Peering Connection. |
||
| tags: | ||
| - key: $TAG_KEY | ||
| value: $TAG_VALUE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| apiVersion: ec2.services.k8s.aws/v1alpha1 | ||
| kind: VPCPeeringConnection | ||
| metadata: | ||
| name: $VPC_PEERING_CONNECTION_NAME | ||
| spec: | ||
| vpcID: $VPC_ID | ||
| peerVPCID: $PEER_VPC_ID | ||
| acceptRequest: true | ||
| requesterPeeringConnectionOptions: | ||
| allowDNSResolutionFromRemoteVPC: true | ||
| accepterPeeringConnectionOptions: | ||
| allowDNSResolutionFromRemoteVPC: true |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this, because I tested the behavior with & without it, and got many problem with it turned on:
It was agreed with Amine H. that we will remove this for the time being and potentially add it back later as an optimization once we've worked out the kinks for this specific use case of the flag.