-
Notifications
You must be signed in to change notification settings - Fork 127
Description
Describe the bug
📋 Summary
When installing the Langfuse Helm chart using Terraform's helm_release resource, the web and worker deployments (and other resources) are deployed in the default namespace instead of the specified release namespace, despite setting the namespace parameter in the helm_release resource.
🏷️ Issue Type
- Type: Bug
- Severity: High
- Component: Helm Chart Templates
- Affects: Terraform
helm_releaseusers
🔧 Environment
- Chart Version: 1.5.8
- Terraform Version: 1.13.4
- Helm Provider Version: 3.0.0-pre2
- Kubernetes Version: 1.13.1
📝 Description
The Langfuse Helm chart templates are missing explicit namespace fields in their metadata sections. This causes resources to be deployed in the default namespace when using Terraform's helm_release resource, regardless of the namespace parameter specified in the Terraform configuration.
🔍 Root Cause Analysis
The issue occurs because:
- Terraform
helm_releasebehavior: Thenamespaceparameter inhelm_releaseonly affects resources that explicitly reference{{ .Release.Namespace }}in their templates - Missing namespace in templates: The Langfuse chart templates don't include
namespace: {{ .Release.Namespace }}in their metadata - Kubectl context fallback: When templates lack explicit namespace, Kubernetes deploys resources in the current kubectl context namespace (typically
default)
📁 Affected Files
The following templates are missing namespace: {{ .Release.Namespace }} in their metadata:
| File | Resource Type | Status |
|---|---|---|
templates/web/deployment.yaml |
Web Deployment | ❌ Missing namespace |
templates/worker/deployment.yaml |
Worker Deployment | ❌ Missing namespace |
templates/web/service.yaml |
Web Service | ❌ Missing namespace |
templates/serviceaccount.yaml |
ServiceAccount | ❌ Missing namespace |
templates/ingress.yaml |
Ingress | ❌ Missing namespace |
🔧 Current Template Structure (Problematic)
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "langfuse.fullname" . }}-web
labels:
# ... labels✅ Proposed Fix
Add namespace: {{ .Release.Namespace }} to the metadata section of all affected templates:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "langfuse.fullname" . }}-web
namespace: {{ .Release.Namespace }}
labels:
# ... labels🎯 Impact Assessment
High Impact Areas:
- Infrastructure as Code: Breaks namespace-based infrastructure management
- CI/CD Pipelines: Causes deployment failures in namespace-restricted environments
- Multi-environment deployments: Resources end up in wrong namespaces
- Resource management: Terraform state becomes inconsistent with actual resource locations
Affected Users:
- Terraform users deploying Langfuse via
helm_release - CI/CD pipelines using Terraform for infrastructure management
- Multi-tenant environments with namespace isolation requirements
🔄 Workaround
Users must manually modify the chart templates or use kubectl context switching, which defeats the purpose of using Terraform for infrastructure management.
📊 Additional Context
- This issue is specific to Terraform
helm_releaseusage - When installing the chart directly with
helm install, the behavior may differ depending on the kubectl context - The sub-charts (postgresql, clickhouse, redis, s3) correctly support
namespaceOverrideconfiguration - The main chart templates lack explicit namespace handling
To reproduce
🚀 Steps to Reproduce
- Create a Terraform configuration:
resource "helm_release" "langfuse" {
name = "langfuse"
namespace = "langfuse"
repository = "https://langfuse.github.io/langfuse-k8s"
chart = "langfuse"
version = "1.5.8"
}- Apply the configuration:
terraform apply- Check pod locations:
kubectl get pods --all-namespaces | grep langfuse✅ Expected Behavior
All Langfuse resources should be deployed in the langfuse namespace as specified in the helm_release resource.
❌ Actual Behavior
Web and worker pods are deployed in the default namespace, while the helm_release resource shows as deployed in the langfuse namespace.
Chart version and values.yaml configuration
Terraform resource snippet
resource "helm_release" "langfuse" {
name = "langfuse"
namespace = kubernetes_namespace.langfuse.metadata[0].name
create_namespace = false
description = "Langfuse LLM Observability Platform"
repository = "https://langfuse.github.io/langfuse-k8s"
chart = "langfuse"
version = "1.5.8"
timeout = 600 # 10 minutes timeout
depends_on = [
kubernetes_namespace.neuraverse,
kubernetes_secret.langfuse_postgres_secret,
kubernetes_secret.langfuse_s3_secret
]
values = [
yamlencode({
# Global configuration
global = {
security = {
allowInsecureImages = true
}
}
# Langfuse core configuration
langfuse = {
salt = {
secretKeyRef = {
name = "langfuse-configs"
key = "SALT_KEY"
}
}
nextauth = {
secret = {
secretKeyRef = {
name = "langfuse-configs"
key = "NEXT_AUTH_SECRET"
}
}
}
}
# Redis configuration
redis = {
auth = {
password = "langfuse-redis-secret"
}
}
# ClickHouse configuration
clickhouse = {
auth = {
password = "langfuse-clickhouse-secret"
}
}
})
]
}
Kubernetes Status
No response
Logs
No response
Additional information
No response
Are you interested to contribute a fix for this bug?
Yes