@@ -30,7 +30,6 @@ import (
3030 "k8s.io/klog/v2"
3131 "k8s.io/kubernetes/pkg/kubelet/checkpointmanager"
3232 cdiapi "tags.cncf.io/container-device-interface/pkg/cdi"
33- cdispec "tags.cncf.io/container-device-interface/specs-go"
3433
3534 configapi "github.com/NVIDIA/k8s-dra-driver-gpu/api/nvidia.com/resource/v1beta1"
3635 "github.com/NVIDIA/k8s-dra-driver-gpu/pkg/featuregates"
@@ -492,26 +491,12 @@ func (s *DeviceState) applyComputeDomainDaemonConfig(ctx context.Context, config
492491 ComputeDomain : config .DomainID ,
493492 }
494493
495- cd , err := s .computeDomainManager .GetComputeDomain (ctx , config .DomainID )
494+ // Always inject CD details into the CD daemon, in a heterogeneous CD clique
495+ // ID below may be empty (while other CD details are set, and consumed by
496+ // the CD daemon).
497+ edits , err := s .computeDomainManager .GetComputeDomainDaemonContainerEdits (ctx , config .DomainID )
496498 if err != nil {
497- return nil , fmt .Errorf ("error getting compute domain: %w" , err )
498- }
499- if cd == nil {
500- return nil , fmt .Errorf ("compute domain not found: %s" , config .DomainID )
501- }
502-
503- // Always inject Compute Domain details into the CD daemon, in a
504- // heterogeneous CD clique ID below may be empty (while other CD details are
505- // set, and consumed by the CD daemon).
506- edits := & cdiapi.ContainerEdits {
507- ContainerEdits : & cdispec.ContainerEdits {
508- Env : []string {
509- fmt .Sprintf ("CLIQUE_ID=%s" , s .computeDomainManager .cliqueID ),
510- fmt .Sprintf ("COMPUTE_DOMAIN_UUID=%s" , cd .UID ),
511- fmt .Sprintf ("COMPUTE_DOMAIN_NAME=%s" , cd .Name ),
512- fmt .Sprintf ("COMPUTE_DOMAIN_NAMESPACE=%s" , cd .Namespace ),
513- },
514- },
499+ return nil , fmt .Errorf ("error preparing ComputeDomain daemon settings: %w" , err )
515500 }
516501 configState .containerEdits = configState .containerEdits .Append (edits )
517502
@@ -532,10 +517,7 @@ func (s *DeviceState) applyComputeDomainDaemonConfig(ctx context.Context, config
532517 }
533518
534519 // Store information about the ComputeDomain daemon in the configState.
535- edits , err := computeDomainDaemonSettings .GetCDIContainerEdits (ctx , s .cdi .devRoot , nvcapDeviceInfo )
536- if err != nil {
537- return nil , fmt .Errorf ("error getting container edits for ComputeDomain daemon for requests '%v' in claim '%v': %w" , requests , claim .UID , err )
538- }
520+ edits := computeDomainDaemonSettings .GetCDIContainerEditsForImex (ctx , s .cdi .devRoot , nvcapDeviceInfo )
539521 configState .containerEdits = configState .containerEdits .Append (edits )
540522 }
541523
0 commit comments