Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/langfuse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Open source LLM engineering platform - LLM observability, metrics, evaluations,
| langfuse.web.keda.triggerType | string | `"cpu"` | The trigger type for scaling (cpu or memory) |
| langfuse.web.keda.value | string | `"50"` | The target utilization percentage for the langfuse web pods |
| langfuse.web.livenessProbe.failureThreshold | int | `3` | Failure threshold for livenessProbe. |
| langfuse.web.livenessProbe.initialDelaySeconds | int | `20` | Initial delay seconds for livenessProbe. |
| langfuse.web.livenessProbe.initialDelaySeconds | int | `60` | Initial delay seconds for livenessProbe. |
| langfuse.web.livenessProbe.path | string | `"/api/public/health"` | Path to check for liveness. |
| langfuse.web.livenessProbe.periodSeconds | int | `10` | Period seconds for livenessProbe. |
| langfuse.web.livenessProbe.successThreshold | int | `1` | Success threshold for livenessProbe. |
Expand Down
23 changes: 20 additions & 3 deletions charts/langfuse/templates/web/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,27 @@ spec:
serviceAccountName: {{ include "langfuse.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.langfuse.podSecurityContext | nindent 8 }}
{{- if .Values.langfuse.extraInitContainers }}
initContainers:
- name: {{ .Chart.Name }}-web-init
securityContext:
{{- toYaml .Values.langfuse.securityContext | nindent 12 }}
image: "{{ .Values.langfuse.web.image.repository }}:{{ coalesce .Values.langfuse.web.image.tag .Values.langfuse.image.tag .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.langfuse.web.image.pullPolicy | default .Values.langfuse.image.pullPolicy }}
# Run the entrypoint script with a command that exits after initialization
args: ["echo", "Init completed successfully"]
env:
{{- include "langfuse.commonEnv" . | nindent 12 }}
{{- $additionalEnv := concat (.Values.langfuse.additionalEnv | default list ) (.Values.langfuse.web.pod.additionalEnv | default list )}}
{{- with $additionalEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.langfuse.extraVolumeMounts }}
volumeMounts:
{{- toYaml .Values.langfuse.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.langfuse.extraInitContainers }}
{{- toYaml .Values.langfuse.extraInitContainers | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.langfuse.extraVolumes }}
volumes:
{{- toYaml .Values.langfuse.extraVolumes | nindent 8 }}
Expand Down Expand Up @@ -87,7 +104,7 @@ spec:
httpGet:
path: {{ .Values.langfuse.web.livenessProbe.path | default "/api/public/health" }}
port: http
initialDelaySeconds: {{ .Values.langfuse.web.livenessProbe.initialDelaySeconds | default 20 }}
initialDelaySeconds: {{ .Values.langfuse.web.livenessProbe.initialDelaySeconds | default 60 }}
periodSeconds: {{ .Values.langfuse.web.livenessProbe.periodSeconds | default 10 }}
timeoutSeconds: {{ .Values.langfuse.web.livenessProbe.timeoutSeconds | default 5 }}
successThreshold: {{ .Values.langfuse.web.livenessProbe.successThreshold | default 1 }}
Expand Down
83 changes: 83 additions & 0 deletions charts/langfuse/tests/init-container_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
suite: test init container functionality
templates:
- web/deployment.yaml
tests:
- it: should have init container with correct configuration
values:
- ../values.lint.yaml
asserts:
# Test that web deployment has init containers
- hasDocuments:
count: 1
template: web/deployment.yaml
- isKind:
of: Deployment
template: web/deployment.yaml

# Test that init container exists
- exists:
path: spec.template.spec.initContainers
template: web/deployment.yaml

# Test init container count (should have at least 1)
- isNotEmpty:
path: spec.template.spec.initContainers
template: web/deployment.yaml

# Test init container name
- equal:
path: spec.template.spec.initContainers[0].name
value: langfuse-web-init
template: web/deployment.yaml

# Test init container uses same image as main container
- equal:
path: spec.template.spec.initContainers[0].image
value: "langfuse/langfuse:3.129.0"
template: web/deployment.yaml

# Test init container has args that runs initialization and exits
- equal:
path: spec.template.spec.initContainers[0].args
value: ["echo", "Init completed successfully"]
template: web/deployment.yaml

# Test init container has environment variables
- exists:
path: spec.template.spec.initContainers[0].env
template: web/deployment.yaml

# Test that NODE_ENV is set in init container
- contains:
path: spec.template.spec.initContainers[0].env
content:
name: NODE_ENV
value: "production"
template: web/deployment.yaml

- it: should preserve existing extraInitContainers functionality
values:
- ../values.lint.yaml
set:
langfuse.extraInitContainers:
- name: custom-init
image: busybox
command: ["echo", "custom init"]
asserts:
# Should have 2 init containers (our default + custom)
- lengthEqual:
path: spec.template.spec.initContainers
count: 2
template: web/deployment.yaml

# First should be our web-init container
- equal:
path: spec.template.spec.initContainers[0].name
value: langfuse-web-init
template: web/deployment.yaml

# Second should be the custom init container
- equal:
path: spec.template.spec.initContainers[1].name
value: custom-init
template: web/deployment.yaml
2 changes: 1 addition & 1 deletion charts/langfuse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ langfuse:
# -- Path to check for liveness.
path: "/api/public/health"
# -- Initial delay seconds for livenessProbe.
initialDelaySeconds: 20
initialDelaySeconds: 60
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary if an init container is in place? My understanding is that the health check would only start once the main container in the pod becomes active.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what I thought as well! :)

But unfortunately the main container is still talking longer than 20s to spin up and become ready to serve the health api. Maybe because it's still running the entrypoint script

# -- Period seconds for livenessProbe.
periodSeconds: 10
# -- Timeout seconds for livenessProbe.
Expand Down