Skip to content

Commit a85fcfd

Browse files
authored
fix: disable ngpu mode by default (#398)
* fix: disable ngpu mode by default * chore: lint
1 parent 40e5040 commit a85fcfd

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

internal/constants/env.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const (
1616

1717
NvidiaOperatorProgressiveMigrationEnv = "NVIDIA_OPERATOR_PROGRESSIVE_MIGRATION"
1818
RunHypervisorUtilGPUAllocatable = "RUN_HYPERVISOR_UTIL_GPU_ALLOCATABLE"
19+
20+
UsingCommercialComponentEnv = "COMMERCIAL_PLAN"
1921
)
2022

2123
// General envs used in compose components manifest

internal/utils/compose.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,15 @@ func AddTFDefaultClientConfBeforePatch(
338338
}, v1.EnvVar{
339339
Name: constants.HypervisorPortEnv,
340340
Value: strconv.Itoa(int(getHypervisorPortNumber(pool.Spec.ComponentConfig.Hypervisor))),
341-
}, v1.EnvVar{
342-
Name: constants.NGPUPathEnv,
343-
Value: constants.NGPUPathValue,
344341
})
345342

343+
if IsLicensed() {
344+
envList = append(envList, v1.EnvVar{
345+
Name: constants.NGPUPathEnv,
346+
Value: constants.NGPUPathValue,
347+
})
348+
}
349+
346350
// disable GPU limiter killer switch
347351
if pod.Annotations[constants.DisableFeaturesAnnotation] != "" {
348352
envList = convertDisabledFeaturesToEnvs(pod.Annotations[constants.DisableFeaturesAnnotation], envList)

internal/utils/config.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,19 @@ func GetSelfServiceAccountNameShort() string {
166166
return parts[len(parts)-1]
167167
}
168168

169-
var nvidiaOperatorProgressiveMigrationEnv = os.Getenv(constants.NvidiaOperatorProgressiveMigrationEnv) == "true"
169+
var nvidiaOperatorProgressiveMigrationEnv = os.Getenv(constants.NvidiaOperatorProgressiveMigrationEnv) == constants.TrueStringValue
170+
171+
var isLicensedEnv = os.Getenv(constants.UsingCommercialComponentEnv) == constants.TrueStringValue
172+
173+
func init() {
174+
if isLicensedEnv {
175+
ctrl.Log.Info("Enabling none open source components, please make sure you are in trial stage or have bought commercial license. Contact us: [email protected]")
176+
}
177+
}
178+
179+
func IsLicensed() bool {
180+
return isLicensedEnv
181+
}
170182

171183
func IsProgressiveMigration() bool {
172184
return nvidiaOperatorProgressiveMigrationEnv

0 commit comments

Comments
 (0)