Skip to content

Commit 0bc1052

Browse files
authored
Merge pull request #1544 from NVIDIA/confimap-tosecret
Use a Secret instead of a ConfigMap for NLS licensing token
2 parents d12142c + 7d8c378 commit 0bc1052

22 files changed

+711
-57
lines changed

.golangci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ linters:
2323
- third_party$
2424
- builtin$
2525
- examples$
26+
rules:
27+
- linters:
28+
- staticcheck
29+
path: (.+)\.go$
30+
text: 'SA1019: config.Driver.LicensingConfig.ConfigMapName is deprecated(.+)'
31+
- linters:
32+
- staticcheck
33+
path: (.+)\.go$
34+
text: 'SA1019: cr.Spec.LicensingConfig.Name is deprecated(.+)'
2635
formatters:
2736
enable:
2837
- gofmt

api/nvidia/v1/clusterpolicy_types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,12 +1120,20 @@ type DriverCertConfigSpec struct {
11201120

11211121
// DriverLicensingConfigSpec defines licensing server configuration for NVIDIA Driver container
11221122
type DriverLicensingConfigSpec struct {
1123+
// Deprecated: ConfigMapName has been deprecated in favour of SecretName. Please use secrets to handle the licensing server configuration more securely
11231124
// +kubebuilder:validation:Optional
11241125
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
11251126
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="ConfigMap Name"
11261127
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
11271128
ConfigMapName string `json:"configMapName,omitempty"`
11281129

1130+
// SecretName indicates the name of the secret containing the licensing token
1131+
// +kubebuilder:validation:Optional
1132+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
1133+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Secret Name"
1134+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
1135+
SecretName string `json:"secretName,omitempty"`
1136+
11291137
// NLSEnabled indicates if NVIDIA Licensing System is used for licensing.
11301138
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
11311139
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Enable NVIDIA Licensing System licensing"
@@ -1900,6 +1908,14 @@ func (d *DriverSpec) OpenKernelModulesEnabled() bool {
19001908
return d.KernelModuleType == "open"
19011909
}
19021910

1911+
// IsVGPULicensingEnabled returns true if the vgpu driver license config is provided
1912+
func (d *DriverSpec) IsVGPULicensingEnabled() bool {
1913+
if d.LicensingConfig == nil {
1914+
return false
1915+
}
1916+
return d.LicensingConfig.ConfigMapName != "" || d.LicensingConfig.SecretName != ""
1917+
}
1918+
19031919
// IsEnabled returns true if device-plugin is enabled(default) through gpu-operator
19041920
func (p *DevicePluginSpec) IsEnabled() bool {
19051921
if p.Enabled == nil {

api/nvidia/v1alpha1/nvidiadriver_types.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,13 @@ type DriverRepoConfigSpec struct {
428428

429429
// DriverLicensingConfigSpec defines licensing server configuration for NVIDIA Driver container
430430
type DriverLicensingConfigSpec struct {
431+
// +kubebuilder:validation:Optional
432+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
433+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Secret Name"
434+
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
435+
SecretName string `json:"secretName,omitempty"`
436+
437+
// Deprecated: ConfigMapName has been deprecated in favour of SecretName. Please use secrets to handle the licensing server configuration more securely
431438
// +kubebuilder:validation:Optional
432439
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
433440
// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="ConfigMap Name"
@@ -688,7 +695,7 @@ func (d *NVIDIADriverSpec) IsVGPULicensingEnabled() bool {
688695
if d.LicensingConfig == nil {
689696
return false
690697
}
691-
return d.LicensingConfig.Name != ""
698+
return d.LicensingConfig.Name != "" || d.LicensingConfig.SecretName != ""
692699
}
693700

694701
// IsKernelModuleConfigEnabled returns true if kernel module config is provided

bundle/manifests/gpu-operator-certified.clusterserviceversion.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ metadata:
7272
},
7373
"licensingConfig": {
7474
"nlsEnabled": true,
75-
"configMapName": ""
75+
"secretName": ""
7676
},
7777
"virtualTopology": {
7878
"config": ""
@@ -170,7 +170,7 @@ metadata:
170170
},
171171
"licensingConfig": {
172172
"nlsEnabled": true,
173-
"name": ""
173+
"secretName": ""
174174
},
175175
"virtualTopologyConfig": {
176176
"name": ""

bundle/manifests/nvidia.com_clusterpolicies.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,18 @@ spec:
685685
licensing'
686686
properties:
687687
configMapName:
688+
description: 'Deprecated: ConfigMapName has been deprecated
689+
in favour of SecretName. Please use secrets to handle the
690+
LicensingConfig more securely'
688691
type: string
689692
nlsEnabled:
690693
description: NLSEnabled indicates if NVIDIA Licensing System
691694
is used for licensing.
692695
type: boolean
696+
secretName:
697+
description: SecretName indicates the name of the secret containing
698+
the licensing token
699+
type: string
693700
type: object
694701
livenessProbe:
695702
description: NVIDIA Driver container liveness probe settings

bundle/manifests/nvidia.com_nvidiadrivers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,16 @@ spec:
234234
description: 'Optional: Licensing configuration for NVIDIA vGPU licensing'
235235
properties:
236236
name:
237+
description: 'Deprecated: ConfigMapName has been deprecated in
238+
favour of SecretName. Please use secrets to handle the LicensingConfig
239+
more securely'
237240
type: string
238241
nlsEnabled:
239242
description: NLSEnabled indicates if NVIDIA Licensing System is
240243
used for licensing.
241244
type: boolean
245+
secretName:
246+
type: string
242247
type: object
243248
livenessProbe:
244249
description: NVIDIA Driver container liveness probe settings

config/crd/bases/nvidia.com_clusterpolicies.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,18 @@ spec:
685685
licensing'
686686
properties:
687687
configMapName:
688+
description: 'Deprecated: ConfigMapName has been deprecated
689+
in favour of SecretName. Please use secrets to handle the
690+
licensing server configuration more securely'
688691
type: string
689692
nlsEnabled:
690693
description: NLSEnabled indicates if NVIDIA Licensing System
691694
is used for licensing.
692695
type: boolean
696+
secretName:
697+
description: SecretName indicates the name of the secret containing
698+
the licensing token
699+
type: string
693700
type: object
694701
livenessProbe:
695702
description: NVIDIA Driver container liveness probe settings

config/crd/bases/nvidia.com_nvidiadrivers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,16 @@ spec:
234234
description: 'Optional: Licensing configuration for NVIDIA vGPU licensing'
235235
properties:
236236
name:
237+
description: 'Deprecated: ConfigMapName has been deprecated in
238+
favour of SecretName. Please use secrets to handle the licensing
239+
server configuration more securely'
237240
type: string
238241
nlsEnabled:
239242
description: NLSEnabled indicates if NVIDIA Licensing System is
240243
used for licensing.
241244
type: boolean
245+
secretName:
246+
type: string
242247
type: object
243248
livenessProbe:
244249
description: NVIDIA Driver container liveness probe settings

config/samples/nvidia_v1alpha1_nvidiadriver.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
name: ""
2727
# vGPU licensing configuration
2828
licensingConfig:
29-
name: ""
29+
secretName: ""
3030
nlsEnabled: true
3131
# vGPU topology daemon configuration
3232
virtualTopologyConfig:

config/samples/v1_clusterpolicy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ spec:
9090
name: ""
9191
# vGPU licensing configuration
9292
licensingConfig:
93-
configMapName: ""
93+
secretName: ""
9494
nlsEnabled: true
9595
# vGPU topology daemon configuration
9696
virtualTopology:

0 commit comments

Comments
 (0)