diff --git a/test/kubernetes/testcluster/objects.go b/test/kubernetes/testcluster/objects.go index 71440bd148..91a938767e 100644 --- a/test/kubernetes/testcluster/objects.go +++ b/test/kubernetes/testcluster/objects.go @@ -444,15 +444,17 @@ func addToleration(podSpec *v13.PodSpec, toleration v13.Toleration) { } // ApplyPodSpec modifies a PodSpec to use this runtime. -func (t RuntimeType) ApplyPodSpec(podSpec *v13.PodSpec) { +func (t RuntimeType) ApplyPodSpec(np *NodePool, podSpec *v13.PodSpec) { switch t { case RuntimeTypeGVisor: podSpec.RuntimeClassName = proto.String(gvisorRuntimeClass) podSpec.NodeSelector[NodepoolRuntimeKey] = string(RuntimeTypeGVisor) - addToleration(podSpec, v13.Toleration{ - Key: "nvidia.com/gpu", - Operator: v13.TolerationOpExists, - }) + if np.numAccelerators > 0 { + addToleration(podSpec, v13.Toleration{ + Key: "nvidia.com/gpu", + Operator: v13.TolerationOpExists, + }) + } case RuntimeTypeUnsandboxed: podSpec.RuntimeClassName = nil podSpec.Tolerations = append(podSpec.Tolerations, v13.Toleration{ diff --git a/test/kubernetes/testcluster/testcluster.go b/test/kubernetes/testcluster/testcluster.go index 5cb7dc6ea1..24921855e3 100644 --- a/test/kubernetes/testcluster/testcluster.go +++ b/test/kubernetes/testcluster/testcluster.go @@ -655,7 +655,7 @@ func (t *TestCluster) applyCommonPodConfigurations(ctx context.Context, np *Node applyRuntime = t.testNodepoolRuntimeOverride } // Apply the runtime we've chosen, whether by override or autodetection. - applyRuntime.ApplyPodSpec(podSpec) + applyRuntime.ApplyPodSpec(np, podSpec) // If the nodepool has accelerators, copy the number of them as a node // selector option.