chore(vm): reduce noise in logs about "namespaces not found"#1566
Draft
chore(vm): reduce noise in logs about "namespaces not found"#1566
Conversation
Do not requeue reconcile if status was not updated with error "namespaces ... not found". Just print Warning in this situation. Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIntroduce a new branch in the reconcile handler that intercepts namespace-not-found errors, logs them as warnings, and suppresses requeueing, reducing log noise during e2e tests. Sequence diagram for updated error handling in VM reconcile processsequenceDiagram
participant Controller
participant Logger
participant KubernetesAPI
Controller->KubernetesAPI: Update resource status
KubernetesAPI-->>Controller: Error (namespace not found)
Controller->Logger: Warn("Namespace is gone while reconcile the object")
Note over Controller: No requeue triggered
Class diagram for updated error handling in ReconcilerclassDiagram
class Reconciler {
+reconcile()
}
Reconciler : +handlersLoop
Reconciler : -case k8serrors.IsNotFound(err) && strings.Contains(err.Error(), "namespaces")
Reconciler : +Warn("Namespace is gone while reconcile the object")
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Matching on the ‘namespaces’ substring in err.Error() is brittle—consider using apierrors.StatusError and inspecting Status().Details.Kind to robustly identify namespace-not-found errors.
- Revisiting whether skipping the requeue entirely on namespace-not-found is safe for all scenarios, or if a deferred requeue with backoff might better handle transient deletion races.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Matching on the ‘namespaces’ substring in err.Error() is brittle—consider using apierrors.StatusError and inspecting Status().Details.Kind to robustly identify namespace-not-found errors.
- Revisiting whether skipping the requeue entirely on namespace-not-found is safe for all scenarios, or if a deferred requeue with backoff might better handle transient deletion races.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Member
Author
|
Warning is not enough here. May be we should add metric and alert for such cases. The problem was that VM stuck in Terminating state but NS was forced to delete. |
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.
Description
Do not requeue reconcile if status was not updated with error "namespaces ... not found". Just print Warning in this situation.
Why do we need it, and what problem does it solve?
This situation is not an error, but it fails e2e tests with this messages:
What is the expected result?
Reduce number of false-negative e2e runs.
Checklist
Changelog entries