Open
Conversation
This commit refactores the probe initialization to use a Hive Job instead of a plain lifecycle start hook. This way we can also get rid of the raw Go routine to execute the check if every probe successfully executed at least once before exposing the status. Note: the kvstore "shutdown check" is still part of its own lifecycle stop hook. Probably better to eventually move this to the kvstore module. Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
Greptile OverviewGreptile SummaryRefactored status probe initialization from lifecycle hooks to hive job pattern. The change migrates probe startup logic from Key Changes:
Behavior Changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Hive as Hive Framework
participant Job as Job Group
participant SC as StatusCollector
participant Collector as Collector
participant Probes as Probes
participant Health as Health Reporter
Note over Hive,SC: Initialization Phase
Hive->>SC: newStatusCollector(params)
SC->>Collector: newCollector(logger, config)
Note over Job,Health: Job Execution Phase
Hive->>Job: Start JobGroup
Job->>Job: Execute OneShot("probes")
Job->>Health: Provide Health scope
Job->>SC: Call job function with ctx
SC->>Probes: getProbes()
Probes-->>SC: Return probe list
SC->>Collector: StartProbes(probes)
Note over Collector,Probes: Probes run in goroutines
SC->>SC: Create timeout context
SC->>Collector: WaitForFirstRun(waitCtx)
alt All probes succeed
Collector-->>SC: return nil
SC->>SC: Set allProbesInitialized = true
SC->>Job: Wait for ctx.Done()
Job->>SC: Context cancelled
SC->>Collector: defer Close()
SC-->>Job: return nil
else Probes timeout
Collector-->>SC: return error
SC->>Collector: defer Close()
SC-->>Job: return error (health degraded)
end
Note over Hive,SC: Shutdown Phase
Hive->>SC: OnStop hook
SC->>SC: Check KVstore status
SC-->>Hive: return nil
|
This file contains hidden or 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
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.
PR_044