Skip to content

Commit

Permalink
fix deleting vip on ovn lb (#4047)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed May 20, 2024
1 parent 75e742d commit b20a57d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dist/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax = docker/dockerfile:experimental
FROM kubeovn/kube-ovn-base:v1.9.31
FROM kubeovn/kube-ovn-base:v1.9.32

ARG ARCH
ENV DUMB_INIT_VERSION="1.2.5"
Expand Down
6 changes: 4 additions & 2 deletions dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ RUN cd /usr/src/ && git clone -b branch-21.06 --depth=1 https://github.com/ovn-o
curl -s https://github.com/kubeovn/ovn/commit/71f831b9cc5a6dc923af4ca90286857e2cf8b1d3.patch | git apply && \
# fix reaching resubmit limit in underlay
curl -s https://github.com/kubeovn/ovn/commit/0f6fe4202001c0950dc689179e7a4ad9554a51fa.patch | git apply && \
# do not remove LB if vips is empty
curl -s https://github.com/kubeovn/ovn/commit/472809ebc83588cf321935804f171b271fd81476.patch | git apply && \
# ovn-controller: do not send GARP on localnet for Kube-OVN ports
curl -s https://github.com/kubeovn/ovn/commit/60207f7a3d072848936221f1b767722984fd50ae.patch | git apply && \
# backport tos inherit from inner packet
Expand Down Expand Up @@ -93,10 +95,10 @@ RUN mkdir -p /var/run/openvswitch && \
mkdir -p /opt/cni/bin

ARG ARCH
ENV CNI_VERSION=v1.2.0
ENV CNI_VERSION=v1.4.1
RUN curl -sSf -L --retry 5 https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz | tar -xz -C . ./loopback ./portmap ./macvlan

ENV KUBE_VERSION="v1.21.1"
ENV KUBE_VERSION="v1.29.5"

RUN curl -L https://dl.k8s.io/${KUBE_VERSION}/kubernetes-client-linux-${ARCH}.tar.gz | tar -xz -C . && cp ./kubernetes/client/bin/kubectl /usr/bin/kubectl \
&& chmod +x /usr/bin/kubectl && rm -rf ./kubernetes
Expand Down
25 changes: 1 addition & 24 deletions pkg/ovs/ovn-nbctl-legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1216,30 +1216,7 @@ func (c LegacyClient) removeLoadBalancerFromLogicalSwitch(lb, ls string) error {

// DeleteLoadBalancerVip delete a vip rule from loadbalancer
func (c LegacyClient) DeleteLoadBalancerVip(vip, lb string) error {
lbUuid, err := c.FindLoadbalancer(lb)
if err != nil {
klog.Errorf("failed to get lb: %v", err)
return err
}

existVips, err := c.GetLoadBalancerVips(lbUuid)
if err != nil {
klog.Errorf("failed to list lb %s vips: %v", lb, err)
return err
}
// vip is empty or delete last rule will destroy the loadbalancer
if vip == "" {
return nil
}
if len(existVips) == 1 {
if output, err := c.ovnNbCommand("clear", "load_balancer", lb, "vips"); err != nil {
klog.Errorf("failed to clear vips %v for load_balancer %v, %q", existVips, lb, output)
return err
}
return nil
}

_, err = c.ovnNbCommand(IfExists, "lb-del", lb, vip)
_, err := c.ovnNbCommand(IfExists, "lb-del", lb, vip)
return err
}

Expand Down

0 comments on commit b20a57d

Please sign in to comment.