Skip to content

Commit

Permalink
cni-server: fix waiting for routed annotation (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jan 5, 2023
1 parent 938bd68 commit 45d1c15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
isDefaultRoute = ifName == "eth0"
}

if isDefaultRoute && pod.Annotations[fmt.Sprintf(util.RoutedAnnotationTemplate, podRequest.Provider)] != "true" && strings.HasSuffix(providerNetwork, util.OvnProvider) {
if isDefaultRoute && pod.Annotations[fmt.Sprintf(util.RoutedAnnotationTemplate, podRequest.Provider)] != "true" && strings.HasSuffix(podRequest.Provider, util.OvnProvider) {
klog.Infof("wait route ready for pod %s/%s provider %s", podRequest.PodNamespace, podRequest.PodName, podRequest.Provider)
cniWaitRouteResult.WithLabelValues(nodeName).Inc()
time.Sleep(1 * time.Second)
Expand Down Expand Up @@ -165,7 +165,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
return
}

if isDefaultRoute && pod.Annotations[fmt.Sprintf(util.RoutedAnnotationTemplate, podRequest.Provider)] != "true" && strings.HasSuffix(providerNetwork, util.OvnProvider) {
if isDefaultRoute && pod.Annotations[fmt.Sprintf(util.RoutedAnnotationTemplate, podRequest.Provider)] != "true" && strings.HasSuffix(podRequest.Provider, util.OvnProvider) {
err := fmt.Errorf("route is not ready for pod %s/%s provider %s, please see kube-ovn-controller logs to find errors", pod.Namespace, pod.Name, podRequest.Provider)
klog.Error(err)
if err := resp.WriteHeaderAndEntity(http.StatusInternalServerError, request.CniResponse{Err: err.Error()}); err != nil {
Expand Down

0 comments on commit 45d1c15

Please sign in to comment.