Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions test/kubernetes/testcluster/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion test/kubernetes/testcluster/testcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down