Repository navigation
Add lib/healthmonitoring: shared join of health reports and ClusterSummaries - #2039
Merged
gianlucam76 merged 1 commit intoOct 16, 2026
Merged
Conversation
…mmaries Add a small package that joins the HealthCheckReports of one cluster with the ClusterSummaries owning the HealthChecks behind them, and returns the health state per profile, the cluster state, and a flat list of unhealthy resources. Why it lives here: the report carries no reference to a ClusterSummary, so the link can only be made by a join (generated HealthCheck labels/annotations, plus the checks a ClusterProfile lists). ui-backend (cluster list and "Unhealthy resources" view) and sveltosctl (new `show` command) both need that join. It cannot live in libsveltos (it needs the ClusterSummary type and the label constants, and addon-controller imports libsveltos), and both consumers already import addon-controller. A single implementation keeps the cluster badge, the per-profile badge and the detail list from diverging. The package is pure: no client, no locks. Callers build the inputs from their own caches or from Lists (NewSummaryInput, NewReportInput, GeneratedCheckOwner). - Evaluate: per-profile state (NoData, Healthy, worst status), cluster state, resources deduplicated (worst status wins, shared checks list all their profiles), unclaimed reports (no owning profile) keep the HealthCheck name, sorted worst first. - Listed healthChecks are honored for a ClusterProfile only, as in the controller. - status.agentFailureMessage is not considered yet.
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.
Add a small package that joins the HealthCheckReports of one cluster with the ClusterSummaries owning the HealthChecks behind them, and returns the health state per profile, the cluster state, and a flat list of unhealthy resources.
Why it lives here: the report carries no reference to a ClusterSummary, so the link can only be made by a join (generated HealthCheck labels/annotations, plus the checks a ClusterProfile lists). ui-backend (cluster list and "Unhealthy resources" view) and sveltosctl (new
showcommand) both need that join. It cannot live in libsveltos (it needs the ClusterSummary type and the label constants, and addon-controller imports libsveltos), and both consumers already import addon-controller. A single implementation keeps the cluster badge, the per-profile badge and the detail list from diverging.The package is pure: no client, no locks. Callers build the inputs from their own caches or from Lists (NewSummaryInput, NewReportInput, GeneratedCheckOwner).