@@ -57,8 +57,8 @@ type NemoGuardrailSpec struct {
5757 Command []string `json:"command,omitempty"`
5858 Args []string `json:"args,omitempty"`
5959 Env []corev1.EnvVar `json:"env,omitempty"`
60- // The name of an secret that contains authn for the NGC NIM service API
61- AuthSecret string `json:"authSecret"`
60+ // The name of an secret that contains authn for the NGC NIM service API, required when the NIM is hosted by NGC
61+ AuthSecret * string `json:"authSecret,omitempty "`
6262 // ConfigStore stores the config of the guardrail service
6363 ConfigStore GuardrailConfig `json:"configStore,omitempty"`
6464 Labels map [string ]string `json:"labels,omitempty"`
@@ -187,19 +187,21 @@ func (n *NemoGuardrail) GetStandardEnv() []corev1.EnvVar {
187187 Name : "DEMO" ,
188188 Value : "False" ,
189189 },
190- {
190+ }
191+
192+ if n .Spec .AuthSecret != nil && len (* n .Spec .AuthSecret ) > 0 {
193+ envVars = append (envVars , corev1.EnvVar {
191194 Name : "NIM_ENDPOINT_API_KEY" ,
192195 ValueFrom : & corev1.EnvVarSource {
193196 SecretKeyRef : & corev1.SecretKeySelector {
194197 Key : "nim-endpoint-api-key" ,
195198 LocalObjectReference : corev1.LocalObjectReference {
196- Name : n .Spec .AuthSecret ,
199+ Name : * n .Spec .AuthSecret ,
197200 },
198201 },
199202 },
200- },
203+ })
201204 }
202-
203205 return envVars
204206}
205207
0 commit comments