@@ -25,7 +25,8 @@ e2e/rust/tests/odh/
2525│ ├── image_provenance.rs # sandbox/gateway/supervisor image registry + pull-policy check
2626│ └── sandbox.rs # sandbox create/exec/delete + supervisor presence check
2727├── tier1/ # Tier 1: high-priority tests, excluding Smoke
28- │ └── mod.rs # empty — no scenarios yet
28+ │ ├── mod.rs
29+ │ └── selinux.rs # combined/sidecar process-supervisor SELinux label
2930├── tier2/ # Tier 2: medium/low priority positive tests
3031│ └── mod.rs # empty — no scenarios yet
3132├── tier3/ # Tier 3: negative and destructive tests
@@ -56,9 +57,12 @@ plain module is enough — no new crate and no workspace change.
5657 when it is set, so every ODH test targets the same cluster the upstream
5758 harness does. ` oc_json() ` runs a query and parses ` -o json ` output, panicking
5859 with a descriptive message on any failure.
60+ - ` odh_harness::selinux::SelinuxAudit ` — an opt-in scenario guard that detects
61+ OpenShift, requires every Ready worker to report ` Enforcing ` , records
62+ node-local audit cutoffs, and rejects OpenShell AVCs on completion.
5963
60- Put ODH-specific shared helpers here (the ` oc ` builder, and future node-level
61- checks such as ` getenforce ` and the AVC-audit guard ), and reuse them rather than
64+ Put ODH-specific shared helpers here (the ` oc ` builder and node-level SELinux
65+ checks), and reuse them rather than
6266duplicating logic across tier files. Two rules keep this rebase-safe:
6367
6468- ** Do not** add ODH helpers to the upstream harness library
@@ -90,14 +94,11 @@ The upstream test assignments in `tiers.toml` are currently placeholders —
9094they should be revisited based on measured execution time and actual test
9195criticality, not just copied as-is.
9296
93- ** Current implementation status:** only the Smoke tier has real test
94- functions (` smoke::gateway::test_reachable ` , ` smoke::sandbox::test_create_delete ` ,
95- ` smoke::image_provenance::test_sandbox_gateway_supervisor_images ` ).
96- Tier 1–3 are empty modules with no scenarios yet — running those tiers today
97- executes 0 ODH tests (a legitimate ` ok ` result, not a failure) plus whatever
98- upstream tests are mapped to them, plus the image provenance test (see
99- below). Add scenarios by creating a ` .rs ` file under the tier's directory and
100- declaring it with a ` mod ` line in that tier's ` mod.rs ` .
97+ Smoke covers gateway reachability, sandbox lifecycle, and image provenance.
98+ Tier 1 checks the process-supervisor SELinux label. Tier 2 and Tier 3 have no
99+ ODH scenarios yet; they run their mapped upstream tests and the image
100+ provenance check. Add scenarios by creating a ` .rs ` file under the tier's
101+ directory and declaring it with a ` mod ` line in that tier's ` mod.rs ` .
101102
102103## Prerequisites
103104
@@ -165,6 +166,25 @@ defaults (`openshell`/`openshell`). The Helm chart's
165166defaults to ` "" ` , i.e. Kubernetes' own default of ` Always ` for the
166167` :latest ` -tagged sandbox image) — see below.
167168
169+ ### SELinux-enforcing OCP validation
170+
171+ Tier 1 includes the SELinux checks when it runs against an OpenShift cluster.
172+ The tests expect an already-deployed, working gateway. The named preflight
173+ checks ` getenforce ` on every Ready worker. Each audited SELinux scenario uses
174+ ` SelinuxAudit ` , which self-skips outside OpenShift, records node-local cutoffs,
175+ and queries ` ausearch -m AVC -x ` through ` oc debug node … chroot /host ` after
176+ the scenario.
177+ The audit covers the gateway and both supervisor executable paths, and the
178+ supervisor test checks the stable ` container_t ` type without hard-coding pod
179+ MCS categories.
180+
181+ The runner requires permission to create debug pods and access the host through
182+ ` chroot /host ` . Deployment-specific Helm values and proxy fixtures are owned by
183+ the environment that deploys the gateway; tier1 does not create them. The
184+ custom egress control is intentionally outside SELinux scope; egress behavior
185+ remains covered by the existing proxy tests, and this tier does not create a
186+ SELinux-specific proxy fixture.
187+
168188### Why ` e2e:odh ` / ` e2e:odh:full ` run more than you might expect
169189
170190` e2e-odh ` is defined as ` e2e-odh = ["e2e-kubernetes"] ` in ` Cargo.toml ` , so it
@@ -194,7 +214,7 @@ already covers it.
194214` smoke::image_provenance::test_sandbox_gateway_supervisor_images ` creates a
195215sandbox, then verifies that its image, the gateway's image, and the
196216supervisor image (read from the rendered gateway config, since the
197- supervisor never runs as its own pod) all came from an authorized downstream
217+ supervisor never runs as its own pod) all came from an authorized
198218registry, and that no container — including ephemeral containers — has
199219regressed away from ` imagePullPolicy: IfNotPresent ` .
200220
@@ -208,33 +228,32 @@ ALLOWED_IMAGE_REGISTRY_PREFIXES="quay.io/opendatahub/,ghcr.io/nvidia/openshell-c
208228 must end in ` / ` ) — no default, since an empty list would silently approve
209229 any image. This should include every registry prefix your deployment
210230 legitimately pulls from:
211- - ` quay .io/opendatahub/ ` — confirmed in practice for this project's
212- gateway/ supervisor/ CLI builds .
231+ - ` ghcr .io/nvidia/openshell/ ` — the standard upstream gateway,
232+ supervisor, and CLI image prefix .
213233 - ` ghcr.io/nvidia/openshell-community/sandboxes/ ` — the sandbox default
214234 image (` server.sandboxImage ` in the Helm chart). There is no
215235 downstream-built sandbox base image yet (only ` gateway ` , ` supervisor ` ,
216236 and ` cli ` have Tekton pipelines under ` .tekton/ ` ), so this upstream
217237 prefix has to stay allowed until one exists. This is a different path
218- than the upstream gateway/CLI images
219- (` ghcr.io/nvidia/openshell/* ` ), which this check is meant to reject.
238+ alongside the upstream gateway and CLI images.
220239
221240 A prefix without a trailing ` / ` is rejected outright, since it could
222241 otherwise match a lookalike host (e.g. ` registry.redhat.io ` would also
223242 match ` registry.redhat.io.attacker.example/image ` ).
224243- ` NAMESPACE ` /` RELEASE ` env vars default to ` openshell ` /` openshell ` .
225244- The check is a registry-prefix allowlist, not an exact image/digest match.
226- It works because the downstream pipeline only ever publishes to one
227- registry — matching that prefix is sufficient proof an image (including
228- the supervisor) is the downstream build and not an upstream
229- ` ghcr.io/nvidia/openshell/* ` reference.
245+ The allowlist is explicit about both the upstream gateway images and the
246+ upstream sandbox image.
230247- The ` imagePullPolicy: IfNotPresent ` check applies to every container,
231248 including the sandbox pod's. The Helm chart's ` server.sandboxImagePullPolicy `
232249 defaults to ` "" ` (Kubernetes' own default, which is ` Always ` for a
233250 ` :latest ` -tagged image like the default sandbox image) — deployments must
234251 set it explicitly, e.g. ` --set server.sandboxImagePullPolicy=IfNotPresent ` ,
235252 or this check fails on a freshly installed chart.
236253- Requires the ` oc ` CLI in PATH with a kubeconfig targeting the cluster (same
237- as the rest of this suite).
254+ as the rest of this suite). When ` OPENSHELL_E2E_KUBE_CONTEXT_ACTIVE ` is set,
255+ all provenance queries use that context; otherwise they use the kubeconfig's
256+ current context.
238257- Skip it locally with ` SKIP_IMAGE_PROVENANCE=1 mise run e2e:odh:tier1 ` (e.g.
239258 if ` oc ` isn't configured for the target cluster in your current shell) —
240259 this only affects the tiered tasks' extra step; ` e2e:odh ` /` e2e:odh:full ` /
0 commit comments