Skip to content

Conversation

@kumargauravsharma
Copy link
Contributor

Fixes for Snapshot failures:

1. Fix snapshot crud failures:
   Cause: update did not save the sync status condition
   Fix: update() needed to return latest retrieved.
2. Fix endless reconciler loop:
   Cause: ReadOne->onError() sets terminal condition to false using patchResource,
     followed by error returned from Create() leads to
     setting terminal condition to true using patchResource;
     causing reconciler loop.
   Fix: ensure patchResource is invoked once in the reconciler::sync()
3 Snapshots e2e tests fix - updated scenarios where create snapshot expects either Replication Group or Cache Cluster Id and fails if other is supplied.

Testing done:

1. Snapshot e2e tests passed.
2. apigatewayv2 e2e tests passed.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

1. Fix snapshot crud failures:
   Cause: update did not save the sync status condition
   Fix: update() needed to return latest retrieved.
2. Fix endless reconciler loop:
   Cause: ReadOne->onError() sets terminal condition to false using patchResource,
     followed by error returned from Create() leads to
     setting terminal condition to true using patchResource;
     causing reconciler loop.
   Fix: ensure patchResource is invoked once in the reconciler::sync()
3 Snapshots e2e tests fix - updated scenarios where create snapshot expects either Replication Group or Cache Cluster Id and fails if other is supplied.
Copy link
Contributor

@nmvk nmvk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

// updated in the resource
// Thus, patchResource() call should be made here
_ = r.patchResource(ctx, desired, latest)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this change was necessary. Why would ReadOne be returning err == NotFound && a non-nil latest variable?

Copy link
Contributor Author

@kumargauravsharma kumargauravsharma Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier version of the code was having the err == NotFound && a non-nil latest scenario. The non-nil latest was the side effect of #574.
This PR fixes that.

With the changes in this PR; the resource would be patched when err != NotFound && a not nil latest and method would return. This scenario occurs when invalid input is given to SDK find.
And when err == NotFound, the Create() is tried first and if it fails with error then resource is patched and method returns.
In all cases only one patch resource call is made.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, thanks for the explanation. This is partly why I was a little hesitant about #574

// updated in the resource
// Thus, patchResource() call should be made here
_ = r.patchResource(ctx, desired, latest)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, thanks for the explanation. This is partly why I was a little hesitant about #574

@jaypipes jaypipes merged commit e592c6e into aws-controllers-k8s:main Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants