chore: Use client instead of APIReader + Add observedGeneration to status Conditions#193
chore: Use client instead of APIReader + Add observedGeneration to status Conditions#193michaelhtm wants to merge 4 commits intoaws-controllers-k8s:mainfrom
Conversation
Currently in ACK, at the beginning of the Reconciler for each event, we get the resource from the k8s APIServer. This is an unecessary call, as the latest object that triggered the reconciler is already stored in the informers cache. With this change, we will be retrieving the resource from the cache instead of the APIServer.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: michaelhtm The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test iam-controller-test |
|
/test s3-controller-test |
|
/test sagemaker-controller-test |
| // It is okay to make direct call to k8s apiserver because we are only | ||
| // making single read call for complete reconciler loop. | ||
| // See following issue for more details: | ||
| // https://github.com/aws-controllers-k8s/community/issues/894 |
There was a problem hiding this comment.
Is the problem described in this issue no longer relevant?
There was a problem hiding this comment.
It's not related to a problem..it's mainly just an optimization.
I'll expand more on it in a community PR
There was a problem hiding this comment.
From this comment it sounds like the use of direct server calls was to avoid duplicate create calls. Or are you referring to this change when you say optimization?
There was a problem hiding this comment.
@michaelhtm I think this might create issues for us in the current implementation at least. I think atleast during creates there should be a mechanism to verify if resources are created. Updates will be eventually consistent which is fine.
|
/hold |
|
This PR should be release along with the observed generation condition work |
Observed Generation is a kubernetes standard that persists the latest reconciled generation (metadata.generation) in the resource status condition
Using Controller-Runtime Client is safer in general, as it will attempt to read objects from the APIServer if it was not cached in locally. For example, when using resource references, or using ACK to reference secrets, we may need to read these objects from the APIServer.
|
/retest |
|
@michaelhtm: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Description of changes:
Currently in ACK, at the beginning of the Reconciler for each event, we
get the resource from the k8s APIServer. This is an unecessary call, as
the latest object that triggered the reconciler is already stored in the
informers cache.
With this change, we will be retrieving the resource from the cache
instead of the APIServer.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.