-
Notifications
You must be signed in to change notification settings - Fork 117
Refactor status collector architecture with structured errors #2016
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2016 +/- ##
==========================================
- Coverage 47.96% 47.89% -0.07%
==========================================
Files 233 235 +2
Lines 29172 29226 +54
==========================================
+ Hits 13991 13997 +6
- Misses 14148 14197 +49
+ Partials 1033 1032 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
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.
In general I think this is a very nice refactor, one question about concurrent access inline
Type: mcpv1alpha1.ConditionAPIReady, | ||
// SetCondition sets a general condition with the specified type, reason, message, and status | ||
func (s *StatusCollector) SetCondition(conditionType, reason, message string, status metav1.ConditionStatus) { | ||
s.conditions[conditionType] = metav1.Condition{ |
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.
This is not strictly cause by your patch but since we have multiple methods writing into s.conditions
do you think we should use a SyncMap
or similar?
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.
IIRC, controller-runtime ensures single-threaded execution per resource instance. Within a single reconciliation, all method calls are sequential, not concurrent. So, Im not sure we need any synchronized data access, given that each reconciliation creates a new StatusManager with its own map of conditions.
Let me know what you think about this (yes, I asked CC before replying 😉 )
// API reconciliation successful - check readiness and set appropriate status | ||
isReady := r.registryAPIManager.IsAPIReady(ctx, mcpRegistry) | ||
if isReady { | ||
// TODO: Get actual service endpoint - for now, construct it |
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.
why wasn't it covered here, is it complex to retrieve?
Fixes #2004
Collector
interface withSyncStatusCollector
andAPIStatusCollector
to pass only the needed one to the processing methodsError
type to transport condition and phase information to the root, instead of a generic errorThis change is needed to solve #1749 for error paths: some more changes may needed to fix the e2e tests.