Skip to content

Commit 938c131

Browse files
committed
Make .spec.authSecret in NemoGuardRail optional
Signed-off-by: Sheng Lin <shelin@nvidia.com>
1 parent 7c847d0 commit 938c131

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

api/apps/v1alpha1/nemo_guardrails_types.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ type NemoGuardrailSpec struct {
5959
Command []string `json:"command,omitempty"`
6060
Args []string `json:"args,omitempty"`
6161
Env []corev1.EnvVar `json:"env,omitempty"`
62-
// The name of an secret that contains authn for the NGC NIM service API
63-
AuthSecret string `json:"authSecret"`
62+
// The name of an secret that contains authn for the NGC NIM service API, required when the NIM is hosted by NGC
63+
AuthSecret string `json:"authSecret,omitempty"`
6464
// ConfigStore stores the config of the guardrail service
6565
ConfigStore GuardrailConfig `json:"configStore,omitempty"`
6666
Labels map[string]string `json:"labels,omitempty"`
@@ -197,7 +197,10 @@ func (n *NemoGuardrail) GetStandardEnv() []corev1.EnvVar {
197197
Name: "DEMO",
198198
Value: "False",
199199
},
200-
{
200+
}
201+
202+
if len(n.Spec.AuthSecret) > 0 {
203+
envVars = append(envVars, corev1.EnvVar{
201204
Name: "NIM_ENDPOINT_API_KEY",
202205
ValueFrom: &corev1.EnvVarSource{
203206
SecretKeyRef: &corev1.SecretKeySelector{
@@ -207,9 +210,8 @@ func (n *NemoGuardrail) GetStandardEnv() []corev1.EnvVar {
207210
},
208211
},
209212
},
210-
},
213+
})
211214
}
212-
213215
return envVars
214216
}
215217

bundle/manifests/apps.nvidia.com_nemoguardrails.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
type: array
5858
authSecret:
5959
description: The name of an secret that contains authn for the NGC
60-
NIM service API
60+
NIM service API, required when the NIM is hosted by NGC
6161
type: string
6262
command:
6363
items:
@@ -2143,7 +2143,6 @@ spec:
21432143
format: int64
21442144
type: integer
21452145
required:
2146-
- authSecret
21472146
- image
21482147
type: object
21492148
status:

config/crd/bases/apps.nvidia.com_nemoguardrails.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
type: array
5858
authSecret:
5959
description: The name of an secret that contains authn for the NGC
60-
NIM service API
60+
NIM service API, required when the NIM is hosted by NGC
6161
type: string
6262
command:
6363
items:
@@ -2143,7 +2143,6 @@ spec:
21432143
format: int64
21442144
type: integer
21452145
required:
2146-
- authSecret
21472146
- image
21482147
type: object
21492148
status:

deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nemoguardrails.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
type: array
5858
authSecret:
5959
description: The name of an secret that contains authn for the NGC
60-
NIM service API
60+
NIM service API, required when the NIM is hosted by NGC
6161
type: string
6262
command:
6363
items:
@@ -2143,7 +2143,6 @@ spec:
21432143
format: int64
21442144
type: integer
21452145
required:
2146-
- authSecret
21472146
- image
21482147
type: object
21492148
status:

0 commit comments

Comments
 (0)