|
| 1 | +name: E2E |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + k8s_version: |
| 6 | + description: 'Kubernetes branch or tag to test against' |
| 7 | + required: false |
| 8 | + default: 'master' |
| 9 | + type: string |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + node-e2e-k8s: |
| 15 | + name: Kubernetes Node |
| 16 | + runs-on: ubuntu-24.04 |
| 17 | + timeout-minutes: 90 |
| 18 | + steps: |
| 19 | + - name: Checkout containerd |
| 20 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 21 | + with: |
| 22 | + path: src/github.com/containerd/containerd |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Checkout Kubernetes |
| 26 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 27 | + with: |
| 28 | + repository: kubernetes/kubernetes |
| 29 | + path: src/k8s.io/kubernetes |
| 30 | + ref: ${{ inputs.k8s_version }} |
| 31 | + |
| 32 | + - name: Install Go |
| 33 | + uses: ./src/github.com/containerd/containerd/.github/actions/install-go |
| 34 | + |
| 35 | + - name: Set Up Environment |
| 36 | + run: | |
| 37 | + set -e -x |
| 38 | + # Disable swap to allow kubelet to start. |
| 39 | + sudo swapoff -a |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install -y gperf build-essential pkg-config |
| 42 | + echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV |
| 43 | + echo "${{ github.workspace }}/bin" >> $GITHUB_PATH |
| 44 | +
|
| 45 | + - name: Build and Install containerd |
| 46 | + working-directory: ./src/github.com/containerd/containerd |
| 47 | + run: | |
| 48 | + set -e -x |
| 49 | + script/setup/install-seccomp |
| 50 | + script/setup/install-runc |
| 51 | + script/setup/install-cni |
| 52 | + make binaries GO_BUILD_FLAGS="-mod=vendor" |
| 53 | + sudo make install |
| 54 | +
|
| 55 | + - name: Configure and Start containerd |
| 56 | + run: | |
| 57 | + set -e -x |
| 58 | + # Stop and disable pre-existing containerd service to ensure a clean state. |
| 59 | + if sudo systemctl is-active --quiet containerd; then |
| 60 | + sudo systemctl stop containerd |
| 61 | + fi |
| 62 | + if sudo systemctl is-enabled --quiet containerd; then |
| 63 | + sudo systemctl disable containerd |
| 64 | + fi |
| 65 | +
|
| 66 | + sudo mkdir -p /etc/containerd |
| 67 | + sudo tee /etc/containerd/config.toml > /dev/null <<EOF |
| 68 | + version = 2 |
| 69 | + required_plugins = ["io.containerd.grpc.v1.cri"] |
| 70 | + [plugins."io.containerd.grpc.v1.cri".containerd] |
| 71 | + default_runtime_name = "runc" |
| 72 | + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] |
| 73 | + runtime_type = "io.containerd.runc.v2" |
| 74 | + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] |
| 75 | + # Ensure containerd uses the runc binary installed from source. |
| 76 | + BinaryName = "/usr/local/sbin/runc" |
| 77 | + SystemdCgroup = true |
| 78 | + # Required for certain node e2e tests. |
| 79 | + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.test-handler] |
| 80 | + runtime_type = "io.containerd.runc.v2" |
| 81 | + [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.test-handler.options] |
| 82 | + # Ensure containerd uses the runc binary installed from source. |
| 83 | + BinaryName = "/usr/local/sbin/runc" |
| 84 | + SystemdCgroup = true |
| 85 | + EOF |
| 86 | +
|
| 87 | + sudo cp ./src/github.com/containerd/containerd/containerd.service /etc/systemd/system/ |
| 88 | + sudo systemctl daemon-reload |
| 89 | + sudo systemctl start containerd |
| 90 | +
|
| 91 | + # Wait and verify the daemon is ready. |
| 92 | + sleep 5 |
| 93 | + sudo ctr version |
| 94 | +
|
| 95 | + - name: Run Node E2E Tests |
| 96 | + working-directory: ./src/k8s.io/kubernetes |
| 97 | + run: | |
| 98 | + # TODO: Remove "ResourceMetrics" feature skip once containerd supports ListMetricDescriptors: |
| 99 | + # https://github.com/kubernetes/kubernetes/blob/v1.33.2/test/e2e_node/resource_metrics_test.go#L67-L71 |
| 100 | + sudo make test-e2e-node \ |
| 101 | + FOCUS='\[NodeConformance\]|\[Feature:.+\]|\[Feature\]' \ |
| 102 | + SKIP='\[Flaky\]|\[Slow\]|\[Serial\]|\[Feature:UserNamespacesSupport\]|\[Feature:PodLifecycleSleepActionAllowZero\]|\[Feature:UserNamespacesPodSecurityStandards\]|\[Feature:KubeletCredentialProviders\]|\[Feature:LockContention\]|\[Feature:SCTPConnectivity\]|\[Feature:ResourceMetrics\]|\[Feature:RelaxedEnvironmentVariableValidation\]|\[Alpha\]|should be able to pull from private registry with secret|should be able to pull from private registry with credential provider' \ |
| 103 | + TEST_ARGS='--kubelet-flags="--cgroup-driver=systemd --cgroups-per-qos=true --cgroup-root=/ --runtime-cgroups=/system.slice/containerd.service"' |
| 104 | +
|
| 105 | + - name: Collect Logs on Failure |
| 106 | + if: failure() |
| 107 | + run: | |
| 108 | + ARTIFACT_DIR=./_artifacts |
| 109 | + mkdir -p ${ARTIFACT_DIR} |
| 110 | + KUBELET_LOG_SRC=$(sudo find /tmp/_artifacts -name "kubelet.log" | head -n 1) |
| 111 | + if [ -f "$KUBELET_LOG_SRC" ]; then |
| 112 | + sudo cp "$KUBELET_LOG_SRC" "${ARTIFACT_DIR}/kubelet.log" |
| 113 | + else |
| 114 | + echo "Kubelet log file not found." > "${ARTIFACT_DIR}/kubelet.log" |
| 115 | + fi |
| 116 | + sudo journalctl -u containerd --no-pager > "${ARTIFACT_DIR}/containerd.log" |
| 117 | +
|
| 118 | + - name: Upload Log Artifacts |
| 119 | + if: failure() |
| 120 | + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 121 | + with: |
| 122 | + name: e2e-logs |
| 123 | + path: ./_artifacts/ |
0 commit comments