Skip to content

Commit 88564bd

Browse files
committed
gpu-config: deploy the GPU configuration manager from GPUCluster
Signed-off-by: Henry Wang <henrwang@nvidia.com>
1 parent 4ea2e3c commit 88564bd

29 files changed

Lines changed: 1283 additions & 6 deletions

‎api/nvidia/v1alpha1/gpucluster_types.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ type GPUClusterSpec struct {
4646
// reused enabled field carries no server-side default; the controller defaults nil enabled.
4747
DCGMExporter *nvidiav1.DCGMExporterSpec `json:"dcgmExporter,omitempty"`
4848

49+
// GPUConfigManager defines the spec for the GPU configuration manager. It configures
50+
// GPU settings such as the power limit, locked clocks and ECC mode on each node from
51+
// ConfigMaps in the operator namespace, and applies them again after every driver
52+
// load. Disabled when unset.
53+
GPUConfigManager *nvidiav1.GPUConfigManagerSpec `json:"gpuConfigManager,omitempty"`
54+
4955
// HostPaths defines the host paths used in host-path volumes for various components.
5056
HostPaths HostPathsSpec `json:"hostPaths,omitempty"`
5157

‎api/nvidia/v1alpha1/zz_generated.deepcopy.go‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎bundle/manifests/nvidia.com_gpuclusters.yaml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,84 @@ spec:
10281028
description: NVIDIA DRA driver image tag
10291029
type: string
10301030
type: object
1031+
gpuConfigManager:
1032+
description: |-
1033+
GPUConfigManager defines the spec for the GPU configuration manager. It configures
1034+
GPU settings such as the power limit, locked clocks and ECC mode on each node from
1035+
ConfigMaps in the operator namespace, and applies them again after every driver
1036+
load. Disabled when unset.
1037+
properties:
1038+
config:
1039+
description: |-
1040+
Config selects the ConfigMap (key config.yaml) in the operator namespace with the GPU settings for all nodes.
1041+
For a node, gpu-config-node-<node name> wins over gpu-config-pool-<pool>, which wins over this one.
1042+
<pool> is derived from the node's nvidia.com/gpu-config.pool label (lowercased, "_" to "-"; values that
1043+
can't name a ConfigMap are ignored); set POOL_LABEL_KEY in spec.gpuConfigManager.env to use another label.
1044+
properties:
1045+
name:
1046+
default: gpu-config
1047+
description: |-
1048+
Name of the ConfigMap in the operator namespace with the GPU settings for nodes
1049+
that have no per-node or per-pool ConfigMap
1050+
type: string
1051+
type: object
1052+
enabled:
1053+
description: Enabled indicates if deployment of the GPU configuration
1054+
manager is enabled
1055+
type: boolean
1056+
env:
1057+
description: |-
1058+
Optional: List of environment variables. They are also passed to the gpu-config init container
1059+
of the validator / DRA kubelet plugin, even when the manager is disabled. GPU_CONFIG_NO_MODULE_TIMEOUT
1060+
sets how long that container waits for the nvidia module before letting allocators start (default 5m).
1061+
items:
1062+
description: EnvVar represents an environment variable present
1063+
in a Container.
1064+
properties:
1065+
name:
1066+
description: Name of the environment variable.
1067+
type: string
1068+
value:
1069+
description: Value of the environment variable.
1070+
type: string
1071+
required:
1072+
- name
1073+
type: object
1074+
type: array
1075+
hostNetwork:
1076+
description: HostNetwork indicates whether the GPU configuration
1077+
manager pod uses the host's network namespace.
1078+
type: boolean
1079+
resources:
1080+
description: 'Optional: Define resources requests and limits for
1081+
each pod'
1082+
properties:
1083+
limits:
1084+
additionalProperties:
1085+
anyOf:
1086+
- type: integer
1087+
- type: string
1088+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1089+
x-kubernetes-int-or-string: true
1090+
description: |-
1091+
Limits describes the maximum amount of compute resources allowed.
1092+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
1093+
type: object
1094+
requests:
1095+
additionalProperties:
1096+
anyOf:
1097+
- type: integer
1098+
- type: string
1099+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1100+
x-kubernetes-int-or-string: true
1101+
description: |-
1102+
Requests describes the minimum amount of compute resources required.
1103+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
1104+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
1105+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
1106+
type: object
1107+
type: object
1108+
type: object
10311109
hostPaths:
10321110
description: HostPaths defines the host paths used in host-path volumes
10331111
for various components.

‎config/crd/bases/nvidia.com_gpuclusters.yaml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,84 @@ spec:
10281028
description: NVIDIA DRA driver image tag
10291029
type: string
10301030
type: object
1031+
gpuConfigManager:
1032+
description: |-
1033+
GPUConfigManager defines the spec for the GPU configuration manager. It configures
1034+
GPU settings such as the power limit, locked clocks and ECC mode on each node from
1035+
ConfigMaps in the operator namespace, and applies them again after every driver
1036+
load. Disabled when unset.
1037+
properties:
1038+
config:
1039+
description: |-
1040+
Config selects the ConfigMap (key config.yaml) in the operator namespace with the GPU settings for all nodes.
1041+
For a node, gpu-config-node-<node name> wins over gpu-config-pool-<pool>, which wins over this one.
1042+
<pool> is derived from the node's nvidia.com/gpu-config.pool label (lowercased, "_" to "-"; values that
1043+
can't name a ConfigMap are ignored); set POOL_LABEL_KEY in spec.gpuConfigManager.env to use another label.
1044+
properties:
1045+
name:
1046+
default: gpu-config
1047+
description: |-
1048+
Name of the ConfigMap in the operator namespace with the GPU settings for nodes
1049+
that have no per-node or per-pool ConfigMap
1050+
type: string
1051+
type: object
1052+
enabled:
1053+
description: Enabled indicates if deployment of the GPU configuration
1054+
manager is enabled
1055+
type: boolean
1056+
env:
1057+
description: |-
1058+
Optional: List of environment variables. They are also passed to the gpu-config init container
1059+
of the validator / DRA kubelet plugin, even when the manager is disabled. GPU_CONFIG_NO_MODULE_TIMEOUT
1060+
sets how long that container waits for the nvidia module before letting allocators start (default 5m).
1061+
items:
1062+
description: EnvVar represents an environment variable present
1063+
in a Container.
1064+
properties:
1065+
name:
1066+
description: Name of the environment variable.
1067+
type: string
1068+
value:
1069+
description: Value of the environment variable.
1070+
type: string
1071+
required:
1072+
- name
1073+
type: object
1074+
type: array
1075+
hostNetwork:
1076+
description: HostNetwork indicates whether the GPU configuration
1077+
manager pod uses the host's network namespace.
1078+
type: boolean
1079+
resources:
1080+
description: 'Optional: Define resources requests and limits for
1081+
each pod'
1082+
properties:
1083+
limits:
1084+
additionalProperties:
1085+
anyOf:
1086+
- type: integer
1087+
- type: string
1088+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1089+
x-kubernetes-int-or-string: true
1090+
description: |-
1091+
Limits describes the maximum amount of compute resources allowed.
1092+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
1093+
type: object
1094+
requests:
1095+
additionalProperties:
1096+
anyOf:
1097+
- type: integer
1098+
- type: string
1099+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1100+
x-kubernetes-int-or-string: true
1101+
description: |-
1102+
Requests describes the minimum amount of compute resources required.
1103+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
1104+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
1105+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
1106+
type: object
1107+
type: object
1108+
type: object
10311109
hostPaths:
10321110
description: HostPaths defines the host paths used in host-path volumes
10331111
for various components.

‎deployments/gpu-operator/crds/nvidia.com_gpuclusters.yaml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,84 @@ spec:
10281028
description: NVIDIA DRA driver image tag
10291029
type: string
10301030
type: object
1031+
gpuConfigManager:
1032+
description: |-
1033+
GPUConfigManager defines the spec for the GPU configuration manager. It configures
1034+
GPU settings such as the power limit, locked clocks and ECC mode on each node from
1035+
ConfigMaps in the operator namespace, and applies them again after every driver
1036+
load. Disabled when unset.
1037+
properties:
1038+
config:
1039+
description: |-
1040+
Config selects the ConfigMap (key config.yaml) in the operator namespace with the GPU settings for all nodes.
1041+
For a node, gpu-config-node-<node name> wins over gpu-config-pool-<pool>, which wins over this one.
1042+
<pool> is derived from the node's nvidia.com/gpu-config.pool label (lowercased, "_" to "-"; values that
1043+
can't name a ConfigMap are ignored); set POOL_LABEL_KEY in spec.gpuConfigManager.env to use another label.
1044+
properties:
1045+
name:
1046+
default: gpu-config
1047+
description: |-
1048+
Name of the ConfigMap in the operator namespace with the GPU settings for nodes
1049+
that have no per-node or per-pool ConfigMap
1050+
type: string
1051+
type: object
1052+
enabled:
1053+
description: Enabled indicates if deployment of the GPU configuration
1054+
manager is enabled
1055+
type: boolean
1056+
env:
1057+
description: |-
1058+
Optional: List of environment variables. They are also passed to the gpu-config init container
1059+
of the validator / DRA kubelet plugin, even when the manager is disabled. GPU_CONFIG_NO_MODULE_TIMEOUT
1060+
sets how long that container waits for the nvidia module before letting allocators start (default 5m).
1061+
items:
1062+
description: EnvVar represents an environment variable present
1063+
in a Container.
1064+
properties:
1065+
name:
1066+
description: Name of the environment variable.
1067+
type: string
1068+
value:
1069+
description: Value of the environment variable.
1070+
type: string
1071+
required:
1072+
- name
1073+
type: object
1074+
type: array
1075+
hostNetwork:
1076+
description: HostNetwork indicates whether the GPU configuration
1077+
manager pod uses the host's network namespace.
1078+
type: boolean
1079+
resources:
1080+
description: 'Optional: Define resources requests and limits for
1081+
each pod'
1082+
properties:
1083+
limits:
1084+
additionalProperties:
1085+
anyOf:
1086+
- type: integer
1087+
- type: string
1088+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1089+
x-kubernetes-int-or-string: true
1090+
description: |-
1091+
Limits describes the maximum amount of compute resources allowed.
1092+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
1093+
type: object
1094+
requests:
1095+
additionalProperties:
1096+
anyOf:
1097+
- type: integer
1098+
- type: string
1099+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
1100+
x-kubernetes-int-or-string: true
1101+
description: |-
1102+
Requests describes the minimum amount of compute resources required.
1103+
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
1104+
otherwise to an implementation-defined value. Requests cannot exceed Limits.
1105+
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
1106+
type: object
1107+
type: object
1108+
type: object
10311109
hostPaths:
10321110
description: HostPaths defines the host paths used in host-path volumes
10331111
for various components.

‎deployments/gpu-operator/templates/gpucluster.yaml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ spec:
128128
config:
129129
name: {{ .Values.dcgmExporter.config.name }}
130130
{{- end }}
131+
gpuConfigManager:
132+
enabled: {{ .Values.gpuConfigManager.enabled }}
133+
{{- if .Values.gpuConfigManager.config }}
134+
config: {{ toYaml .Values.gpuConfigManager.config | nindent 6 }}
135+
{{- end }}
136+
{{- if .Values.gpuConfigManager.resources }}
137+
resources: {{ toYaml .Values.gpuConfigManager.resources | nindent 6 }}
138+
{{- end }}
139+
{{- if .Values.gpuConfigManager.env }}
140+
env: {{ toYaml .Values.gpuConfigManager.env | nindent 6 }}
141+
{{- end }}
142+
{{- if .Values.gpuConfigManager.hostNetwork }}
143+
hostNetwork: {{ .Values.gpuConfigManager.hostNetwork }}
144+
{{- end }}
131145
hostPaths:
132146
driverInstallDir: {{ .Values.hostPaths.driverInstallDir }}
133147
{{- if .Values.hostPaths.kubeletRootDir }}

‎internal/state/dra_driver.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ func (s *stateDRADriver) getManifestObjects(ctx context.Context, cr *nvidiav1alp
131131
ComputeDomainsHealthcheckPort: resolveHealthcheckPort(
132132
cr.Spec.DRADriver.ComputeDomains.KubeletPlugin.Healthcheck, defaultComputeDomainsHealthcheckPort),
133133
}
134+
if cr.Spec.GPUConfigManager != nil {
135+
renderData.GPUConfigGateEnv = dedupeEnv(cr.Spec.GPUConfigManager.Env)
136+
}
134137

135138
return s.renderObjects(ctx, renderData)
136139
}

0 commit comments

Comments
 (0)