Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovs: fix memory leak in qos #2871

Merged
merged 1 commit into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ jobs:
- build-kube-ovn
- build-e2e-binaries
runs-on: ubuntu-22.04
timeout-minutes: 15
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
Expand Down
25 changes: 16 additions & 9 deletions dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ RUN cd /usr/src/ && \
# ovsdb-tool: add optional server id parameter for "join-cluster" command
curl -s https://github.com/kubeovn/ovs/commit/ebf61515da71fa2e23125a92859fbdb96dcbffe7.patch | git apply && \
# Add jitter parameter patch for netem qos
curl -s https://github.com/kubeovn/ovs/commit/2eaaf89fbf3ee2172719ed10d045fd79900edc8e.patch | git apply
curl -s https://github.com/kubeovn/ovs/commit/2eaaf89fbf3ee2172719ed10d045fd79900edc8e.patch | git apply && \
# fix memory leak in qos
curl -s https://github.com/kubeovn/ovs/commit/6a4dd2f4b9311a227cc26fef7c398ae9b241311b.patch | git apply

RUN cd /usr/src/ && git clone -b branch-22.12 --depth=1 https://github.com/ovn-org/ovn.git && \
cd ovn && \
Expand Down Expand Up @@ -69,14 +71,12 @@ RUN mkdir /packages/ && \

FROM ubuntu:22.04

ARG DEBUG=false
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y && apt install ca-certificates python3 hostname libunwind8 netbase \
ethtool iproute2 ncat libunbound-dev procps libatomic1 kmod iptables python3-netifaces python3-sortedcontainers \
tcpdump ipset curl uuid-runtime openssl inetutils-ping arping ndisc6 \
logrotate dnsutils net-tools strongswan strongswan-pki libcharon-extra-plugins \
libcharon-extauth-plugins libstrongswan-extra-plugins libstrongswan-standard-plugins -y --no-install-recommends && \
if [ "${DEBUG}" = "true" ]; then apt install -y --no-install-recommends valgrind; fi && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /etc/localtime

Expand All @@ -94,12 +94,6 @@ ENV KUBE_VERSION="v1.27.2"
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

RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \
dpkg -i /packages/openvswitch-*.deb /packages/python3-openvswitch*.deb && \
dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb && \
if [ "${DEBUG}" = "true" ]; then dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/*.ddeb; fi && \
rm -rf /var/lib/openvswitch/pki/

ENV BFDD_VERSION="v0.5.4"
RUN curl -sSf -L --retry 3 -o /usr/local/bin/bfdd-control https://github.com/bobz965/bfd-binary-for-kube-ovn-cni/releases/download/${BFDD_VERSION}/bfdd-control && \
curl -sSf -L --retry 3 -o /usr/local/bin/bfdd-beacon https://github.com/bobz965/bfd-binary-for-kube-ovn-cni/releases/download/${BFDD_VERSION}/bfdd-beacon && \
Expand All @@ -111,4 +105,17 @@ RUN dumb_init_arch="x86_64"; \
curl -sSf -L --retry 5 -o /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${dumb_init_arch} && \
chmod +x /usr/bin/dumb-init

RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \
dpkg -i /packages/openvswitch-*.deb /packages/python3-openvswitch*.deb && \
dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb && \
rm -rf /var/lib/openvswitch/pki/

ARG DEBUG=false
RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \
if [ "${DEBUG}" = "true" ]; then \
apt update && apt install -y --no-install-recommends valgrind && \
rm -rf /var/lib/apt/lists/* && \
dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/*.ddeb; \
fi

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
35 changes: 10 additions & 25 deletions test/e2e/kube-ovn/qos/qos.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,23 @@ func waitOvsQosForPod(f *framework.Framework, table string, pod *corev1.Pod, exp
var _ = framework.Describe("[group:qos]", func() {
f := framework.NewDefaultFramework("qos")

var subnetName, namespaceName string
var podName, namespaceName string
var podClient *framework.PodClient
var subnetClient *framework.SubnetClient

ginkgo.BeforeEach(func() {
podClient = f.PodClient()
subnetClient = f.SubnetClient()
namespaceName = f.Namespace.Name
podName = "pod-" + framework.RandomSuffix()
})
ginkgo.AfterEach(func() {
if subnetName != "" {
ginkgo.By("Deleting subnet " + subnetName)
subnetClient.DeleteSync(subnetName)
}
ginkgo.By("Deleting pod " + podName)
podClient.DeleteSync(podName)
})

framework.ConformanceIt("should support netem QoS", func() {
f.SkipVersionPriorTo(1, 9, "Support for netem QoS was introduced in v1.9")

name := "pod-" + framework.RandomSuffix()
ginkgo.By("Creating pod " + name)
ginkgo.By("Creating pod " + podName)
latency, jitter, limit, loss := 600, 400, 2000, 10
annotations := map[string]string{
util.NetemQosLatencyAnnotation: strconv.Itoa(latency),
Expand All @@ -105,7 +101,7 @@ var _ = framework.Describe("[group:qos]", func() {
if !f.VersionPriorTo(1, 12) {
annotations[util.NetemQosJitterAnnotation] = strconv.Itoa(jitter)
}
pod := framework.MakePod(namespaceName, name, nil, annotations, "", nil, nil)
pod := framework.MakePod(namespaceName, podName, nil, annotations, "", nil, nil)
pod = podClient.CreateSync(pod)

ginkgo.By("Validating pod annotations")
Expand All @@ -126,17 +122,13 @@ var _ = framework.Describe("[group:qos]", func() {
}
framework.ExpectHaveKeyWithValue(qos, "limit", strconv.Itoa(limit))
framework.ExpectHaveKeyWithValue(qos, "loss", strconv.Itoa(loss))

ginkgo.By("Deleting pod " + name)
podClient.DeleteSync(pod.Name)
})

framework.ConformanceIt("should be able to update netem QoS", func() {
f.SkipVersionPriorTo(1, 9, "Support for netem QoS was introduced in v1.9")

name := "pod-" + framework.RandomSuffix()
ginkgo.By("Creating pod " + name + " without QoS")
pod := framework.MakePod(namespaceName, name, nil, nil, "", nil, nil)
ginkgo.By("Creating pod " + podName + " without QoS")
pod := framework.MakePod(namespaceName, podName, nil, nil, "", nil, nil)
pod = podClient.CreateSync(pod)

ginkgo.By("Validating pod annotations")
Expand Down Expand Up @@ -176,21 +168,17 @@ var _ = framework.Describe("[group:qos]", func() {
}
framework.ExpectHaveKeyWithValue(qos, "limit", strconv.Itoa(limit))
framework.ExpectHaveKeyWithValue(qos, "loss", strconv.Itoa(loss))

ginkgo.By("Deleting pod " + name)
podClient.DeleteSync(pod.Name)
})

framework.ConformanceIt("should support htb QoS", func() {
f.SkipVersionPriorTo(1, 9, "Support for htb QoS with priority was introduced in v1.9")

name := "pod-" + framework.RandomSuffix()
ginkgo.By("Creating pod " + name)
ginkgo.By("Creating pod " + podName)
ingressRate := 300
annotations := map[string]string{
util.IngressRateAnnotation: strconv.Itoa(ingressRate),
}
pod := framework.MakePod(namespaceName, name, nil, annotations, "", nil, nil)
pod := framework.MakePod(namespaceName, podName, nil, annotations, "", nil, nil)
pod = podClient.CreateSync(pod)

ginkgo.By("Validating pod annotations")
Expand All @@ -201,8 +189,5 @@ var _ = framework.Describe("[group:qos]", func() {
ginkgo.By("Validating OVS Queue")
queue := getOvsQosForPod(f, "queue", pod)
framework.ExpectHaveKeyWithValue(queue, "max-rate", strconv.Itoa(ingressRate*1000*1000))

ginkgo.By("Deleting pod " + name)
podClient.DeleteSync(pod.Name)
})
})