Skip to content

Commit b8f28f4

Browse files
Requeue if cluster in use during update (#26)
Issue #, if available: aws-controllers-k8s/community#1192 Description of changes: If a cluster update call races and queues an update before we are able to call update, requeue the update until it becomes free again. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 1d7f0e6 commit b8f28f4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/resource/cluster/hook.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,28 @@ func (rm *resourceManager) customUpdate(
202202
}
203203
if delta.DifferentAt("Spec.ResourcesVPCConfig") {
204204
if err := rm.updateConfigResourcesVPCConfig(ctx, desired); err != nil {
205+
awserr, ok := ackerr.AWSError(err)
206+
207+
// Check to see if we've raced an async update call and need to
208+
// requeue
209+
if ok && awserr.Code() == "ResourceInUseException" {
210+
return nil, requeueAfterAsyncUpdate()
211+
}
212+
205213
return nil, err
206214
}
207215
return returnClusterUpdating(desired)
208216
}
209217
if delta.DifferentAt("Spec.Version") {
210218
if err := rm.updateVersion(ctx, desired); err != nil {
219+
awserr, ok := ackerr.AWSError(err)
220+
221+
// Check to see if we've raced an async update call and need to
222+
// requeue
223+
if ok && awserr.Code() == "ResourceInUseException" {
224+
return nil, requeueAfterAsyncUpdate()
225+
}
226+
211227
return nil, err
212228
}
213229
return returnClusterUpdating(desired)

0 commit comments

Comments
 (0)