Skip to content

Commit 717b42b

Browse files
Addressing review comments
Signed-off-by: Vishesh Tanksale <[email protected]>
1 parent 2bd8448 commit 717b42b

File tree

8 files changed

+848
-14
lines changed

8 files changed

+848
-14
lines changed

api/apps/v1alpha1/common_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const (
3636
DefaultNamedPortGRPC = "grpc"
3737
// DefaultNamedPortMetrics is the default name for metrics port.
3838
DefaultNamedPortMetrics = "metrics"
39+
// NGCAPIKey is the environment variable name for NGC API key.
40+
NGCAPIKey = "NGC_API_KEY"
41+
// HFToken is the environment variable name for Hugging Face token.
42+
HFToken = "HF_TOKEN"
3943
)
4044

4145
// Expose defines attributes to expose the service.

api/apps/v1alpha1/nimcache_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (n *NIMCache) IsUniversalNIM() bool {
332332
}
333333

334334
// IsHFMultiLLM returns true if the NIMCache is for a Hugging Face Multi-LLM NIM.
335-
func (n *NIMCache) IsHFMultiLLM() bool {
335+
func (n *NIMCache) IsHFModel() bool {
336336
return n.Spec.Source.HF != nil
337337
}
338338

api/apps/v1alpha1/nimservice_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ func (n *NIMService) GetStandardEnv() []corev1.EnvVar {
284284
Value: utils.DefaultModelStorePath,
285285
},
286286
{
287-
Name: "NGC_API_KEY",
287+
Name: NGCAPIKey,
288288
ValueFrom: &corev1.EnvVarSource{
289289
SecretKeyRef: &corev1.SecretKeySelector{
290290
LocalObjectReference: corev1.LocalObjectReference{
291291
Name: n.Spec.AuthSecret,
292292
},
293-
Key: "NGC_API_KEY",
293+
Key: NGCAPIKey,
294294
},
295295
},
296296
},
@@ -984,7 +984,7 @@ func (n *NIMService) IsHTTPRouteEnabled() bool {
984984
return n.Spec.Router.Gateway != nil && n.Spec.Router.Gateway.HTTPRoutesEnabled
985985
}
986986

987-
func (n *NIMService) IsHFMultiLLM() bool {
987+
func (n *NIMService) IsHFModel() bool {
988988
env := utils.FindEnvByValue(n.GetEnv(), "NIM_MODEL_NAME")
989989
if env != nil {
990990
if strings.HasPrefix(env.Value, "hf://") {

internal/controller/nimbuild_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,13 +642,13 @@ func (r *NIMBuildReconciler) constructEngineBuildPod(nimBuild *appsv1alpha1.NIMB
642642
Value: inputNimProfile.Name,
643643
},
644644
{
645-
Name: "NGC_API_KEY",
645+
Name: appsv1alpha1.NGCAPIKey,
646646
ValueFrom: &corev1.EnvVarSource{
647647
SecretKeyRef: &corev1.SecretKeySelector{
648648
LocalObjectReference: corev1.LocalObjectReference{
649649
Name: nimCache.Spec.Source.NGC.AuthSecret,
650650
},
651-
Key: "NGC_API_KEY",
651+
Key: appsv1alpha1.NGCAPIKey,
652652
},
653653
},
654654
},

internal/controller/platform/kserve/nimservice.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,17 +478,17 @@ func (r *NIMServiceReconciler) renderAndSyncInferenceService(ctx context.Context
478478
}, isvcParams.Env)
479479
}
480480
// If NIMCache or NIMService is a Hugging Face Multi-LLM NIM, add the HF_TOKEN to the environment variables
481-
if nimCache.IsHFMultiLLM() || nimService.IsHFMultiLLM() {
482-
isvcParams.Env = utils.RemoveEnvVar(isvcParams.Env, "NGC_API_KEY")
481+
if nimCache.IsHFModel() || nimService.IsHFModel() {
482+
isvcParams.Env = utils.RemoveEnvVar(isvcParams.Env, appsv1alpha1.NGCAPIKey)
483483
isvcParams.Env = utils.MergeEnvVars(isvcParams.Env, []corev1.EnvVar{
484484
{
485-
Name: "HF_TOKEN",
485+
Name: appsv1alpha1.HFToken,
486486
ValueFrom: &corev1.EnvVarSource{
487487
SecretKeyRef: &corev1.SecretKeySelector{
488488
LocalObjectReference: corev1.LocalObjectReference{
489489
Name: nimService.Spec.AuthSecret,
490490
},
491-
Key: "HF_TOKEN",
491+
Key: appsv1alpha1.HFToken,
492492
},
493493
},
494494
},

0 commit comments

Comments
 (0)