From 7bd78a0930e22e06b1531d32f036eebf8812f0d4 Mon Sep 17 00:00:00 2001 From: Adam Hendel Date: Tue, 5 Nov 2024 17:33:44 -0600 Subject: [PATCH] add env var to appServices --- tembo-operator/src/app_service/manager.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tembo-operator/src/app_service/manager.rs b/tembo-operator/src/app_service/manager.rs index cd227c0a8..3ffbbcfb5 100644 --- a/tembo-operator/src/app_service/manager.rs +++ b/tembo-operator/src/app_service/manager.rs @@ -434,6 +434,7 @@ fn generate_deployment( let has_instance_id = env_vars.iter().any(|env| env.name == "TEMBO_INSTANCE_ID"); let has_org_id = env_vars.iter().any(|env| env.name == "TEMBO_ORG_ID"); + let has_namespace = env_vars.iter().any(|env| env.name == "NAMESPACE"); // Check for tembo.io/instance_id and tembo.io/organization_id annotations if has_instance_id.not() { @@ -460,6 +461,16 @@ fn generate_deployment( tracing::info!("Not applying TEMBO_ORG_ID to env since it's already present"); } + if has_namespace.not() { + env_vars.push(EnvVar { + name: "NAMESPACE".to_string(), + value: Some(namespace.to_string()), + ..EnvVar::default() + }); + } else { + tracing::info!("Not applying NAMESPACE to env since it's already present"); + } + // Add the pre-loaded forwarded environment variables env_vars.extend(FORWARDED_ENV_VARS.iter().cloned());