Skip to content
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

Fixed an issue where pub webhooks unexpectedly return error when PUB is NOT FOUND #1579

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/control/pubcontrol/pub_control_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
pubClone, err = kubeClient.GetGenericClient().KruiseClient.PolicyV1alpha1().
PodUnavailableBudgets(pub.Namespace).Get(context.TODO(), pub.Name, metav1.GetOptions{})
if err != nil {
if errors.IsNotFound(err) {
return nil

Check warning on line 107 in pkg/control/pubcontrol/pub_control_utils.go

View check run for this annotation

Codecov / codecov/patch

pkg/control/pubcontrol/pub_control_utils.go#L106-L107

Added lines #L106 - L107 were not covered by tests
}
klog.ErrorS(err, "Failed to get podUnavailableBudget form etcd", "pub", klog.KObj(pub))
return err
}
Expand Down Expand Up @@ -169,6 +172,10 @@
klog.ErrorS(err, "Failed to add cache for podUnavailableBudget", "pub", klog.KObj(pub))
}
return nil
} else {
if errors.IsNotFound(err) {
return nil

Check warning on line 177 in pkg/control/pubcontrol/pub_control_utils.go

View check run for this annotation

Codecov / codecov/patch

pkg/control/pubcontrol/pub_control_utils.go#L175-L177

Added lines #L175 - L177 were not covered by tests
}
}
// if conflicts, then retry
conflictTimes++
Expand Down
Loading