This repository is an automation/CI framework to test NVIDIA operators, the GPU Operator and Network Operator. This project is based on golang + ginkgo framework.
For planning or delivering NVIDIA feature verification and automation, start with the NVIDIA feature verification and automation workflow.
Golang and ginkgo versions based on versions specified in go.mod file.
The framework in this repository is designed to test NVIDIA's operators on a pre-installed OpenShift Container Platform (OCP) cluster which meets the following requirements:
- OCP cluster installed with version >=4.12
- Regular cluster 3 master nodes (VMs or BMs) and minimum of 2 workers (VMs or BMs)
- Single Node Cluster (VM or BM)
- Public Clouds Cluster (AWS, GCP and Azure) - For GPU Operator Only
- On Premise Cluster
KUBECONFIG- Path to kubeconfig file.
- Logging with glog
We use glog library for logging. In order to enable verbose logging the following needs to be done:
- Make sure to import inittool package in your go script, per this example:
import ( . "github.com/rh-ecosystem-edge/nvidia-ci/internal/inittools" )
- Need to export the following SHELL variable:
export VERBOSE_LEVEL=100
- The value for the variable has to be >= 100.
- The variable can simply be exported in the shell where you run your automation.
- The go file you work on has to be in a directory under github.com/rh-ecosystem-edge/nvidia-ci/tests/ directory for being able to import inittools.
- Importing inittool also initializes the api client and it's available via "APIClient" variable.
- Collect logs from cluster with reporter
We use k8reporter library for collecting resource from cluster in case of test failure. In order to enable k8reporter the following needs to be done:
- Export DUMP_FAILED_TESTS and set it to true. Use example below
export DUMP_FAILED_TESTS=true
- Specify absolute path for logs directory like it appears below. By default /tmp/reports directory is used.
export REPORTS_DUMP_DIR=/tmp/logs_directory
The test-runner script is the recommended way for executing tests.
General Parameters for the script are controlled by the following environment variables:
TEST_FEATURES: list of features to be tested. Subdirectories undertestsdir that match a feature will be included (internal directories are excluded). When we have more than one subdirectory ot tests, they can be listed comma-separated.- requiredTEST_LABELS: ginkgo query passed to the label-filter option for including/excluding tests. Supports comma-separated labels (AND logic) and||operator (OR logic). Examples:'nvidia-ci,gpu','nvidia-ci,mps','nvidia-ci,mig','deploy || rdma-legacy-sriov'- optionalTEST_VERBOSE: executes ginkgo with verbose test output - optionalTEST_TRACE: includes full stack trace from ginkgo tests when a failure occurs - optionalVERBOSE_SCRIPT: prints verbose script information when executing the script - optionalNO_COLOR:{true|anything else}when used, omits the coloring of logs that appear on beginning of the functions. However it does not affect on the coloring of the logs that ginkgo framework generates. - optional
NVIDIA GPU Operator-specific parameters for the script are controlled by the following environment variables:
NVIDIAGPU_GPU_MACHINESET_INSTANCE_TYPE: Use only when OCP is on a public cloud, and when you need to scale the cluster to add a GPU-enabled compute node. If cluster already has a GPU enabled worker node, this variable should be unset.- Example instance type: "g4dn.xlarge" in AWS, or "a2-highgpu-1g" in GCP, or "Standard_NC4as_T4_v3" in Azure - required when need to scale cluster to add GPU node
NVIDIAGPU_CATALOGSOURCE: custom catalogsource to be used. If not specified, the default "certified-operators" catalog is used - optionalNVIDIAGPU_SUBSCRIPTION_CHANNEL: specific subscription channel to be used. If not specified, the latest channel is used - optionalNVIDIAGPU_BUNDLE_IMAGE: GPU Operator bundle image to deploy with operator-sdk if NVIDIAGPU_DEPLOY_FROM_BUNDLE variable is set to true. Default value for bundle image if not set: ghcr.io/nvidia/gpu-operator/gpu-operator-bundle:main-latest - optional when deploying from bundlleNVIDIAGPU_DEPLOY_FROM_BUNDLE: boolean flag to deploy GPU operator from bundle image with operator-sdk - Default value is false - required when deploying from bundleNVIDIAGPU_SUBSCRIPTION_UPGRADE_TO_CHANNEL: specific subscription channel to upgrade to from previous version. required when running operator-upgrade testcaseNVIDIAGPU_CLEANUP: boolean flag to cleanup up resources created by testcase after testcase execution - Default value is true - required only when cleanup is not needed. See the known issue note in Cleaning up leftover resources about automatic cleanup occasionally reporting a spurious NFD-related failure.NVIDIAGPU_GPU_FALLBACK_CATALOGSOURCE_INDEX_IMAGE: custom certified-operators catalogsource index image for GPU package - required when deploying fallback custom GPU catalogsourceNVIDIAGPU_GPU_CLUSTER_POLICY_PATCH: a JSON patch to apply to a default cluster policy from ALM examples, written according to RFC 6902 (also see kubectl patch) - optionalNVIDIAGPU_USE_PRECOMPILED_DRIVER: boolean flag to enable precompiled/signed driver testing. When set totrue, the test discovers the latest precompiled driver version fromregistry.redhat.io/nvidia/gpu-driver-rhel9and patches the ClusterPolicy to use it - Default value isfalse- optionalNVIDIAGPU_PRECOMPILED_DRIVER_BRANCH: controls which precompiled driver branch(es) to test (only applies whenNVIDIAGPU_USE_PRECOMPILED_DRIVER=true). When empty (default), tests the first discovered branch. Set toallto test all discovered branches (deduplicated by major version). Set to a comma-separated list (e.g.580.178.04,595.91.07) to test specific branches. Each branch runs a full GPU burn validation - optionalNFD_FALLBACK_CATALOGSOURCE_INDEX_IMAGE: custom redhat-operators catalogsource index image for NFD package - required when deploying fallback custom NFD catalogsource
See the Testing native DRA with GPU Operator section
below for the "native-dra" testcase, which is part of the nvidiagpu feature/suite and reuses
the NVIDIAGPU_* variables above (no separate variables of its own).
NVIDIA Network Operator-specific (NNO) parameters for the script are controlled by the following environment variables:
NVIDIANETWORK_CATALOGSOURCE: custom catalogsource to be used. If not specified, the default "certified-operators" catalog is used - optionalNVIDIANETWORK_SUBSCRIPTION_CHANNEL: specific subscription channel to be used. If not specified, the latest channel is used - optionalNVIDIANETWORK_BUNDLE_IMAGE: Network Operator bundle image to deploy with operator-sdk if NVIDIANETWORK_DEPLOY_FROM_BUNDLE variable is set to true. Default value for bundle image if not set: TBD - optional when deploying from bundlleNVIDIANETWORK_DEPLOY_FROM_BUNDLE: boolean flag to deploy Network Operator from bundle image with operator-sdk - Default value is false - required when deploying from bundleNVIDIANETWORK_SUBSCRIPTION_UPGRADE_TO_CHANNEL: specific subscription channel to upgrade to from previous version. required when running operator-upgrade testcaseNVIDIANETWORK_CLEANUP: boolean flag to cleanup up resources created by testcase after testcase execution - Default value is true - required only when cleanup is not neededNVIDIANETWORK_CLEANUP_DRIVERS_ONLY: run only the explicit driver-cleanup spec, without deployment or RDMA workloads. Set automatically bymake cleanup-nno-drivers. Default isfalse- optionalNVIDIANETWORK_NNO_FALLBACK_CATALOGSOURCE_INDEX_IMAGE: custom certified-operators catalogsource index image for GPU package - required when deploying fallback custom NNO catalogsourceNFD_FALLBACK_CATALOGSOURCE_INDEX_IMAGE: custom redhat-operators catalogsource index image for NFD package - required when deploying fallback custom NFD catalogsourceNVIDIANETWORK_OFED_DRIVER_VERSION: OFED Driver Version. If not specified, the default driver version is used - optionalNVIDIANETWORK_OFED_REPOSITORY: OFED Driver Repository. If not specified, the default repository is used - optionalNVIDIANETWORK_USE_PRECOMPILED_OFED: boolean flag to select a kernel-matched precompiled DOCA/OFED driver from the Red Hat staging catalog (nvidia/doca-driver-rhel9ornvidia/doca-driver-rhel10). Matching lists tags fromregistry.stage.redhat.iousingopenshift-config/pull-secret(not the unauthenticatedcatalog.stage.redhat.comAPI). NicClusterPolicy is then set to staging pull fields:ofedDriver.repository=registry.stage.redhat.io/nvidia,ofedDriver.image=doca-driver-rhel9|rhel10,ofedDriver.versionas the OFED stream only (for example26.07-0.7.7.0, not the full kernel tag),forcePrecompiled=true, andimagePullSecrets=[ofed-staging-pull-secret]after copying onlyregistry.stage.redhat.iocredentials fromopenshift-config/pull-secretinto thenvidia-network-operatornamespace (addregistry.stage.redhat.ioto the cluster pull secret). Ignored whenNVIDIANETWORK_OFED_DRIVER_VERSIONorNVIDIANETWORK_OFED_REPOSITORYis set. If no catalog image matches, the precompiled deploy and later RDMA tests in the suite are skipped and the existing NicClusterPolicy is left in place. Catalog or cluster lookup errors still fail the test. When this flag is true and a match is found, an existingnic-cluster-policyis deleted before recreate so a prior non-precompiled deploy can be replaced. Default isfalse- optionalNVIDIANETWORK_PREPARE_PRECOMPILED_ONLY: select a compatible image for the installed NNO and both RDMA workers, without deploying it or running RDMA workloads. RequiresNVIDIANETWORK_USE_PRECOMPILED_OFED=true,NVIDIANETWORK_REUSE_NNO=true,SHARED_DIR, both RDMA hostnames, existing worker labels, and staging pull credentials. Both workers must have the same kernel, OS tag and architecture because the handoff contains one exact image tag. Deployment/workload network settings are not required. Clears stale handoff files, then publishesnno-precompiled-pullspec, orskip-nno-precompiledwhen no image matches. Default isfalse- optionalNVIDIANETWORK_RDMA_WORKLOAD_NAMESPACE: RDMA workload pod namespace - requiredNVIDIANETWORK_RDMA_LINK_TYPELayer 2 link type, Infinband or Ethernet - requiredNVIDIANETWORK_RDMA_MLX_DEVICE: mlx5 device ID corresponding to the interface port connected to Spectrum or Infiniband switch - requiredNVIDIANETWORK_RDMA_CLIENT_HOSTNAME: RDMA Client hostname of first worker node for ib_write_bw test - required when running the RDMA testcaseNVIDIANETWORK_RDMA_SERVER_HOSTNAME: RDMA Server hostname of second worker node for ib_write_bw test - required when running the RDMA testcaseNVIDIANETWORK_RDMA_NETWORK_TYPE: RDMA network type, e.g. sriov, shared-device. Defaults to shared-device if not specified - required when running the RDMA testcaseNVIDIANETWORK_RDMA_TEST_IMAGE: RDMA Test Container Image that runs the entrypoint.sh script with optional arguments specified in the pod spec. This container will clone the "https://github.com/linux-rdma/perftest" repo and builds the ib_write_bw binaries with or without cuda headers. It will also run the ib_write_bw command with arguments either in CLient or Server mode. Defaults to "quay.io/wabouham/ecosys-nvidia/rdma-tools:0.0.3" - optionalNVIDIANETWORK_RDMA_SRIOV_NETWORK_NAME: sriovnetwork resource name - required when running the Legacy SRIOV RDMA testcaseNVIDIANETWORK_MELLANOX_ETH_INTERFACE_NAME: Mellanox Ethernet Interface Name - Defaults to "ens8f0np0" if not specified - optionalNVIDIANETWORK_MELLANOX_IB_INTERFACE_NAME: Mellanox Infiniband Interface Name - Defaults to "ens8f0np0" if not specified - optionalNVIDIANETWORK_MACVLANNETWORK_NAME: MacvlanNetwork Custom Resource instance name - Defaults to name from Cluster Service Version alm-examples section if not specified - optionalNVIDIANETWORK_MACVLANNETWORK_IPAM_RANGE: MacvlanNetwork Custom Resource instance IPAM or IP Address/Subnet mask range for Eth or IB interface - requiredNVIDIANETWORK_MACVLANNETWORK_IPAM_GATEWAY: MacvlanNetwork Custom Resource instance IPAM Default Gateway for specified ip address range - requiredNVIDIANETWORK_RDMA_GPUDIRECT: Boolean flag to run RDMA workload with 1 nvidia.com/gpu resource - optional
CLI parameters for the script are controlled by the following ginkgo parameters which are delivered as ARGS="-- [{parameter}...]" for the make run-tests (check the examples):
--nvidia-ci.max-gpu=n, where n is a value of int type between 1 and maximum number of GPU's available. The parameter is used to choose how many GPU's nvidia-ci consumes. Requesting for less than 1 or more than available GPU's are limited to respective limits. Parameter is used for single-mig, mixed-mig and time-slicing testcases also. If not specified, value 1 is used. - optional--nvidia-ci.burntime=n. Default is 60. Controls the gpu_burn workload duration in seconds (30-300). Values outside the valid range are clamped to the closest limit. Increase this parameter value when gpu-burn pod does not show the periodic results of the burn and also the final 100% measurement is missing. Parameter is used for single-mig, mixed-mig and time-slicing testcases also. optional--single.mig.profile=n, where n is typically a value of int type between 0-5. The parameter is used to choose the MIG profile from list of available MIG profiles (e.g. 1g.5gb is usually referenced with index 0). If not specified, a valid random number is used. Typically values 0-5. - optional--mixed.mig.instances=xxx, where xxx is a comma-separated string inside quotation marks (e.g. "2,0,1,1,0,0") The list of numbers represent how many instances are to be used for each profile when creating a pod. The first number indicates how many instances are to be used for the first profile etc. The instances of different profiles consume GPU slices in a different way. The name of the profile (e.g. 2g.10gb) describes the consumption of each instance (each instance would consume 2 slices and 10gb of memory). optional--mixed.mig.pod-delay=n, where n is a number in range 0 to burntime+15 (seconds). In mixed MIG testcase there are usually more than 1 pod launched (depends on available GPU and mixed.mig.instances parameter). This parameter controls the delay between the pod launches so that the pods are running completely simultaneously, mostly overlapping, slightly overlapping, or non-overlapping (over burntime seconds). Values outside valid range are reset to closest limit. optional--time.slicing.instances=xxx, where xxx is a comma-separated string inside quotation marks (e.g. "1,2,3,4,5,6,7,8"). Default is "8". Any single value in the list must be at least 1 and up to max-running-slices. The list of numbers represent how many timeslices for each pod is to be reserved. In the previous example the first pod would get 1 time-slice, second one would get 2, etc. They may run simultaneously as long as they don't exceed the maximum value (e.g. 8) that can run simultaneously. Any pods that is not getting the resources will stay in pending state until the requested resources become available. Any pod with requested max-running-slices time-slices will run alone. Parameter time.slicing.limit restricts the sum of the values (to e.g. default 100). *** Note that multiple GPU's allow using multiples of max-running-slices (e.g. with 2 available GPU's and max-running-slices=8, you can use value of 16 in the list, like "9,10,11,12,13,14,15,16", as the timeslices are per GPU). optional--time.slicing.mon-after-pod=n. Default is 0, meaning that process monitoring will start immediately. If there are 5 instances and mon-after-pod=4, the process monitoring would only start after 4th pod. There may be previous pods still running depending on how many time-slices they have been allocated. Any number exceeding the number of instances will prevent the process monitoring. optional--time.slicing.max-running-slices=n. Minimum value is 2. Default is 8, meaning that there can be total of 8 slices running at any same time. optional--time.slicing.limit=n. Minimum value is 2. Default is 100, meaning that there can be up to e.g. 100 slices launched in total by the testcase. *** Note that the limit applies per GPU; the total limit is multiplied by the GPU count. optional
To test the Multi-Process Service (MPS) functionality, you need to first deploy the GPU Operator and then run the MPS tests without cleaning up the GPU Operator deployment between test suites.
It is recommended to execute the runner script through the make run-tests make target.
- First, deploy the GPU Operator with cleanup disabled for example:
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='nvidia-ci,gpu'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_GPU_MACHINESET_INSTANCE_TYPE="g4dn.xlarge"
$ export NVIDIAGPU_CATALOGSOURCE="certified-operators"
$ export NVIDIAGPU_SUBSCRIPTION_CHANNEL="v23.9"
$ export NVIDIAGPU_CLEANUP=false # Important: don't clean up after deployment
$ make run-tests- After the GPU Operator deployment completes successfully, run the MPS tests:
$ export TEST_FEATURES="mps"
$ export TEST_LABELS='nvidia-ci,mps' # Run MPS-specific tests
$ make run-testsThe MPS tests will use the existing GPU Operator deployment that was left in place from the previous test run. This ensures that the MPS tests can properly validate MPS functionality on an already configured GPU environment.
The test framework ensures that the GPU Operator deployment tests run before MPS tests through Ginkgo's ordering mechanisms. If you need to add new MPS tests, make sure they are organized to run after the GPU Operator deployment by using proper labeling and ordering in your test files.
After completing the MPS tests, you may want to clean up all resources. Re-run the base
nvidiagpu deploy testcase with NVIDIAGPU_CLEANUP=true:
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='nvidia-ci,gpu'
$ export NVIDIAGPU_CLEANUP=true
$ make run-testsThis removes NFD, the GPU Operator (namespace, Subscription, OperatorGroup, CSV, ClusterPolicy), and any leftover gpu-burn resources.
To test the Multi-Instance GPU (MIG) functionality, you need to first deploy the GPU Operator and then run the MIG tests without cleaning up the GPU Operator deployment between test suites.
It is recommended to execute the runner script through the make run-tests make target.
- Run mig testcases (single-mig, mixed-mig and time-slicing) after nvidia-ci on any cluster, while selecting single.mig.profile=1 and 2 time-slicing pods, which do not run at the same time because their sum would exceed the maximum number of simultaneous time-slices (9). Without any mixed-mig arguments, it will run as default. As an example, limit and max-running-slices are set to non default values. In this case 2 pods are launched, first one with 3 timeslices run and consume 3 out of 9 timeslices, blocking the second pod from running because it requires all 9 timeslices. The second pod gets into running state only after the first pod has been completed. time.slicing.limit would restrict the total number of slices to 15, allowing only 3 more slices to be used. It is relevant in cases where more than default limit timeslices are requested. nvidia-ci.burntime controls the workload duration. nvidia-ci.max-gpu controls the amount of GPU's the testcase can request and how the logging success criteria is defined. If more than 1 GPU's are requested, the total pool of GPU resources are multiplied by the GPU amount, and allowing use of more than max-running-slices in the time.slicing.instances parameter.
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='nvidia-ci,gpu,single-mig,mixed-mig,time-slicing'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_CLEANUP=false
$ make run-tests ARGS="-- --single.mig.profile=1 --time.slicing.limit=15 --time.slicing.max-running-slices=9 --time.slicing.instances=3,9 --nvidia-ci.burntime=120 --nvidia-ci.max-gpu=1"- Running only MIG testcases (make run-mig-tests) on an existing cluster which has GPU operator installed,
e.g. after executing step 1. MIG testcase(s) can be used from either nvidiagpu or
mig package. MIG is used in this example. In the other case, use TEST_FEATURES="nvidiagpu"
to execute the testcase from nvidiagpu package.
With these MIG parameters single-mig testcase would choose a random MIG profile (as the single.mig.profile is not
included) , mixed-mig testcase would use 1 instance amount for A100 GPU (1x 1g.5gb, 1x 2g.10gb and 1x 3g.20gb,
leaving the second profile 1g.10gb unused).
mixed-mig testcase would wait 35 seconds between the pods launching with mixed.mig.pod-delay parameter
time-slicing testcase would launch 16 pods, with 1 time-slice each, allowing them to be executed at the same time, as the max-running-slices is set to 16.
You can deliver the ginkgo cli parameter using ARGS after the "make run-mig-tests"
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="mig"
$ export TEST_LABELS='single-mig,mixed-mig,time-slicing'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_CLEANUP=false
$ make run-mig-tests ARGS="-- --mixed.mig.instances='1,0,1,1' --mixed.mig.pod-delay=35 --time.slicing.max-running-slices=16 --time.slicing.instances=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"If the GPU operator and gpu burn pod need to be cleaned up, just set NVIDIAGPU_CLEANUP=true
in the last execution of either steps 1 or 2.
To test GPU time-slicing, deploy the GPU Operator first, then run the time-slicing tests. The test creates a device plugin ConfigMap with time-slicing configuration, deploys a ClusterPolicy referencing it, and validates that multiple CUDA workloads run concurrently on a single time-sliced GPU.
- Deploy the GPU Operator with cleanup disabled (same as MPS step 1 above)
- Run the time-slicing tests:
$ export TEST_FEATURES="timeslicing"
$ export TEST_LABELS='nvidia-ci,timeslicing'
$ make run-testsStarting with GPU Operator 26.7.0, DRA (Dynamic Resource Allocation) enablement can be
managed natively by the operator through two new custom resources, NVIDIADriver and
GPUCluster, instead of ClusterPolicy. The native-dra testcase (in the nvidiagpu
feature/suite, tests/nvidiagpu) deploys the GPU Operator and validates this stack.
It is a self-contained alternative to the base "Deploy NVIDIA GPU Operator with DTK"
testcase above — the two are mutually exclusive ways of installing/configuring the same GPU
Operator (ClusterPolicy is never created by native-dra, and vice versa) — so run it with
only the native-dra label selected, not together with the gpu label. Unlike the pre-release
DRA suites (tests/dra/gpuallocation, tests/dra/computedomain), which assume a
ClusterPolicy is already deployed and install the DRA driver separately via a Helm chart,
native-dra lets the GPU Operator manage the DRA driver itself.
- Installs NFD, the same way the base testcase does.
- Installs the GPU Operator via OLM (namespace, OperatorGroup, Subscription, waits for the
operator Deployment and its CSV to succeed) — reusing the same
NVIDIAGPU_CATALOGSOURCE/NVIDIAGPU_SUBSCRIPTION_CHANNELvariables as the base testcase. - Checks whether the installed GPU Operator version serves the
GPUClusterCRD. If it doesn't (i.e. the installed version is < 26.7.0), the test is skipped. - Creates a minimal
NVIDIADriverand a minimalGPUClustercustom resource, built directly from the CSV'salm-examples(the operator's own suggested minimal samples), and waits for both to reach thereadystate. - Validates GPU functionality by executing
nvidia-smiinside the driver pod(s) rendered byNVIDIADriver.
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='native-dra'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_CATALOGSOURCE="certified-operators"
$ export NVIDIAGPU_SUBSCRIPTION_CHANNEL="v26.7" # must resolve to GPU Operator >= 26.7.0
$ export NVIDIAGPU_CLEANUP=false
$ make run-testsBy default (NVIDIAGPU_CLEANUP=true), the GPUCluster, NVIDIADriver, CSV, Subscription,
OperatorGroup, GPU Operator namespace and NFD are all removed at the end of the run. To leave
them in place for inspection (e.g. to manually inspect the rendered DRA driver pods, or debug
a failure), set NVIDIAGPU_CLEANUP=false (same variable used by the base testcase). See
Cleaning up leftover resources below.
The native-dra-mig testcase extends native-dra: after the GPUCluster is ready, it enables
the NVIDIA DRA driver's DynamicMIG feature gate
(GPUCluster.spec.draDriver.featureGates.DynamicMIG = true) and allocates a MIG device through
a ResourceClaimTemplate (mig.nvidia.com DeviceClass), then runs a VectorAdd workload against
it — proving actual DRA-based MIG scheduling and CDI device injection, not just driver health.
DynamicMIG lets the DRA driver create and destroy MIG GPU instances on demand, per
ResourceClaim (Kubernetes "Partitionable Devices", KEP-4815), instead of requiring MIG
partitions to be pre-sliced on the node out of band (the classic mig-manager/mig-parted
path, which native-dra's GPUCluster stack does not install). As of DRA driver v0.5.0 (the
version bundled by GPU Operator v26.7.x), DynamicMIG is still an Alpha, disabled-by-default
feature gate, so this testcase is inherently best-effort and will Skip() cleanly rather than
fail when a prerequisite isn't met:
- Requires Kubernetes >= 1.34 (Partitionable Devices). On Kubernetes 1.34–1.35 the cluster's
own
DRAPartitionableDevicesfeature gate must also be enabled on the kube-apiserver/scheduler (not something this test can verify client-side — if the Kubernetes version check passes but that gate isn't actually enabled, the test will instead fail later when theResourceClaimnever gets allocated). From Kubernetes 1.36 onward this gate is enabled by default. - Requires at least one MIG-capable GPU node (
nvidia.com/mig.capable=true). - On Ampere-generation GPUs (e.g. A100), MIG mode must already be toggled on at the
hardware level before the DRA driver starts — Ampere cannot toggle MIG mode without a GPU
reset, and
DynamicMIGonly manages MIG partitions, not MIG mode itself. Hopper and later architectures enable MIG mode on demand and need no such pre-step. DynamicMIGis mutually exclusive with the driver'sMPSSupport,PassthroughSupportandNVMLDeviceHealthCheckfeature gates.
Must be run together with native-dra in the same invocation, since it reuses the GPUCluster
that testcase creates:
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='native-dra,native-dra-mig'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_CATALOGSOURCE="certified-operators"
$ export NVIDIAGPU_SUBSCRIPTION_CHANNEL="v26.7" # must resolve to GPU Operator >= 26.7.0
$ export NVIDIAGPU_CLEANUP=false
$ make run-testsTo stop the drivers and RDMA workloads from an earlier NNO test run:
export KUBECONFIG=/path/to/kubeconfig
export NVIDIANETWORK_RDMA_WORKLOAD_NAMESPACE=default
export REPORTS_DUMP_DIR=/tmp/nno-driver-cleanup
make cleanup-nno-driversThe target runs a dedicated Ginkgo spec and produces its normal JUnit report.
It saves the existing GPU and NIC policies in the report directory, deletes RDMA
test pods in the specified namespace, disables the GPU driver and its consumers,
waits for GPU driver pods to terminate, then deletes nic-cluster-policy and waits
for the old OFED driver pods to terminate. GPU and OFED shutdown each have a
10-minute timeout, within a 30-minute overall spec timeout. Missing policies and
already-deleted test pods are tolerated; other API failures fail the operation.
Run image selection before cleanup when switching to a precompiled driver. If no compatible image exists, skip cleanup as well. The target does not select images, change Secure Boot, reboot workers, or install replacement drivers. GPU operands remain disabled and the NIC policy remains removed, including if a later phase fails. Ordinary test runs skip this cleanup spec unless explicitly enabled.
If you ran any nvidiagpu testcase with NVIDIAGPU_CLEANUP=false (e.g. to chain into MPS/MIG/
time-slicing, or to leave resources in place for debugging) and now want to remove everything,
re-run the same testcase with NVIDIAGPU_CLEANUP=true. If the GPU Operator/NFD are already
installed and ready, this completes quickly (no full redeployment) and then runs the same
AfterAll cleanup a normal run performs, removing NFD, the GPU Operator (namespace,
Subscription, OperatorGroup, CSV, ClusterPolicy and/or NVIDIADriver/GPUCluster, whichever was
deployed), and any leftover gpu-burn resources.
Known issue: AfterAll's automatic cleanup (triggered when NVIDIAGPU_CLEANUP=true, the
default) can occasionally report a spurious failure like Error cleaning up NFD resources: failed to delete NFD CR: NodeFeatureDiscovery object nfd-instance doesn't exist in namespace openshift-nfd — this is a timing race in NFD's own delete-and-wait cleanup logic
(pkg/nfd/deploynfd.go), not an actual test failure; the resource in question was in fact
successfully deleted (tracked for a separate PR). If you see this, simply re-run the same
command again to confirm cleanup completed.
Example running the end-to-end GPU Operator test case:
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='nvidia-ci,gpu,single-mig,mixed-mig,time-slicing'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_GPU_MACHINESET_INSTANCE_TYPE="g4dn.xlarge"
$ export NVIDIAGPU_CATALOGSOURCE="certified-operators"
$ export NVIDIAGPU_SUBSCRIPTION_CHANNEL="v23.9"
$ make run-tests
Executing nvidiagpu test-runner script
scripts/test-runner.sh
ginkgo -timeout=24h --keep-going --require-suite -r -vv --trace --label-filter="nvidia-ci,gpu,single-mig,mixed-mig,time-slicing" ./tests/nvidiagpuExample running the GPU Operator upgrade testcase (from v23.6 to v24.3) after the end-end testcase. Note: you must run the end-to-end testcase first to deploy a previous version, set NVIDIAGPU_CLEANUP=false, and specify the channel to upgrade to NVIDIAGPU_SUBSCRIPTION_UPGRADE_TO_CHANNEL=v24.3, along with the label 'operator-upgrade' in TEST_LABELS. Otherwise, the upgrade testcase will not be executed:
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-ci-gpu-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='nvidia-ci,gpu,operator-upgrade'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_GPU_MACHINESET_INSTANCE_TYPE="g4dn.xlarge"
$ export NVIDIAGPU_CATALOGSOURCE="certified-operators"
$ export NVIDIAGPU_SUBSCRIPTION_CHANNEL="v23.9"
$ export NVIDIAGPU_SUBSCRIPTION_UPGRADE_TO_CHANNEL=v24.3
$ export NVIDIAGPU_CLEANUP=false
$ make run-tests
Executing nvidiagpu test-runner script
scripts/test-runner.sh
ginkgo -timeout=24h --keep-going --require-suite -r -vv --trace --label-filter="nvidia-ci,gpu,operator-upgrade" ./tests/nvidiagpuExample running the end-to-end test case and creating custom catalogsources for NFD and GPU Operator packagmanifests when missing from their default catalogsources.
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-gpu-ci-logs-dir
$ export TEST_FEATURES="nvidiagpu"
$ export TEST_LABELS='nvidia-ci,gpu'
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIAGPU_GPU_MACHINESET_INSTANCE_TYPE="g4dn.xlarge"
$ export NVIDIAGPU_GPU_FALLBACK_CATALOGSOURCE_INDEX_IMAGE="registry.redhat.io/redhat/certified-operator-index:v4.16"
$ export NFD_FALLBACK_CATALOGSOURCE_INDEX_IMAGE="registry.redhat.io/redhat/redhat-operator-index:v4.17"
$ make run-testsExample running the end-to-end Network Operator test case, with the Legacy SRIOV RDMA testcase.
Note: both TEST_LABELS "deploy || rdma-legacy-sriov' are specified in examples below:
$ export KUBECONFIG=/path/to/kubeconfig
$ export DUMP_FAILED_TESTS=true
$ export REPORTS_DUMP_DIR=/tmp/nvidia-nno-ci-logs-dir
$ export TEST_FEATURES="nvidianetwork"
# To run the NNO deploy testcase followed by RDMA Shared Device testcase,
# set: export TEST_LABELS="deploy || rdma-shared-dev"
$ export TEST_LABELS="deploy || rdma-legacy-sriov"
$ export TEST_TRACE=true
$ export VERBOSE_LEVEL=100
$ export NVIDIANETWORK_CATALOGSOURCE="certified-operators"
$ export NVIDIANETWORK_SUBSCRIPTION_CHANNEL="v24.7"
$ export NVIDIANETWORK_NNO_FALLBACK_CATALOGSOURCE_INDEX_IMAGE="registry.redhat.io/redhat/certified-operator-index:v4.17"
$ export NFD_FALLBACK_CATALOGSOURCE_INDEX_IMAGE="registry.redhat.io/redhat/redhat-operator-index:v4.17"
$ export NVIDIANETWORK_OFED_DRIVER_VERSION="25.01-0.6.0.0-0"
$ export NVIDIANETWORK_OFED_REPOSITORY="quay.io/wabouham/ecosys-nvidia"
$ export NVIDIANETWORK_RDMA_CLIENT_HOSTNAME=nvd-srv-3.nvidia.eng.redhat.com
$ export NVIDIANETWORK_RDMA_SERVER_HOSTNAME=nvd-srv-2.nvidia.eng.redhat.com
$ export NVIDIANETWORK_MACVLANNETWORK_IPAM_RANGE=192.168.2.0/24
$ export NVIDIANETWORK_MACVLANNETWORK_IPAM_GATEWAY=192.168.2.1
$ export NVIDIANETWORK_DEPLOY_FROM_BUNDLE=true
$ export NVIDIANETWORK_BUNDLE_IMAGE="nvcr.io/.../network-operator-bundle:v25.1.0-rc.2"
$ export NVIDIANETWORK_MELLANOX_ETH_INTERFACE_NAME="ens8f0np0"
$ export NVIDIANETWORK_MELLANOX_IB_INTERFACE_NAME="ibs2f0"
$ export NVIDIANETWORK_MACVLANNETWORK_NAME="rdmashared-net"
$ export NVIDIANETWORK_RDMA_WORKLOAD_NAMESPACE="default"
$ export NVIDIANETWORK_RDMA_LINK_TYPE="ethernet"
$ export NVIDIANETWORK_RDMA_MLX_DEVICE="mlx5_2"
$ export NVIDIANETWORK_RDMA_GPUDIRECT=true
# NVIDIANETWORK_RDMA_NETWORK_TYPE supported values are: "sriov", "shared-device"
$ export NVIDIANETWORK_RDMA_NETWORK_TYPE=sriov
$ make run-tests
Executing nvidiagpu test-runner script
scripts/test-runner.sh
ginkgo -timeout=24h --keep-going --require-suite -r -vv --trace --label-filter="deploy || rdma-legacy-sriov" ./tests/nvidianetworkSeparate from the Ginkgo test suites above, scripts/apply-manifests.sh
applies (or deletes) a directory of plain YAML manifests against an already-installed OpenShift
cluster, via the make apply-manifests / make delete-manifests targets. This is intended for
one-off, day-2 cluster configuration (e.g. worker MachineConfigs, ServiceAccounts) that isn't
part of a Ginkgo test flow.
KUBECONFIG- Path to kubeconfig file - required (same variable used everywhere else in this repo)MANIFEST_DIR- Directory containing the*.yaml/*.ymlfiles to apply/delete - Defaults tomanifests/nno- optionalMANIFEST_VARS- Space-separated list of$VARtokens (envsubst's own filter syntax) restricting variable substitution to only those variables. If unset, every variable present in the environment is eligible for substitution in every manifest - optionalWAIT_FOR_WORKER_MCP-{true|false}- Whentrueand the action isapply, waits for the workerMachineConfigPoolto finish rolling out after each manifest is applied, before moving on to the next one.make apply-manifestsdefaults this totrue(since the defaultMANIFEST_DIR=manifests/nnocontainsMachineConfigs that reboot workers); the underlying script itself defaults tofalse- optionalWORKER_MCP_NAME- Name of theMachineConfigPoolto wait on whenWAIT_FOR_WORKER_MCP=true- Defaults toworker- optionalWORKER_MCP_ROLLOUT_START_TIMEOUT- How long to wait for the pool to start updating before giving up and moving on (tolerant: a manifest that doesn't touch workerMachineConfigs, like aServiceAccount, never makes the pool start updating, so this timeout is expected to elapse harmlessly for those files) - Defaults to2m- optionalWORKER_MCP_ROLLOUT_TIMEOUT- How long to wait for the pool to finish updating once it starts (fatal: the whole run aborts if this elapses) - Defaults to40m- optional
- Ordering: files are applied in lexical filename order (reverse order on delete), so prefix
files with numbers (
00-,10-,20-, ...) to control ordering when one manifest depends on another (e.g. a namespace before objects created in it). - Templating: manifests may contain
${VAR}/$VARplaceholders, substituted from the current environment viaenvsubstbefore being applied. - Required variables (
<name>.env-required): if a sibling file with the same base name and a.env-requiredextension exists next to a manifest (e.g.10-foo.yaml->10-foo.env-required, one variable name per line, blank lines and#-comments ignored), the script verifies every listed variable is set and non-empty before rendering that manifest, failing fast instead of lettingenvsubstsilently substitute an empty string for a variable nobody remembered to export. - Post-apply hooks (
<name>.sh): if a sibling file with the same base name and a.shextension exists next to a manifest (e.g.20-foo.yaml->20-foo.sh), it is executed immediately after that manifest is applied (and after anyWAIT_FOR_WORKER_MCPwait completes). This is how manifest-specific follow-up commands are attached without hardcoding them into the generic script.
00-doca1-99-machine-config-blacklist-irdma.yaml-MachineConfig(roleworker) that blacklists theirdmakernel module.10-doca1-99-machine-config-udev-network.yaml-MachineConfig(roleworker) that installs a udev rules file mapping specific NIC MAC addresses to interface names (ib_rdma0/eth_rdma0). The rules content is parameterized as base64 incontents.source, soDOCA1_UDEV_NETWORK_RULES_BASE64must be exported before runningmake apply-manifests(enforced by the sibling10-doca1-99-machine-config-udev-network.env-requiredfile) - required20-doca1-rdma-service-account-default-namespace.yaml-ServiceAccountnamedrdmain thedefaultnamespace.21-doca1-rdma-privileged-scc.yaml-RoleBindingin thedefaultnamespace that lets that ServiceAccountusetheprivilegedSCC. It references ClusterRolesystem:openshift:scc:privilegedand is applied after the ServiceAccount. It is a separate binding from the sharedsystem:openshift:scc:privilegedRoleBinding, so deleting it removes only this grant.
$ export KUBECONFIG=/path/to/kubeconfig
$ export DOCA1_UDEV_NETWORK_RULES_BASE64="$(base64 <<'EOF' | tr -d '\n'
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="<mac>",ATTR{type}=="1",NAME="ib_rdma0"
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="<mac>",ATTR{type}=="1",NAME="eth_rdma0"
EOF
)"
$ make apply-manifestsThe two MachineConfig files each trigger a worker MachineConfigPool rollout (cordon/drain/
reboot/uncordon per node); with the default WAIT_FOR_WORKER_MCP=true, make apply-manifests
waits for that to finish after each one before moving on. The rdma ServiceAccount is applied
next, then 21-doca1-rdma-privileged-scc.yaml grants it the privileged SCC.
To remove everything again:
$ export KUBECONFIG=/path/to/kubeconfig
$ make delete-manifestsdelete-manifests does not wait on the MachineConfigPool or run any hooks. It removes the
manifests/nno files themselves, in reverse order, so the privileged SCC RoleBinding is deleted
before the rdma ServiceAccount.