Skip to content

Commit

Permalink
add not found err check for lb-svc (#4748)
Browse files Browse the repository at this point in the history
Signed-off-by: 马洪贞 <[email protected]>
  • Loading branch information
hongzhen-ma authored Nov 20, 2024
1 parent 6e158d6 commit 671ad64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controller/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ func (c *Controller) handleUpdateService(svcObject *updateSvcObject) error {
pod, err := c.getLbSvcPod(name, namespace)
if err != nil {
klog.Errorf("failed to get pod for lb svc %s: %v", key, err)
if strings.Contains(err.Error(), "not found") {
return nil
}
return err
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/service_lb.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ func (c *Controller) checkLbSvcDeployAnnotationChanged(svc *corev1.Service) (boo
deployName := genLbSvcDpName(svc.Name)
deploy, err := c.config.KubeClient.AppsV1().Deployments(svc.Namespace).Get(context.Background(), deployName, metav1.GetOptions{})
if err != nil {
if k8serrors.IsNotFound(err) {
return false, nil
}
return false, err
}

Expand Down

0 comments on commit 671ad64

Please sign in to comment.