Skip to content

Conversation

vijtrip2
Copy link
Contributor

Issue #, if available: aws-controllers-k8s/community#1342

Description of changes:
TL;DR:

  • This change makes sure that partially resolved references do not get added to concrete resource inside rm.ResolveReferences unless all the references can be successfully resolved.

Detailed Version

  • Inside rm.ResolveReferences, all the references are resolved sequentially and whenever any reference resolution fails it short circuits other reference resolutions.
  • However the successfully resolved references, before the first fail one, get updated inside the concrete resource(ko).
  • An error from rm.ResolveReferences causes the HandleReconcilerError to call PatchMetadataAndSpec, and the partial resolved references get persisted inside etcd.
  • When the resolved references get persisted inside etcd, they cause the validation failure on next reconciler loop that both Ref and Id field cannot be present at the same time.
  • The resolved references do not get persisted in etcd when reference resolution is successful because the desired object in memory get replaced by resolvedRefDesired and does not present resolved references as candidate for patch merge. During the failure desired object does not get replaced by resolvedRefDesired and presents the resolved references as patch candidate.
  • We cannot update desired with resolvedRefDesired in an error case because then we will lose diff of ACK conditions added by rm.ResolveReferences.
  • Ignoring the partially resolved reference during an error in rm.ResolveReferences is a clean and simple solution.
  • I tested this by running apigatewayv2 tests locally.

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

@ack-bot
Copy link
Collaborator

ack-bot commented Jun 15, 2022

@vijtrip2: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
dynamodb-controller-test d295e49 link /test dynamodb-controller-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Reasonable. :) I'm reworking the whack-a-mole PatchMetadataAndSpec/Status calls currently in the runtime to put a more strict contract in place about when we save state and how we handle errors.

@jaypipes
Copy link
Collaborator

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 15, 2022
@ack-bot
Copy link
Collaborator

ack-bot commented Jun 15, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jaypipes, vijtrip2

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-bot ack-bot merged commit 53ebfac into aws-controllers-k8s:main Jun 15, 2022
RedbackThomson pushed a commit to RedbackThomson/ack-code-generator that referenced this pull request Jun 21, 2022
…ntrollers-k8s#342)

Issue #, if available: aws-controllers-k8s/community#1342

Description of changes:
TL;DR:
* This change makes sure that partially resolved references do not get added to concrete resource inside `rm.ResolveReferences` unless all the references can be successfully resolved.

Detailed Version
* Inside `rm.ResolveReferences`, all the references are resolved sequentially and whenever any reference resolution fails it short circuits other reference resolutions.
* However the successfully resolved references, before the first fail one, get updated inside the concrete resource(ko).
* An error from `rm.ResolveReferences` causes the `HandleReconcilerError` to call PatchMetadataAndSpec, and the partial resolved references get persisted inside etcd.
* When the resolved references get persisted inside etcd, they cause the validation failure on next reconciler loop that both Ref and Id field cannot be present at the same time.
* The resolved references do not get persisted in etcd when reference resolution is successful because the desired object in memory get replaced by resolvedRefDesired and does not present resolved references as candidate for patch merge. During the failure desired object does not get replaced by resolvedRefDesired and presents the resolved references as patch candidate.
* We cannot update desired with resolvedRefDesired in an error case because then we will lose diff of ACK conditions added by `rm.ResolveReferences`.
* Ignoring the partially resolved reference during an error in `rm.ResolveReferences` is a clean and simple solution.
* I tested this by running apigatewayv2 tests locally.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants