Skip to content

feat: record events for classifier failures and label conflicts - #523

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:events
Oct 11, 2026
Merged

gianlucam76 merged 1 commit into
projectsveltos:mainfrom
gianlucam76:events

Conversation

@gianlucam76

Copy link
Copy Markdown
Member

Classifier errors were only logged, many of them at debug level, so a user had no way to see from the cluster why a Classifier or a ManagementClusterClassifier was not working. Record Warning events, using the reasons and actions from libsveltos lib/eventreasons.

Classifier:

  • ClassifierFailed (Reconciling) when one of the reconcileNormal steps fails: matching clusters, cleanup, registrations, applying labels, ensuring ClassifierReports, updating internal maps.
  • ClassifierLabelConflict for a cluster whose labels are already managed by another Classifier.
  • ClassifierFailed (Deploying) when the deployment in a cluster ended with status Failed.

ManagementClusterClassifier: ClassifierFailed for failures building the cluster sets, getting the key manager, removing stale labels, updating a report or applying labels, and for Lua evaluation errors; ClassifierLabelConflict as above.

Deliberately no event for deployments still in progress, paused or not ready clusters, or an unhealthy agent: those are expected states, and the agent problem is a cluster problem that sveltoscluster-manager will report once per cluster. Note: errors in the report collection loop are not covered.

Both reconcilers get an EventRecorder (nil means no event is recorded) and the manager role the events.k8s.io permission. The label application loop of the ManagementClusterClassifier moves into its own method to keep reconcileNormal within the statement limit.

Known limitation: the events recorder merges events with the same reason, action and regarding object, keeping only the first note, so events for different clusters of the same Classifier are merged.

Classifier errors were only logged, many of them at debug level, so a
user had no way to see from the cluster why a Classifier or a
ManagementClusterClassifier was not working. Record Warning events,
using the reasons and actions from libsveltos lib/eventreasons.

Classifier:
- ClassifierFailed (Reconciling) when one of the reconcileNormal steps
  fails: matching clusters, cleanup, registrations, applying labels,
  ensuring ClassifierReports, updating internal maps.
- ClassifierLabelConflict for a cluster whose labels are already managed
  by another Classifier.
- ClassifierFailed (Deploying) when the deployment in a cluster ended
  with status Failed.

ManagementClusterClassifier: ClassifierFailed for failures building the
cluster sets, getting the key manager, removing stale labels, updating a
report or applying labels, and for Lua evaluation errors;
ClassifierLabelConflict as above.

Deliberately no event for deployments still in progress, paused or not
ready clusters, or an unhealthy agent: those are expected states, and the
agent problem is a cluster problem that sveltoscluster-manager will
report once per cluster. Note: errors in the report collection loop are
not covered.

Both reconcilers get an EventRecorder (nil means no event is recorded)
and the manager role the events.k8s.io permission. The label application
loop of the ManagementClusterClassifier moves into its own method to keep
reconcileNormal within the statement limit.

Known limitation: the events recorder merges events with the same
reason, action and regarding object, keeping only the first note, so
events for different clusters of the same Classifier are merged.
@gianlucam76
gianlucam76 merged commit a555853 into projectsveltos:main Oct 11, 2026
9 checks passed
@gianlucam76
gianlucam76 deleted the events branch October 11, 2026 13:31
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