← Back to Pull requests

test(e2e): add a GPU-less kind smoke test for chart, webhook, libsync #33

Closed
unknown closed this pull request without merging on Sep 28, 2026 03:52 UTC
View on GitHub
unknown unknown commented on Sep 26, 2026 14:06 UTC
Author

What type of PR is this?
Test. Adds a self-contained smoke test; no chart, image or API change.

What this PR does / why we need it:
Adds hack/e2e/Dockerfile and hack/e2e/kind-smoke.sh, a GPU-less smoke test that installs this chart into a throwaway kind cluster and asserts on a real API server that the libsync DaemonSet is Ready and has placed a non-empty libvgpu.so plus a matching ld.so.preload in /usr/local/vgpu on the node, that the kai-resource-isolator-mutating webhook injects the three volumes, the three mounts and POD_UID / CONTAINER_NAME / CONTAINER_VGPU_MOUNT into a gpu-fraction: "0.5" pod and that the injected /etc/ld.so.preload is loaded into the process, that this pod running as uid 1000 can create its own cache directory $CONTAINER_VGPU_MOUNT/containers/${POD_UID}_${CONTAINER_NAME}, and that pods with no annotations and pods with kai-resource-isolator.io/inject: "false" are not mutated.

The test image builds /webhook and /monitor from the repository Go sources, mirroring the go-builder stage of docker/Dockerfile, and takes /artifacts/libvgpu.so from the published multi-arch docker.io/projecthami/kai-resource-isolator:v1.1.0 via COPY --from, so no CUDA toolchain is needed on the test host.

Why now: nothing tests this chart and the one place that installs it cannot run in CI. KAI PR #2033 deploys the chart in its hamicore e2e, but its author calls that e2e "intentionally not wired into CI for now" because it runs against a fake GPU operator, and KAI maintainer davidLif declined to test HAMi metrics there. The non-root cache-directory bug behind the stale-closed PR #22 is still on main, and this test fails on it.

Which issue(s) this PR fixes:
Fixes #29

Special notes for your reviewer:
From the repository root, nothing installed on the host beyond docker/kind/kubectl/helm:

export KUBECONFIG=/tmp/kri-pr05.kubeconfig
KIND_CLUSTER=kri-pr05 IMAGE=kai-resource-isolator:e2e-pr05 CHART_DIR=$PWD/chart/kai-resource-isolator hack/e2e/kind-smoke.sh

Environment knobs: KIND_CLUSTER (default kri-smoke), KEEP_CLUSTER (1 leaves the cluster), IMAGE, CHART_DIR (default <repo>/chart/kai-resource-isolator), RELEASE and NAMESPACE (default kai-resource-isolator), HELM_EXTRA_ARGS (word-split, appended to helm upgrade --install), TIMEOUT (default 180s), EXPECT_NONROOT_WRITE (0 reports the non-root mkdir check as XFAIL instead of FAIL, for a baseline run against a chart without the fix). IMAGE is optional: when unset the script builds kai-resource-isolator:e2e from hack/e2e/Dockerfile and kind loads it. The cluster is deleted on exit unless KEEP_CLUSTER=1, and one that already existed when the script started is never deleted.

Measured on macOS 26.4.1 arm64, Docker Desktop 29.4.2, kind v0.32.0, Kubernetes v1.36.1, kubectl client v1.33.9, helm v4.2.3, no GPU:

  • Current main chart, EXPECT_NONROOT_WRITE=1: 17 checks PASS, exactly 1 FAIL (the non-root mkdir), exit 1. The default is deliberately 1 so an unfixed chart is red, not a flaky test.

  • Current main chart, EXPECT_NONROOT_WRITE=0, fresh single-node kind cluster where nothing was pre-created, so the 755 root:root state was the script's own: 17 PASS, XFAIL c4, exit 0.

  • Same chart with the libsync fix applied (the mkdir -p plus chmod 1777 pair for ${DST}/containers and the host /tmp/vgpulock) on a scratch copy of the chart, not on this branch: all 18 checks PASS, 0 FAIL, exit 0, with the host /usr/local/vgpu/containers at 755 root:root before that fixed release and 1777 after.
  • Every chart version from before the libsync fix is expected to fail check c4, since the uid 1000 process cannot create its cache directory while the host directory is 755 root:root; the script header says so. Check c4 covers only the containers directory, not the /tmp/vgpulock half. The reuse-an-existing-cluster path and the in-place helm upgrade were exercised separately, shellcheck 0.11.0 (koalaman/shellcheck:stable, --severity=style) is clean, and a run takes 49 to 51 s creating the kind node or 36 s reusing one, with the image build cached at ~2 s.

    Findings worth calling out:

  • The preloaded pod does not crash without a GPU. sleep infinity under /etc/ld.so.preload -> /usr/local/vgpu/libvgpu.so stays Running with restarts=0, the library is mapped in /proc/1/maps and kubectl exec works, which is what makes a GPU-less test possible at all; checks c1 and c3 keep proving it.

  • The monitor DaemonSet is deliberately not covered: it needs NVML and a real GPU.

  • This PR adds no Makefile target, no workflow and no docs changes, and does not wire the script into GitHub Actions: that needs a runner with room for a kind node and is a separate proposal.
  • Related: KAI PR #2033, KAI issue #1821, this repo's PR #22.

    Does this PR introduce a user-facing change?:
    No. It adds test files only. No chart, image, default or API change.

    AI Disclosure:
    AI assistance was used to review repository context and help draft this change and its description. All changes were manually reviewed, verified locally, and submitted by the author.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: archlitchi Review duration: 2266m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #33"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%