Skip to content

Commit d3cf910

Browse files
committed
test: use chainsaw for network policy smoke
Signed-off-by: Matt Kornfield <mkornfield@nvidia.com>
1 parent 9971e59 commit d3cf910

15 files changed

Lines changed: 468 additions & 201 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -620,20 +620,27 @@ jobs:
620620
shell: bash
621621
env:
622622
NAMESPACE: nemo-platform
623+
CHAINSAW_REPORT_FORMAT: XML
624+
CHAINSAW_REPORT_NAME: report-network-policy-smoke
625+
CHAINSAW_REPORT_PATH: .
623626
run: |
624627
if e2e/k8s/scripts/test_network_policies.sh; then
625-
printf '<testsuite name="network-policy-smoke" tests="1" failures="0"/>%s' $'\n' > report-network-policy-smoke.xml
626-
else
627-
status="$?"
628+
if [ ! -f report-network-policy-smoke.xml ]; then
629+
printf '<testsuite name="network-policy-smoke" tests="1" failures="0"/>%s' $'\n' > report-network-policy-smoke.xml
630+
fi
631+
exit 0
632+
fi
633+
status="$?"
634+
if [ ! -f report-network-policy-smoke.xml ]; then
628635
cat > report-network-policy-smoke.xml <<'EOF'
629636
<testsuite name="network-policy-smoke" tests="1" failures="1">
630637
<testcase name="network-policy-smoke">
631638
<failure message="network policy smoke test failed">See the workflow log and Kubernetes artifact bundle.</failure>
632639
</testcase>
633640
</testsuite>
634641
EOF
635-
exit "${status}"
636642
fi
643+
exit "${status}"
637644
638645
- name: Finalize Kind e2e
639646
if: always()

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ test-e2e-kubernetes: ## Run e2e tests against Kubernetes (set NMP_E2E_CLUSTER_UR
599599
$(UV) run --frozen pytest e2e --kubernetes -v -n 2 --junitxml=report-kubernetes.xml
600600

601601
.PHONY: test-e2e-kubernetes-network-policies
602-
test-e2e-kubernetes-network-policies: ## Set up local kind with Calico and run the Helm NetworkPolicy smoke test
603-
@echo "Running Kubernetes NetworkPolicy e2e smoke test..."
602+
test-e2e-kubernetes-network-policies: ## Set up local kind with Calico and run the Chainsaw NetworkPolicy smoke test
603+
@echo "Running Chainsaw NetworkPolicy e2e smoke test..."
604604
e2e/k8s/scripts/run_network_policy_e2e.sh
605605

606606
.PHONY: test-e2e-kubernetes-auth

docs/set-up/helm/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Install the NeMo Platform using the Helm chart.
2626
</Card>
2727
<Card title="NetworkPolicy Smoke Test" href="/documentation/self-managed-deployment/setup/helm/network-policy-smoke-test">
2828

29-
Verify optional Helm NetworkPolicies on a local Kind cluster with Calico.
29+
Verify Helm NetworkPolicies on a local Kind cluster with Calico and Chainsaw.
3030

3131
<small><span class="md-tag">cluster-admin</span> <span class="md-tag">kind</span> <span class="md-tag">networking</span></small>
3232

docs/set-up/helm/network-policy-smoke-test.mdx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ description: ""
44
---
55
<a id="network-policy-smoke-test"></a>
66

7-
Use this how-to to verify the optional Helm `networkPolicies` values on a local
8-
Kind cluster with Calico enforcing Kubernetes NetworkPolicy resources.
7+
Use this how-to to verify the Helm `networkPolicies` values on a local Kind
8+
cluster with Calico enforcing Kubernetes NetworkPolicy resources and Chainsaw
9+
running the behavioral assertions.
910

1011
## Prerequisites
1112

1213
- A source checkout of `NVIDIA-NeMo/nemo-platform`
1314
- `docker`, `kind`, `kubectl`, and `helm` available on your workstation
15+
- A local `chainsaw` binary, or Docker access to `ghcr.io/kyverno/chainsaw:v0.2.3`
1416
- `NGC_API_KEY` with access to the NeMo Platform chart and container images
1517
- Permission to create and delete the local Kind cluster and Kubernetes namespaces
1618

@@ -31,9 +33,9 @@ e2e/k8s/scripts/run_network_policy_e2e.sh
3133
```
3234

3335
The script creates or validates a Kind cluster, installs Calico as the enforcing
34-
CNI, installs the chart with `e2e/k8s/values/network-policies.yaml`, and runs
35-
in-cluster probes that verify allowed API/controller traffic and denied
36-
unlabelled or managed-job egress traffic.
36+
CNI, installs the chart with `e2e/k8s/values/network-policies.yaml`, and runs a
37+
Chainsaw test suite that creates probe pods to verify allowed API/controller
38+
traffic and denied unlabelled or managed-job egress traffic.
3739

3840
</Tab>
3941

@@ -65,6 +67,10 @@ for workspace in client.workspaces.list().data:
6567
Set `CALICO_IMAGE_REGISTRY` to override the Calico registry used by the Kind
6668
setup script. The default is `docker.io/calico`.
6769

70+
Set `CHAINSAW_IMAGE` to override the Chainsaw container image used when a local
71+
`chainsaw` binary is not installed. The default is
72+
`ghcr.io/kyverno/chainsaw:v0.2.3`.
73+
6874
When testing source changes, set `NMP_E2E_REGISTRY` and `NMP_E2E_TAG` to a
6975
branch-built `nmp-api` image. CI supplies these from the CPU smoke image build.
7076
If the image is in private GHCR, export `GITHUB_TOKEN` so the setup script can

0 commit comments

Comments
 (0)