From 82302ccab0fbba8bfceab64da34594777da458fd Mon Sep 17 00:00:00 2001 From: Tomofumi Hayashi Date: Fri, 19 Apr 2024 04:10:45 +0900 Subject: [PATCH] Update e2e tests (replace j2cli with gomplate) --- .github/workflows/kind-e2e.yml | 7 +------ e2e/generate_yamls.sh | 2 +- e2e/get_tools.sh | 2 ++ e2e/templates/default-route1.yml.j2 | 2 +- e2e/templates/multus-daemonset-thick.yml.j2 | 13 ++++++++++--- e2e/templates/multus-daemonset.yml.j2 | 2 +- e2e/templates/simple-macvlan1.yml.j2 | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/kind-e2e.yml b/.github/workflows/kind-e2e.yml index 72539edda..8d78d115d 100644 --- a/.github/workflows/kind-e2e.yml +++ b/.github/workflows/kind-e2e.yml @@ -43,11 +43,6 @@ jobs: with: python-version: 3.x - - name: Setup j2cli - run: | - sudo apt-get install -y j2cli - echo $(j2 --version) - - name: Build latest-amd64 uses: docker/build-push-action@v5 with: @@ -63,7 +58,7 @@ jobs: - name: generate yaml files working-directory: ./e2e - run: env CNI_VERSION=${{ matrix.cni-version }} ./generate_yamls.sh + run: env CNI_VERSION=${{ matrix.cni-version }} PATH=${PATH}:./bin ./generate_yamls.sh - name: Setup cluster working-directory: ./e2e diff --git a/e2e/generate_yamls.sh b/e2e/generate_yamls.sh index e237cc4ab..e0ab56514 100755 --- a/e2e/generate_yamls.sh +++ b/e2e/generate_yamls.sh @@ -12,6 +12,6 @@ templates_dir="$(dirname $(readlink -f $0))/templates" # generate yaml files based on templates/*.j2 to yamls directory for i in `ls templates/`; do echo $i - j2 -e CNI_VERSION ${templates_dir}/$i -o yamls/${i%.j2} + gomplate -o yamls/${i%.j2} -f ${templates_dir}/$i done unset CNI_VERSION diff --git a/e2e/get_tools.sh b/e2e/get_tools.sh index fbc5b4057..77faaf2c5 100755 --- a/e2e/get_tools.sh +++ b/e2e/get_tools.sh @@ -13,3 +13,5 @@ curl -Lo ./bin/koko https://github.com/redhat-nfvpe/koko/releases/download/v0.83 chmod +x ./bin/koko curl -Lo ./bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 chmod +x ./bin/jq +curl -Lo ./bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.11.7/gomplate_linux-amd64-slim +chmod +x ./bin/gomplate diff --git a/e2e/templates/default-route1.yml.j2 b/e2e/templates/default-route1.yml.j2 index 8d58cdeab..e1155229b 100644 --- a/e2e/templates/default-route1.yml.j2 +++ b/e2e/templates/default-route1.yml.j2 @@ -5,7 +5,7 @@ metadata: name: default-route-config spec: config: '{ - "cniVersion": "{{ CNI_VERSION }}", + "cniVersion": "{{ .Env.CNI_VERSION }}", "plugins": [ { "type": "macvlan", diff --git a/e2e/templates/multus-daemonset-thick.yml.j2 b/e2e/templates/multus-daemonset-thick.yml.j2 index 035304188..67ec770e6 100644 --- a/e2e/templates/multus-daemonset-thick.yml.j2 +++ b/e2e/templates/multus-daemonset-thick.yml.j2 @@ -86,14 +86,15 @@ metadata: data: daemon-config.json: | { + "chrootDir": "/hostroot", "confDir": "/host/etc/cni/net.d", "logToStderr": true, "logLevel": "debug", "logFile": "/tmp/multus.log", - "binDir": "/host/opt/cni/bin", + "binDir": "/opt/cni/bin", "cniDir": "/var/lib/cni/multus", "socketDir": "/host/run/multus", - "cniVersion": "{{ CNI_VERSION }}", + "cniVersion": "{{ .Env.CNI_VERSION }}", "cniConfigDir": "/host/etc/cni/net.d", "multusConfigFile": "auto", "forceCNIVersion": true, @@ -147,7 +148,7 @@ spec: - name: cni mountPath: /host/etc/cni/net.d - name: cnibin - mountPath: /host/opt/cni/bin + mountPath: /opt/cni/bin - name: host-run mountPath: /host/run - name: host-var-lib-cni-multus @@ -158,6 +159,9 @@ spec: - name: multus-daemon-config mountPath: /etc/cni/net.d/multus.d readOnly: true + - name: hostroot + mountPath: /hostroot + mountPropagation: HostToContainer env: - name: MULTUS_NODE_NAME valueFrom: @@ -187,6 +191,9 @@ spec: - name: cnibin hostPath: path: /opt/cni/bin + - name: hostroot + hostPath: + path: / - name: multus-daemon-config configMap: name: multus-daemon-config diff --git a/e2e/templates/multus-daemonset.yml.j2 b/e2e/templates/multus-daemonset.yml.j2 index 08cac28d1..b31abece0 100644 --- a/e2e/templates/multus-daemonset.yml.j2 +++ b/e2e/templates/multus-daemonset.yml.j2 @@ -149,7 +149,7 @@ spec: args: - "--multus-conf-file=auto" - "--force-cni-version=true" - - "--cni-version={{ CNI_VERSION }}" + - "--cni-version={{ .Env.CNI_VERSION }}" resources: requests: cpu: "100m" diff --git a/e2e/templates/simple-macvlan1.yml.j2 b/e2e/templates/simple-macvlan1.yml.j2 index 7d31dcdbc..a9f71ae9d 100644 --- a/e2e/templates/simple-macvlan1.yml.j2 +++ b/e2e/templates/simple-macvlan1.yml.j2 @@ -5,7 +5,7 @@ metadata: name: macvlan1-config spec: config: '{ - "cniVersion": "{{ CNI_VERSION }}", + "cniVersion": "{{ .Env.CNI_VERSION }}", "plugins": [ { "type": "macvlan",