Repository navigation
feat: record events for classifier failures and label conflicts - #523
Merged
Merged
Conversation
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.
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.
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:
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.