Skip to content

feat: sveltosctl show unhealthy-resources - #455

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:health
Oct 19, 2026
Merged

gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:health

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

Adds sveltosctl show unhealthy-resources, which lists the resources health monitoring found not Healthy. Until now kubectl get healthcheckreports showed an hm-<hash> HealthCheck name that nobody could map back to a profile.

For each resource the command displays the profile owning the HealthCheck that reported it. When no profile owns the HealthCheck, the HealthCheck is displayed instead. The worst status comes first. Filters: --namespace, --cluster, --cluster-type and --profile. With --profile only the resources reported through that profile are displayed.

When nothing is displayed for a cluster, a note under the table says why: health monitoring is not enabled, no health report has been received yet, or no resource is unhealthy. An empty table is never read as healthy. With --profile the note is about that profile.

The ClusterSummary to HealthCheckReport join is the shared lib/healthmonitoring package of addon-controller, the same one ui-backend and mcp-server use, so the three cannot diverge.

The data is selected by the API server, so the cost does not grow with the clusters not selected:

  • HealthCheckReports by namespace and the cluster name and type labels.
  • Generated HealthChecks by the UID of the ClusterSummaries, 100 per request, metadata only. When there are more than 2000 UIDs, all the generated HealthChecks are listed with one request.

Measured on a kind cluster with 100 clusters, 20 profiles each and 20,000 unhealthy resources: about 0.5 s for the whole fleet, 0.05 s for one cluster and profile.

Tests are Ginkgo specs: the command (filters, owned and unowned reports, the three notes) and the label selection of reports and HealthChecks, including the batched and the list-all paths.

go.mod and go.sum move to the addon-controller and libsveltos versions that contain lib/healthmonitoring.

🤖 Generated with Claude Code

Add a show subcommand listing the resources health monitoring found not
Healthy, with the profile owning the HealthCheck that reported each of
them. When no profile owns the HealthCheck, the HealthCheck is displayed
instead. Filters: --namespace, --cluster, --cluster-type, --profile.

When nothing is displayed for a cluster, a note explains why: health
monitoring is not enabled, no health report has been received yet, or no
resource is unhealthy.

The ClusterSummary to HealthCheckReport join is the one shared with
ui-backend and mcp-server (addon-controller lib/healthmonitoring).

The data is selected by the API server so the cost does not grow with the
clusters not selected: the HealthCheckReports by namespace and the cluster
name and type labels, the generated HealthChecks by the UID of the
ClusterSummaries (in batches, metadata only; all the generated ones are
listed at once when there are more than 2000).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gianlucam76
gianlucam76 merged commit e4298c4 into projectsveltos:main Oct 19, 2026
4 checks passed
@gianlucam76
gianlucam76 deleted the health branch October 19, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant