-
Notifications
You must be signed in to change notification settings - Fork 96
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
Refactor Status Updater to be resource agnostic #1814
Merged
pleshakov
merged 10 commits into
nginxinc:main
from
pleshakov:techdebt/refactor-status-updater
Apr 16, 2024
Merged
Refactor Status Updater to be resource agnostic #1814
pleshakov
merged 10 commits into
nginxinc:main
from
pleshakov:techdebt/refactor-status-updater
Apr 16, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: Currently, the status updater is aware of what resource it is updating the status of. This makes it difficult to extend because for each new resource we add support for, we have to modify the status updater. Solution: Replace old status updater with two new ones (1) Regular Updater, to update statuses of multiple resources via UpdateRequest type. (2) LeaderAwareGroupUpdater to update statuses of groups of resources and save any pending UpdateRequests until the updater is enabled (when pod becomes leader). It uses Regular Updater. Using groups allow replacing UpdateRequests of subset of resources, without the need to recompute UpdateRequests for all resources. The new status package is resource agnostic. This is accomplished by representing status update as a function (Setter). Other updates: - provisioner manager uses regular Updater. - static manager uses LeaderAwareGroupUpdater (because it needs to support leader election) - framework Status setter were simplified and moved to static/status package - status related functions in static package were moved to static/status package. - Previous Build* functions were replaced with PrepareRequests functions. Such functions don't create any intermediate status representation (like it was before), but create status UpdateRequests which directly set the resource statuses. CLOSES -- nginxinc#1071
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1814 +/- ##
==========================================
- Coverage 86.18% 85.66% -0.52%
==========================================
Files 87 82 -5
Lines 5522 5331 -191
Branches 52 0 -52
==========================================
- Hits 4759 4567 -192
+ Misses 717 715 -2
- Partials 46 49 +3 ☔ View full report in Codecov by Sentry. |
sjberman
reviewed
Apr 8, 2024
kate-osborn
requested changes
Apr 12, 2024
sjberman
approved these changes
Apr 15, 2024
kate-osborn
approved these changes
Apr 16, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
Problem:
Currently, the status updater is aware of what resource it is updating the status of. This makes it difficult to extend because for each new resource we add support for, we have to modify the status updater.
Solution:
Replace old status updater with two new ones
(1) Regular Updater, to update statuses of multiple resources via UpdateRequest type.
(2) LeaderAwareGroupUpdater to update statuses of groups of resources and save any pending UpdateRequests until the updater is enabled (when pod becomes leader). It uses Regular Updater.
Using groups allow replacing UpdateRequests of subset of resources, without the need to recompute UpdateRequests for all resources.
The new status package is
resource agnostic. This is accomplished by representing status update as a function (Setter).
Other updates:
based on manager configuration. Previously, the conditional logic was
implemented in the Status Updater.
CLOSES -- #1071
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.