@@ -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
0 commit comments