-
Notifications
You must be signed in to change notification settings - Fork 54
fix: webhook fails closed when rule listing errors #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -80,9 +80,12 @@ func (w *NodeReadinessRuleWebhook) validateTaintConflicts(ctx context.Context, r | |||||||||||||||
| // List all existing rules | ||||||||||||||||
| ruleList := &readinessv1alpha1.NodeReadinessRuleList{} | ||||||||||||||||
| if err := w.List(ctx, ruleList); err != nil { | ||||||||||||||||
| // If we can't list rules, allow the operation but log the issue | ||||||||||||||||
| ctrl.Log.Error(err, "Failed to list rules for conflict validation") | ||||||||||||||||
| return allErrs | ||||||||||||||||
| // Fail closed: if we can't list rules, we cannot safely validate | ||||||||||||||||
| // for conflicts. Reject the request so the client can retry. | ||||||||||||||||
| return append(allErrs, field.InternalError( | ||||||||||||||||
| nil, | ||||||||||||||||
| fmt.Errorf("unable to validate taint conflicts, please retry: %w", err), | ||||||||||||||||
| )) | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I suggest to add back the
Suggested change
so, it outputs an error like:
|
||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| taintField := field.NewPath("spec", "taint", "key") | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, let's keep the log line as it is -
ctrl.Log.Error(err, "Failed to list rules for conflict validation")it will show up in the controller logs and would be useful for debugging.