Skip to content

Commit

Permalink
fix: move macvlan binary to host
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Nov 4, 2021
1 parent 52ec0af commit 841f907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions dist/images/install-cni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ LOOPBACK_BIN_DST=/opt/cni/bin/loopback
PORTMAP_BIN_SRC=/portmap
PORTMAP_BIN_DST=/opt/cni/bin/portmap

MACVLAN_BIN_SRC=/macvlan
MACVLAN_BIN_DST=/opt/cni/bin/macvlan

yes | cp -f $LOOPBACK_BIN_SRC $LOOPBACK_BIN_DST || exit_with_error "Failed to copy $LOOPBACK_BIN_SRC to $LOOPBACK_BIN_DST"
yes | cp -f $PORTMAP_BIN_SRC $PORTMAP_BIN_DST || exit_with_error "Failed to copy $PORTMAP_BIN_SRC to $PORTMAP_BIN_DST"
yes | cp -f $CNI_BIN_SRC $CNI_BIN_DST || exit_with_error "Failed to copy $CNI_BIN_SRC to $CNI_BIN_DST"
yes | cp -f $MACVLAN_BIN_SRC $MACVLAN_BIN_DST || exit_with_error "Failed to copy $MACVLAN_BIN_SRC to $MACVLAN_BIN_DST"
6 changes: 3 additions & 3 deletions pkg/daemon/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
}
return
}

klog.V(5).Infof("request body is %v", podRequest)
if exist := csh.providerExists(podRequest.Provider); !exist {
errMsg := fmt.Errorf("provider %s not bind to any subnet", podRequest.Provider)
klog.Error(errMsg)
Expand All @@ -83,7 +83,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
return
}
if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, podRequest.Provider)] != "true" {
klog.Infof("wait address for pod %s/%s ", podRequest.PodNamespace, podRequest.PodName)
klog.Infof("wait address for pod %s/%s provider %s", podRequest.PodNamespace, podRequest.PodName, podRequest.Provider)
// wait controller assign an address
cniWaitAddressResult.WithLabelValues(nodeName).Inc()
time.Sleep(1 * time.Second)
Expand Down Expand Up @@ -132,7 +132,7 @@ func (csh cniServerHandler) handleAdd(req *restful.Request, resp *restful.Respon
ifName = "eth0"
}
if pod.Annotations[fmt.Sprintf(util.AllocatedAnnotationTemplate, podRequest.Provider)] != "true" {
err := fmt.Errorf("no address allocated to pod %s/%s, please see kube-ovn-controller logs to find errors", pod.Namespace, pod.Name)
err := fmt.Errorf("no address allocated to 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 {
klog.Errorf("failed to write response, %v", err)
Expand Down

0 comments on commit 841f907

Please sign in to comment.