From d69e71b16e622d806da49a23e132d1ea32ecfdc0 Mon Sep 17 00:00:00 2001 From: John O'Loughlin Date: Fri, 5 Jan 2024 14:17:56 +0000 Subject: [PATCH] ci to test make some commands Signed-off-by: John O'Loughlin --- .github/workflows/e2e.yml | 2 ++ .github/workflows/weekly_e2e.yml | 4 ++++ ci/ci.sh | 14 ++++++++++++-- ci/vpp_test_setup/vpp_host.sh | 30 ------------------------------ kubernetes/userspace-daemonset.yml | 10 ++++++++++ 5 files changed, 28 insertions(+), 32 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e3c3bdac..0720ed78 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -30,6 +30,8 @@ jobs: run: source ./ci/ci.sh && create_kind_cluster - name: deploy_multus run: source ./ci/ci.sh && deploy_multus + - name: deploy_userspacecni + run: source ./ci/ci.sh && deploy_userspace - name: vpp_e2e_test run: source ./ci/ci.sh && vpp_e2e_test - name: build_ovs_container diff --git a/.github/workflows/weekly_e2e.yml b/.github/workflows/weekly_e2e.yml index 090fa3ee..c281c035 100644 --- a/.github/workflows/weekly_e2e.yml +++ b/.github/workflows/weekly_e2e.yml @@ -37,6 +37,8 @@ jobs: run: source ./ci/ci.sh && create_kind_cluster - name: deploy_multus run: source ./ci/ci.sh && deploy_multus + - name: deploy_userspacecni + run: source ./ci/ci.sh && deploy_userspace - name: vpp_e2e_test run: source ./ci/ci.sh && vpp_e2e_test @@ -63,6 +65,8 @@ jobs: run: source ./ci/ci.sh && create_kind_cluster -v ${{ matrix.kubernetes_version }} - name: deploy_multus run: source ./ci/ci.sh && deploy_multus + - name: deploy_userspacecni + run: source ./ci/ci.sh && deploy_userspace - name: vpp_e2e_test run: source ./ci/ci.sh && vpp_e2e_test - name: build_ovs_container diff --git a/ci/ci.sh b/ci/ci.sh index fda2ebe9..e38bcdf5 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -45,10 +45,10 @@ kubectl get all --all-namespaces sleep 10 cd $USERSPACEDIR -docker build . -f ./docker/userspacecni/Dockerfile -t userspacecni:latest +make build # gets path for one directopry above, needed for mkdir with docker cp below mkdir_var=$(dirname ${USERSPACEDIR}) -kind load docker-image userspacecni +kind load docker-image localhost:5000/userspacecni docker exec -i kind-control-plane bash -c "mkdir -p $mkdir_var" docker cp "${USERSPACEDIR}" "kind-control-plane:${USERSPACEDIR}" } @@ -62,6 +62,15 @@ sed -i "s/snapshot-thick/v4.0.2/g" multus-daemonset.yml kubectl apply -f ./multus-daemonset.yml } +deploy_userspace(){ +cd $USERSPACEDIR +#kubectl label nodes kind-control-plane app=userspace-cni +kubectl label nodes --all app=userspace-cni +make deploy +echo "sleeping for 20 to allow userspace to deploy first" +sleep 20 +} + vpp_e2e_test(){ cd $CI_DIR/vpp_test_setup/ echo "Setting up vpp host" @@ -161,6 +170,7 @@ run_all(){ install_go_kubectl_kind create_kind_cluster -v v1.27.3 deploy_multus +deploy_userspace vpp_e2e_test build_ovs_container build_testpmd_container diff --git a/ci/vpp_test_setup/vpp_host.sh b/ci/vpp_test_setup/vpp_host.sh index 656864a8..245b9afd 100755 --- a/ci/vpp_test_setup/vpp_host.sh +++ b/ci/vpp_test_setup/vpp_host.sh @@ -9,38 +9,8 @@ kubectl create -n vpp configmap vpp-startup-config --from-file="${USERSPACEDIR}/ worker="kind-control-plane" - -rm /opt/cni/bin/userspace docker exec -i kind-control-plane bash -c "mkdir -p /var/run/vpp/app" -cat << EOF | kubectl apply -f - ---- -apiVersion: v1 -kind: Pod -metadata: - name: userspacecni-$worker - namespace: vpp -spec: - nodeSelector: - kubernetes.io/hostname: $worker - containers: - - name: userspacecni-$worker - image: userspacecni:latest - imagePullPolicy: IfNotPresent - volumeMounts: - - name: cni - mountPath: /opt/cni/bin - volumes: - - name: cni - hostPath: - path: /opt/cni/bin - restartPolicy: Never -EOF - - -echo "sleeping for 20 to allow userspace to deploy first" -sleep 20 - cat << EOF | kubectl apply -f - --- apiVersion: v1 diff --git a/kubernetes/userspace-daemonset.yml b/kubernetes/userspace-daemonset.yml index be6ea98e..a1b053e1 100644 --- a/kubernetes/userspace-daemonset.yml +++ b/kubernetes/userspace-daemonset.yml @@ -17,6 +17,16 @@ spec: - name: userspace-cni-plugin image: localhost:5000/userspacecni #registory:imagename imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + privileged: false + resources: + requests: + cpu: 1m + memory: 1Mi + limits: + cpu: 100m + memory: 30Mi volumeMounts: - name: cnibin mountPath: /opt/cni/bin