Skip to content

Commit

Permalink
Fixed an issue where pub webhooks unexpectedly return error when PUB …
Browse files Browse the repository at this point in the history
…is NOT FOUND (#1579)

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

Signed-off-by: JinXinWang <[email protected]>

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

Signed-off-by: JinXinWang <[email protected]>

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

Signed-off-by: JinXinWang <[email protected]>

---------

Signed-off-by: JinXinWang <[email protected]>
  • Loading branch information
opencmit2 authored Apr 23, 2024
1 parent 38f432f commit 2da1b90
Showing 1 changed file with 7 additions and 0 deletions.
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 @@ func PodUnavailableBudgetValidatePod(pod *corev1.Pod, operation policyv1alpha1.P
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
}
klog.ErrorS(err, "Failed to get podUnavailableBudget form etcd", "pub", klog.KObj(pub))
return err
}
Expand Down Expand Up @@ -169,6 +172,10 @@ func PodUnavailableBudgetValidatePod(pod *corev1.Pod, operation policyv1alpha1.P
klog.ErrorS(err, "Failed to add cache for podUnavailableBudget", "pub", klog.KObj(pub))
}
return nil
} else {
if errors.IsNotFound(err) {
return nil
}
}
// if conflicts, then retry
conflictTimes++
Expand Down

0 comments on commit 2da1b90

Please sign in to comment.