Skip to content

Commit 80bf808

Browse files
authored
fix: only force syncing a VPC endpoint when in pending state (#198)
Context: #191 (comment) A synced VPC endpoint should only be forced to re-sync when it's in `pending` state. For other states like `pendingAcceptance`, `rejected`, `failed`, `expired`, it could be the final state of the endpoint and the sync should be considered completed. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 33f3fff commit 80bf808

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

pkg/resource/vpc_endpoint/hooks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ const (
3535
StatusFailed = "failed"
3636
)
3737

38-
func vpcEndpointAvailable(r *resource) bool {
38+
func vpcEndpointPending(r *resource) bool {
3939
if r.ko.Status.State == nil {
4040
return false
4141
}
4242
cs := *r.ko.Status.State
43-
return cs == StatusAvailable
43+
return cs == StatusPending
4444
}
4545

4646
// addIDToDeleteRequest adds resource's Vpc Endpoint ID to DeleteRequest.

pkg/resource/vpc_endpoint/sdk.go

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11

2-
if !vpcEndpointAvailable(&resource{ko}) {
2+
if vpcEndpointPending(&resource{ko}) {
33
// Setting resource synced condition to false will trigger a requeue of
44
// the resource. No need to return a requeue error here.
55
ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, nil, nil)
6-
} else {
7-
ackcondition.SetSynced(&resource{ko}, corev1.ConditionTrue, nil, nil)
86
}

0 commit comments

Comments
 (0)