Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move config into context #209

Merged
merged 1 commit into from Apr 21, 2022
Merged

Conversation

scothis
Copy link
Contributor

@scothis scothis commented Apr 19, 2022

Reconcilers and sub reconcilers use the config object to centralize
common api operations. Previously this config was passed to each
reconciler when it was initialized. However, this makes it harder to
dynamically swap the config at runtime based on the content of a
resource. For example, a resource may specify a service account to use
when creating other resources with least privilege.

The ChildReconciler and SyncReconciler no long allow the Config to be
specified directly. It must be passed in via the context. So that the
RetrieveConfig method can return the Config.

SubReconcilers that need to interact with the parent resource should use
the parent config via RetrieveParentConfig method. In many cases the
config and parent config are one in the same, however, the WithConfig
sub reconciler can inject an alternate config for the nested sub
reconcilers.

Signed-off-by: Scott Andrews andrewssc@vmware.com

Reconcilers and sub reconcilers use the config object to centralize
common api operations. Previously this config was passed to each
reconciler when it was initialized. However, this makes it harder to
dynamically swap the config at runtime based on the content of a
resource. For example, a resource may specify a service account to use
when creating other resources with least privilege.

The ChildReconciler and SyncReconciler no long allow the Config to be
specified directly. It must be passed in via the context. So that the
RetrieveConfig method can return the Config.

SubReconcilers that need to interact with the parent resource should use
the parent config via RetrieveParentConfig method. In many cases the
config and parent config are one in the same, however, the WithConfig
sub reconciler can inject an alternate config for the nested sub
reconcilers.

Signed-off-by: Scott Andrews <andrewssc@vmware.com>
@codecov
Copy link

codecov bot commented Apr 19, 2022

Codecov Report

Merging #209 (eaf3752) into main (5b2e5a8) will increase coverage by 0.98%.
The diff coverage is 65.30%.

@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
+ Coverage   61.11%   62.09%   +0.98%     
==========================================
  Files           9        9              
  Lines         841      905      +64     
==========================================
+ Hits          514      562      +48     
- Misses        310      325      +15     
- Partials       17       18       +1     
Impacted Files Coverage Δ
reconcilers/enqueuer.go 0.00% <0.00%> (ø)
reconcilers/reconcilers.go 79.96% <67.74%> (-0.51%) ⬇️
reconcilers/patch.go 74.19% <100.00%> (+0.86%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b2e5a8...eaf3752. Read the comment docs.

@scothis scothis merged commit bb1d838 into vmware-labs:main Apr 21, 2022
@scothis scothis deleted the config-context branch April 21, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants