@@ -313,13 +313,13 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
313313
314314 // Hardcoded secret names (convention over configuration)
315315 const runnerSecretsName = "ambient-runner-secrets" // ANTHROPIC_API_KEY only (ignored when Vertex enabled)
316- const integrationSecretsName = "ambient-non-vertex-integrations" // GIT_*, JIRA_*, LANGFUSE_*, OTEL_*, custom keys (optional)
316+ const integrationSecretsName = "ambient-non-vertex-integrations" // GIT_*, JIRA_*, custom keys (optional, NO Langfuse keys )
317317
318- // Check if integration secrets exist (includes observability keys: LANGFUSE_*, OTEL_ *)
318+ // Check if integration secrets exist (user-provided integrations like GIT_TOKEN, JIRA_ *)
319319 integrationSecretsExist := false
320320 if _ , err := config .K8sClient .CoreV1 ().Secrets (sessionNamespace ).Get (context .TODO (), integrationSecretsName , v1.GetOptions {}); err == nil {
321321 integrationSecretsExist = true
322- log .Printf ("Found %s secret in %s, will inject as env vars (includes observability keys) " , integrationSecretsName , sessionNamespace )
322+ log .Printf ("Found %s secret in %s, will inject as env vars" , integrationSecretsName , sessionNamespace )
323323 } else if ! errors .IsNotFound (err ) {
324324 log .Printf ("Error checking for %s secret in %s: %v" , integrationSecretsName , sessionNamespace , err )
325325 } else {
@@ -503,23 +503,8 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
503503 base = append (base , corev1.EnvVar {Name : "USER_NAME" , Value : userName })
504504 }
505505
506- // Inject platform-wide Langfuse observability configuration from operator's environment
507- if langfusePublicKey := os .Getenv ("LANGFUSE_PUBLIC_KEY" ); langfusePublicKey != "" {
508- base = append (base , corev1.EnvVar {Name : "LANGFUSE_PUBLIC_KEY" , Value : langfusePublicKey })
509- }
510- if langfuseSecretKey := os .Getenv ("LANGFUSE_SECRET_KEY" ); langfuseSecretKey != "" {
511- base = append (base , corev1.EnvVar {Name : "LANGFUSE_SECRET_KEY" , Value : langfuseSecretKey })
512- }
513- if langfuseHost := os .Getenv ("LANGFUSE_HOST" ); langfuseHost != "" {
514- base = append (base , corev1.EnvVar {Name : "LANGFUSE_HOST" , Value : langfuseHost })
515- }
516- // Enable Langfuse by default if keys are configured
517- if langfuseEnabled := os .Getenv ("LANGFUSE_ENABLED" ); langfuseEnabled != "" {
518- base = append (base , corev1.EnvVar {Name : "LANGFUSE_ENABLED" , Value : langfuseEnabled })
519- } else if os .Getenv ("LANGFUSE_PUBLIC_KEY" ) != "" && os .Getenv ("LANGFUSE_SECRET_KEY" ) != "" {
520- base = append (base , corev1.EnvVar {Name : "LANGFUSE_ENABLED" , Value : "true" })
521- log .Printf ("Auto-enabled Langfuse for session %s (keys configured at platform level)" , name )
522- }
506+ // Note: Platform-wide Langfuse observability is configured via ambient-langfuse-keys secret
507+ // injected below in EnvFrom. LANGFUSE_* env vars should NOT be set here.
523508
524509 // Add Vertex AI configuration only if enabled
525510 if vertexEnabled {
@@ -625,10 +610,9 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
625610 }(),
626611
627612 // Import secrets as environment variables
628- // - integrationSecretsName: Only if exists (GIT_TOKEN, JIRA_*, custom keys)
613+ // - integrationSecretsName: Only if exists (GIT_TOKEN, JIRA_*, custom keys - NO Langfuse keys )
629614 // - runnerSecretsName: Only when Vertex disabled (ANTHROPIC_API_KEY)
630- // - langfuseKeysSecretName: Only if exists (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY)
631- // - langfuseConfigMapName: Only if exists (LANGFUSE_HOST, LANGFUSE_ENABLED)
615+ // - ambient-langfuse-keys: Platform-wide Langfuse observability (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_HOST, LANGFUSE_ENABLED)
632616 EnvFrom : func () []corev1.EnvFromSource {
633617 sources := []corev1.EnvFromSource {}
634618
@@ -656,8 +640,15 @@ func handleAgenticSessionEvent(obj *unstructured.Unstructured) error {
656640 log .Printf ("Skipping runner secrets '%s' for session %s (Vertex enabled)" , runnerSecretsName , name )
657641 }
658642
659- // Note: Observability keys (LANGFUSE_*, OTEL_*) are now in ambient-non-vertex-integrations
660- // No separate secrets/configmaps needed
643+ // Inject platform-wide Langfuse observability keys (optional, marked as optional in secret)
644+ // This secret is created at deployment time in the operator's namespace
645+ sources = append (sources , corev1.EnvFromSource {
646+ SecretRef : & corev1.SecretEnvSource {
647+ LocalObjectReference : corev1.LocalObjectReference {Name : "ambient-langfuse-keys" },
648+ Optional : boolPtr (true ), // Optional: only needed if Langfuse enabled
649+ },
650+ })
651+ log .Printf ("Injecting Langfuse observability keys from 'ambient-langfuse-keys' for session %s (optional)" , name )
661652
662653 return sources
663654 }(),
0 commit comments