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
35 changes: 35 additions & 0 deletions internal/state/gpucluster_render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@ func fullSpecGPUCluster() *nvidiav1alpha1.GPUCluster {
return cr
}

func TestGPUClusterDaemonsetsPriorityClass(t *testing.T) {
states := map[string]func(*testing.T) *configurableState{
"dcgm": newTestDCGMState,
"dcgm-exporter": func(t *testing.T) *configurableState { return newTestDCGMExporterState(t, false) },
"dra-validator": newTestDRAValidationState,
}
tests := map[string]struct {
priorityClassName string
want string
}{
"custom": {priorityClassName: "custom-gpu-priority", want: "custom-gpu-priority"},
"unset": {priorityClassName: "", want: "system-node-critical"},
"yaml-boolean": {priorityClassName: "on", want: "on"},
"yaml-null": {priorityClassName: "null", want: "null"},
}
for stateName, newState := range states {
t.Run(stateName, func(t *testing.T) {
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
s := newState(t)
cr := sampleGPUCluster()
cr.Spec.DCGM = &nvidiav1.DCGMSpec{Enabled: new(true)}
cr.Spec.DCGMExporter = &nvidiav1.DCGMExporterSpec{Enabled: new(true)}
cr.Spec.Daemonsets.PriorityClassName = tc.priorityClassName

objs, err := s.getManifestObjects(context.Background(), cr, draSupportedCatalog())
require.NoError(t, err)
ds := findDaemonSet(t, objs)
require.Equal(t, tc.want, ds.Spec.Template.Spec.PriorityClassName)
})
}
})
}
}

// TestGPUClusterRenderGolden renders each GPUCluster operand's manifests end to end and
// byte-compares the full YAML stream against fixtures in testdata/golden, so unintended
// template changes surface as diffs (mirroring the NVIDIADriver renderer tests).
Expand Down
2 changes: 1 addition & 1 deletion manifests/state-dcgm-exporter/0700_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
{{- end }}
{{- end }}
spec:
priorityClassName: system-node-critical
priorityClassName: {{ .Daemonsets.PriorityClassName | default "system-node-critical" | quote }}
serviceAccountName: nvidia-dcgm-exporter-dra
automountServiceAccountToken: true
# Gate scheduling on the per-component deploy label so the k8s-driver-manager
Expand Down
2 changes: 1 addition & 1 deletion manifests/state-dcgm/0500_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
{{- end }}
{{- end }}
spec:
priorityClassName: system-node-critical
priorityClassName: {{ .Daemonsets.PriorityClassName | default "system-node-critical" | quote }}
serviceAccountName: nvidia-dcgm-dra
# Gate scheduling on the per-component deploy label so the k8s-driver-manager
# can pause it to drain DCGM off a node during a driver reload.
Expand Down
2 changes: 1 addition & 1 deletion manifests/state-dra-validation/0500_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
{{- end }}
{{- end }}
spec:
priorityClassName: system-node-critical
priorityClassName: {{ .Daemonsets.PriorityClassName | default "system-node-critical" | quote }}
serviceAccountName: nvidia-dra-validator
# Gate scheduling on the per-component deploy label so the k8s-driver-manager can
# pause it to drain (and force a re-validate of) the validator during a driver reload.
Expand Down