Skip to content

feat: Add health monitoring: cluster health status and /clusterHealth endpoint - #193

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:health-monitoring
Oct 16, 2026
Merged

gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:health-monitoring

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

Expose the health of the resources Sveltos deploys (profiles with spec.healthMonitoring.enabled) so the dashboard can show it per cluster and per profile.

ui-backend joins three things: the ClusterSummaries (which profile has monitoring enabled), the HealthChecks addon-controller generates for them (found by label and annotations, never by name) and the HealthCheckReports. The join is the shared addon-controller lib/healthmonitoring package, so the cluster list, the profile rows and the detail view cannot diverge.

Cache: a new healthCache in internal/server with its own lock, filled by two new controllers (HealthCheck, metadata only and filtered to generated checks; and HealthCheckReport) plus the existing ClusterSummary controller. Events can arrive in any order: each updates its own maps and recomputes only the cluster it touches. The report cache drops the collected resources (ResourceStatuses[].Resource), which are never read and are the only large field.

API:

  • ManagedCluster.healthStatus on /capiclusters and /sveltosclusters.
  • healthStatus on each /getClusterStatus row, for the profile.
  • New GET /clusterHealth: the resources that are not Healthy, worst first, each with group, version, kind, namespace, name, status, message and the profiles owning the check. Filters profile_kind, profile_namespace, profile_name, resource_kind, resource_namespace, resource_name, plus limit and skip. Resources reported by a HealthCheck no profile owns are listed without profiles and carry the HealthCheck name.
  • healthStatus is omitted when no profile on the cluster has monitoring enabled. Values: NoData, Healthy, Suspended, Progressing, Degraded.

RBAC: get/list/watch on healthchecks and healthcheckreports (role.yaml and manifest.yaml). The helm chart needs the same rules.

… endpoint

Expose the health of the resources Sveltos deploys (profiles with
spec.healthMonitoring.enabled) so the dashboard can show it per cluster and per profile.

ui-backend joins three things: the ClusterSummaries (which profile has monitoring
enabled), the HealthChecks addon-controller generates for them (found by label and
annotations, never by name) and the HealthCheckReports. The join is the shared
addon-controller lib/healthmonitoring package, so the cluster list, the profile rows
and the detail view cannot diverge.

Cache: a new healthCache in internal/server with its own lock, filled by two new
controllers (HealthCheck, metadata only and filtered to generated checks; and
HealthCheckReport) plus the existing ClusterSummary controller. Events can arrive in
any order: each updates its own maps and recomputes only the cluster it touches. The
report cache drops the collected resources (ResourceStatuses[].Resource), which are
never read and are the only large field.

API:
- ManagedCluster.healthStatus on /capiclusters and /sveltosclusters.
- healthStatus on each /getClusterStatus row, for the profile.
- New GET /clusterHealth: the resources that are not Healthy, worst first, each with
  group, version, kind, namespace, name, status, message and the profiles owning the
  check. Filters profile_kind, profile_namespace, profile_name, resource_kind,
  resource_namespace, resource_name, plus limit and skip. Resources reported by a
  HealthCheck no profile owns are listed without profiles and carry the HealthCheck name.
- healthStatus is omitted when no profile on the cluster has monitoring enabled.
  Values: NoData, Healthy, Suspended, Progressing, Degraded.

RBAC: get/list/watch on healthchecks and healthcheckreports (role.yaml and
manifest.yaml). The helm chart needs the same rules.
@gianlucam76
gianlucam76 merged commit 08e96e9 into projectsveltos:main Oct 16, 2026
5 checks passed
@gianlucam76
gianlucam76 deleted the health-monitoring branch October 16, 2026 14:10
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