@@ -50,6 +50,8 @@ type ClusterPolicySpec struct {
5050 Toolkit ToolkitSpec `json:"toolkit"`
5151 // DevicePlugin component spec
5252 DevicePlugin DevicePluginSpec `json:"devicePlugin"`
53+ // DRADriver component spec
54+ DRADriver DRADriverSpec `json:"draDriver"`
5355 // DCGMExporter spec
5456 DCGMExporter DCGMExporterSpec `json:"dcgmExporter"`
5557 // DCGM component spec
@@ -849,6 +851,104 @@ type SandboxDevicePluginSpec struct {
849851 Env []EnvVar `json:"env,omitempty"`
850852}
851853
854+ // DRADriverSpec defines the properties for the NVIDIA DRA Driver deployment
855+ type DRADriverSpec struct {
856+ // NVIDIA DRA Driver image repository
857+ // +kubebuilder:validation:Optional
858+ Repository string `json:"repository,omitempty"`
859+
860+ // NVIDIA DRA Driver image name
861+ // +kubebuilder:validation:Pattern=[a-zA-Z0-9\-]+
862+ Image string `json:"image,omitempty"`
863+
864+ // NVIDIA DRA Driver image tag
865+ // +kubebuilder:validation:Optional
866+ Version string `json:"version,omitempty"`
867+
868+ // Image pull policy
869+ // +kubebuilder:validation:Optional
870+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
871+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Image Pull Policy"
872+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:imagePullPolicy"
873+ ImagePullPolicy string `json:"imagePullPolicy,omitempty"`
874+
875+ // Image pull secrets
876+ // +kubebuilder:validation:Optional
877+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
878+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Image pull secrets"
879+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:io.kubernetes:Secret"
880+ ImagePullSecrets []string `json:"imagePullSecrets,omitempty"`
881+
882+ // GPUs defines configuration for GPUs in the NVIDIA DRA Driver
883+ GPUs DRADriverGPUs `json:"gpus,omitempty"`
884+
885+ // ComputeDomains defines configuration for ComputeDomains in the NVIDIA DRA Driver
886+ ComputeDomains DRADriverComputeDomains `json:"computeDomains,omitempty"`
887+ }
888+
889+ // DRADriverGPUs defines configuration for GPUs in the NVIDIA DRA Driver
890+ type DRADriverGPUs struct {
891+ // Enabled indicates if GPUs are enabled in the NVIDIA DRA Driver
892+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
893+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable GPUs in the NVIDIA DRA Driver"
894+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
895+ Enabled * bool `json:"enabled,omitempty"`
896+
897+ // KubeletPlugin defines configuration for the NVIDIA DRA Driver kubelet plugin
898+ KubeletPlugin DRADriverKubeletPlugin `json:"kubeletPlugin,omitempty"`
899+ }
900+
901+ // DRADriverComputeDomains defines configuration for ComputeDomains in the NVIDIA DRA Driver
902+ type DRADriverComputeDomains struct {
903+ // Enabled indicates if ComputeDomains are enabled in the NVIDIA DRA Driver
904+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
905+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable ComputeDomains in the NVIDIA DRA Driver"
906+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
907+ Enabled * bool `json:"enabled,omitempty"`
908+
909+ // Controller defines configuration for the NVIDIA DRA Driver controller
910+ Controller DRADriverController `json:"controller,omitempty"`
911+
912+ // KubeletPlugin defines configuration for the NVIDIA DRA Driver kubelet plugin
913+ KubeletPlugin DRADriverKubeletPlugin `json:"kubeletPlugin,omitempty"`
914+ }
915+
916+ // DRADriverController defines configuration for the NVIDIA DRA Driver controller
917+ type DRADriverController struct {
918+ // Optional: List of environment variables
919+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
920+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Environment Variables"
921+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced,urn:alm:descriptor:com.tectonic.ui:text"
922+ Env []EnvVar `json:"env,omitempty"`
923+
924+ // Optional: Define resources requests and limits
925+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
926+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Resource Requirements"
927+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced,urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
928+ Resources * ResourceRequirements `json:"resources,omitempty"`
929+
930+ // Optional: Set tolerations
931+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
932+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Tolerations"
933+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced,urn:alm:descriptor:io.kubernetes:Tolerations"
934+ Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
935+ }
936+
937+ // DRADriverKubeletPlugin defines configuration for the NVIDIA DRA Driver kubelet plugin
938+ type DRADriverKubeletPlugin struct {
939+ // Optional: List of environment variables
940+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
941+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Environment Variables"
942+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced,urn:alm:descriptor:com.tectonic.ui:text"
943+ Env []EnvVar `json:"env,omitempty"`
944+
945+ // Optional: Define resources requests and limits
946+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
947+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Resource Requirements"
948+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced,urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
949+ Resources * ResourceRequirements `json:"resources,omitempty"`
950+ }
951+
852952// DCGMExporterSpec defines the properties for NVIDIA DCGM Exporter deployment
853953type DCGMExporterSpec struct {
854954 // Enabled indicates if deployment of NVIDIA DCGM Exporter through operator is enabled
@@ -1792,6 +1892,9 @@ func ImagePath(spec interface{}) (string, error) {
17921892 case * SandboxDevicePluginSpec :
17931893 config := spec .(* SandboxDevicePluginSpec )
17941894 return imagePath (config .Repository , config .Image , config .Version , "SANDBOX_DEVICE_PLUGIN_IMAGE" )
1895+ case * DRADriverSpec :
1896+ config := spec .(* DRADriverSpec )
1897+ return imagePath (config .Repository , config .Image , config .Version , "DRA_DRIVER_IMAGE" )
17951898 case * DCGMExporterSpec :
17961899 config := spec .(* DCGMExporterSpec )
17971900 return imagePath (config .Repository , config .Image , config .Version , "DCGM_EXPORTER_IMAGE" )
@@ -1896,6 +1999,21 @@ func (p *DevicePluginSpec) IsEnabled() bool {
18961999 return * p .Enabled
18972000}
18982001
2002+ // IsEnabled returns true if the DRA Driver is enabled through gpu-operator
2003+ func (d * DRADriverSpec ) IsEnabled () bool {
2004+ return d .IsGPUsEnabled () || d .IsComputeDomainsEnabled ()
2005+ }
2006+
2007+ // IsGPUsEnabled returns true if the GPUs resource is enabled in the DRA Driver
2008+ func (d * DRADriverSpec ) IsGPUsEnabled () bool {
2009+ return d .GPUs .Enabled != nil && * d .GPUs .Enabled
2010+ }
2011+
2012+ // IsComputeDomainsEnabled returns true if the ComputeDomains resource is enabled in the DRA Driver
2013+ func (d * DRADriverSpec ) IsComputeDomainsEnabled () bool {
2014+ return d .ComputeDomains .Enabled != nil && * d .ComputeDomains .Enabled
2015+ }
2016+
18992017// IsEnabled returns true if dcgm-exporter is enabled(default) through gpu-operator
19002018func (e * DCGMExporterSpec ) IsEnabled () bool {
19012019 if e .Enabled == nil {
0 commit comments