|
| 1 | +name: Kind TFT |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +jobs: |
| 10 | + kind-tft: |
| 11 | + strategy: |
| 12 | + # Keep every scenario running to completion so we can collect artifacts |
| 13 | + # from each leg independently when one fails. |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - scenario: full-suite |
| 18 | + dpu_sim_config: config-kind.yaml |
| 19 | + - scenario: diverse-subset |
| 20 | + dpu_sim_config: config-kind.yaml |
| 21 | + - scenario: resource-limits |
| 22 | + dpu_sim_config: config-kind.yaml |
| 23 | + - scenario: dpu-offload |
| 24 | + dpu_sim_config: config-kind-ovnk-offload.yaml |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 180 |
| 27 | + # Job-level concurrency so matrix.scenario is in scope; workflow-level |
| 28 | + # concurrency cannot reference matrix.* expressions. |
| 29 | + concurrency: |
| 30 | + group: kind-tft-${{ matrix.scenario }}-${{ github.ref }} |
| 31 | + cancel-in-progress: true |
| 32 | + steps: |
| 33 | + - name: Checkout ovn-k8s-traffic-flow-tests |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Checkout dpu-simulator |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + repository: ovn-kubernetes/dpu-simulator |
| 40 | + ref: main |
| 41 | + path: dpu-simulator |
| 42 | + |
| 43 | + - name: Checkout OVN-Kubernetes (master) |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + repository: ovn-org/ovn-kubernetes |
| 47 | + ref: master |
| 48 | + path: dpu-simulator/ovn-kubernetes |
| 49 | + |
| 50 | + - name: Set up Go |
| 51 | + uses: actions/setup-go@v5 |
| 52 | + with: |
| 53 | + go-version-file: dpu-simulator/go.mod |
| 54 | + cache: true |
| 55 | + |
| 56 | + - name: Install libvirt development headers |
| 57 | + run: sudo apt-get update && sudo apt-get install -y libvirt-dev |
| 58 | + |
| 59 | + - name: Install Helm |
| 60 | + uses: azure/setup-helm@v4 |
| 61 | + |
| 62 | + - name: Set up Python for traffic flow tests |
| 63 | + uses: actions/setup-python@v5 |
| 64 | + with: |
| 65 | + python-version: "3.12" |
| 66 | + |
| 67 | + - name: Install kind |
| 68 | + run: | |
| 69 | + KIND_VERSION=v0.31.0 |
| 70 | + curl -fsSLo /tmp/kind-linux-amd64 "https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64" |
| 71 | + curl -fsSLo /tmp/kind-linux-amd64.sha256sum "https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64.sha256sum" |
| 72 | + (cd /tmp && sha256sum -c kind-linux-amd64.sha256sum) |
| 73 | + chmod +x /tmp/kind-linux-amd64 |
| 74 | + sudo mv /tmp/kind-linux-amd64 /usr/local/bin/kind |
| 75 | +
|
| 76 | + - name: Build dpu-sim |
| 77 | + working-directory: dpu-simulator |
| 78 | + run: make build |
| 79 | + |
| 80 | + - name: Disable containerd image store |
| 81 | + # Workaround for https://github.com/kubernetes-sigs/kind/issues/3795 |
| 82 | + run: | |
| 83 | + sudo mkdir -p /etc/docker |
| 84 | + [ -s "/etc/docker/daemon.json" ] && { |
| 85 | + cat "/etc/docker/daemon.json" | jq '. + {"features":{"containerd-snapshotter": false}}' | sudo tee /etc/docker/daemon.$$ |
| 86 | + } || { |
| 87 | + echo '{"features":{"containerd-snapshotter": false}}' | sudo tee /etc/docker/daemon.$$ |
| 88 | + } |
| 89 | + sudo mv -f /etc/docker/daemon.$$ /etc/docker/daemon.json |
| 90 | + sudo systemctl restart docker |
| 91 | +
|
| 92 | + - name: Deploy KIND cluster |
| 93 | + working-directory: dpu-simulator |
| 94 | + run: ./bin/dpu-sim --config ${{ matrix.dpu_sim_config }} |
| 95 | + |
| 96 | + - name: Verify clusters are ready |
| 97 | + working-directory: dpu-simulator |
| 98 | + run: | |
| 99 | + kubectl wait --for=condition=Ready nodes --all \ |
| 100 | + --kubeconfig kubeconfig/dpu-sim-host.kubeconfig --timeout=25m |
| 101 | + kubectl wait --for=condition=Ready nodes --all \ |
| 102 | + --kubeconfig kubeconfig/dpu-sim-dpu.kubeconfig --timeout=25m |
| 103 | +
|
| 104 | + - name: TFT Python venv |
| 105 | + working-directory: dpu-simulator |
| 106 | + run: ./bin/dpu-sim tft venv --config ${{ matrix.dpu_sim_config }} --tft-repo-path "$GITHUB_WORKSPACE" |
| 107 | + |
| 108 | + - name: Run traffic flow tests |
| 109 | + working-directory: dpu-simulator |
| 110 | + env: |
| 111 | + TFT_KUBECONFIG: ${{ github.workspace }}/dpu-simulator/kubeconfig/dpu-sim-host.kubeconfig |
| 112 | + run: | |
| 113 | + ./bin/dpu-sim tft run \ |
| 114 | + --config ${{ matrix.dpu_sim_config }} \ |
| 115 | + --tft-repo-path "$GITHUB_WORKSPACE" \ |
| 116 | + --tft-config "$GITHUB_WORKSPACE/.github/tft-configs/${{ matrix.scenario }}.yaml" \ |
| 117 | + --check |
| 118 | +
|
| 119 | + - name: Export kind logs on failure |
| 120 | + if: failure() |
| 121 | + run: | |
| 122 | + kind export logs /tmp/kind-tft-logs --name dpu-sim-host 2>/dev/null || true |
| 123 | + kind export logs /tmp/kind-tft-logs --name dpu-sim-dpu 2>/dev/null || true |
| 124 | +
|
| 125 | + - name: Upload kind logs on failure |
| 126 | + if: failure() |
| 127 | + uses: actions/upload-artifact@v4 |
| 128 | + with: |
| 129 | + name: kind-tft-${{ matrix.scenario }}-kind-logs |
| 130 | + path: /tmp/kind-tft-logs |
| 131 | + if-no-files-found: ignore |
| 132 | + |
| 133 | + - name: Upload TFT results on failure |
| 134 | + if: failure() |
| 135 | + uses: actions/upload-artifact@v4 |
| 136 | + with: |
| 137 | + name: kind-tft-${{ matrix.scenario }}-ft-logs |
| 138 | + path: ft-logs |
| 139 | + if-no-files-found: ignore |
| 140 | + |
| 141 | + - name: Cleanup |
| 142 | + if: always() |
| 143 | + working-directory: dpu-simulator |
| 144 | + run: ./bin/dpu-sim --config ${{ matrix.dpu_sim_config }} --cleanup || true |
0 commit comments