@@ -34,6 +34,8 @@ import (
3434
3535const (
3636 ClusterPolicyCRDName = "ClusterPolicy"
37+ // DefaultDCGMJobMappingDir is the default directory for DCGM Exporter HPC job mapping files
38+ DefaultDCGMJobMappingDir = "/var/lib/dcgm-exporter/job-mapping"
3739)
3840
3941// ClusterPolicySpec defines the desired state of ClusterPolicy
@@ -928,6 +930,31 @@ type DCGMExporterSpec struct {
928930 // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable hostPID for NVIDIA DCGM Exporter"
929931 // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
930932 HostPID * bool `json:"hostPID,omitempty"`
933+
934+ // Optional: HPC job mapping configuration for NVIDIA DCGM Exporter
935+ // +kubebuilder:validation:Optional
936+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
937+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="HPC Job Mapping Configuration"
938+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:advanced"
939+ HPCJobMapping * DCGMExporterHPCJobMappingConfig `json:"hpcJobMapping,omitempty"`
940+ }
941+
942+ // DCGMExporterHPCJobMappingConfig defines HPC job mapping configuration for NVIDIA DCGM Exporter
943+ type DCGMExporterHPCJobMappingConfig struct {
944+ // Enable HPC job mapping for DCGM Exporter
945+ // +kubebuilder:validation:Optional
946+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
947+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable HPC Job Mapping"
948+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
949+ Enabled * bool `json:"enabled,omitempty"`
950+
951+ // Directory path where HPC job mapping files are created by the workload manager
952+ // Defaults to /var/lib/dcgm-exporter/job-mapping if not specified
953+ // +kubebuilder:validation:Optional
954+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
955+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Job Mapping Directory"
956+ // +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
957+ Directory string `json:"directory,omitempty"`
931958}
932959
933960// DCGMExporterMetricsConfig defines metrics to be collected by NVIDIA DCGM Exporter
@@ -1943,6 +1970,23 @@ func (e *DCGMExporterSpec) IsHostPIDEnabled() bool {
19431970 return * e .HostPID
19441971}
19451972
1973+ // IsHPCJobMappingEnabled returns true if HPC job mapping is enabled for DCGM Exporter
1974+ func (e * DCGMExporterSpec ) IsHPCJobMappingEnabled () bool {
1975+ if e .HPCJobMapping == nil || e .HPCJobMapping .Enabled == nil {
1976+ // default is false if not specified by user
1977+ return false
1978+ }
1979+ return * e .HPCJobMapping .Enabled
1980+ }
1981+
1982+ // GetHPCJobMappingDirectory returns the directory path for HPC job mapping
1983+ func (e * DCGMExporterSpec ) GetHPCJobMappingDirectory () string {
1984+ if e .HPCJobMapping == nil {
1985+ return ""
1986+ }
1987+ return e .HPCJobMapping .Directory
1988+ }
1989+
19461990// IsEnabled returns true if gpu-feature-discovery is enabled(default) through gpu-operator
19471991func (g * GPUFeatureDiscoverySpec ) IsEnabled () bool {
19481992 if g .Enabled == nil {
0 commit comments