Skip to content

Commit e5b5bf1

Browse files
author
Joris ANDRADE
authored
Improve autoscaling configuration to support VPA & HPA and separates deployments (#48)
1 parent cb06625 commit e5b5bf1

File tree

10 files changed

+193
-84
lines changed

10 files changed

+193
-84
lines changed

README.md

Lines changed: 81 additions & 61 deletions
Large diffs are not rendered by default.

charts/langfuse/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: langfuse
3-
version: 0.9.0
3+
version: 0.10.0
44
description: Open source LLM engineering platform - LLM observability, metrics, evaluations, prompt management.
55
type: application
66
keywords:

charts/langfuse/templates/deployment-web.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
labels:
66
{{- include "langfuse.labels" . | nindent 4 }}
77
spec:
8-
{{- if not .Values.autoscaling.enabled }}
8+
{{- if not .Values.langfuse.web.hpa.enabled }}
99
replicas: {{ coalesce (.Values.langfuse.web).replicas .Values.replicaCount 1 }}
1010
{{- end }}
1111
selector:

charts/langfuse/templates/deployment-worker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
labels:
66
{{- include "langfuse.labels" . | nindent 4 }}
77
spec:
8-
{{- if not .Values.autoscaling.enabled }}
8+
{{- if not .Values.langfuse.worker.hpa.enabled }}
99
replicas: {{ coalesce (.Values.langfuse.worker).replicas .Values.replicaCount 1 }}
1010
{{- end }}
1111
selector:
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.autoscaling.enabled }}
1+
{{- if .Values.langfuse.web.hpa.enabled }}
22
apiVersion: autoscaling/v2
33
kind: HorizontalPodAutoscaler
44
metadata:
@@ -10,23 +10,23 @@ spec:
1010
apiVersion: apps/v1
1111
kind: Deployment
1212
name: {{ include "langfuse.fullname" . }}-web
13-
minReplicas: {{ .Values.autoscaling.minReplicas }}
14-
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
13+
minReplicas: {{ .Values.langfuse.web.hpa.minReplicas }}
14+
maxReplicas: {{ .Values.langfuse.web.hpa.maxReplicas }}
1515
metrics:
16-
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
16+
{{- with .Values.langfuse.web.hpa.targetCPUUtilizationPercentage }}
1717
- type: Resource
1818
resource:
1919
name: cpu
2020
target:
2121
type: Utilization
22-
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
22+
averageUtilization: {{ . }}
2323
{{- end }}
24-
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
24+
{{- with .Values.langfuse.web.hpa.targetMemoryUtilizationPercentage }}
2525
- type: Resource
2626
resource:
2727
name: memory
2828
target:
2929
type: Utilization
30-
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
30+
averageUtilization: {{ . }}
3131
{{- end }}
3232
{{- end }}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.autoscaling.enabled }}
1+
{{- if .Values.langfuse.worker.hpa.enabled }}
22
apiVersion: autoscaling/v2
33
kind: HorizontalPodAutoscaler
44
metadata:
@@ -10,23 +10,23 @@ spec:
1010
apiVersion: apps/v1
1111
kind: Deployment
1212
name: {{ include "langfuse.fullname" . }}-worker
13-
minReplicas: {{ .Values.autoscaling.minReplicas }}
14-
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
13+
minReplicas: {{ .Values.langfuse.worker.hpa.minReplicas }}
14+
maxReplicas: {{ .Values.langfuse.worker.hpa.maxReplicas }}
1515
metrics:
16-
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
16+
{{- with .Values.langfuse.worker.hpa.targetCPUUtilizationPercentage }}
1717
- type: Resource
1818
resource:
1919
name: cpu
2020
target:
2121
type: Utilization
22-
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
22+
averageUtilization: {{ . }}
2323
{{- end }}
24-
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
24+
{{- with .Values.langfuse.worker.hpa.targetMemoryUtilizationPercentage }}
2525
- type: Resource
2626
resource:
2727
name: memory
2828
target:
2929
type: Utilization
30-
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
30+
averageUtilization: {{ . }}
3131
{{- end }}
3232
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") .Values.langfuse.web.vpa.enabled }}
2+
apiVersion: autoscaling.k8s.io/v1
3+
kind: VerticalPodAutoscaler
4+
metadata:
5+
name: {{ include "langfuse.fullname" . }}-web
6+
labels:
7+
{{- include "langfuse.labels" . | nindent 4 }}
8+
spec:
9+
resourcePolicy:
10+
containerPolicies:
11+
- containerName: {{ .Chart.Name }}-web
12+
{{- with .Values.langfuse.web.vpa.controlledResources }}
13+
controlledResources:
14+
{{- toYaml . | nindent 8 }}
15+
{{- end }}
16+
{{- with .Values.langfuse.web.vpa.maxAllowed }}
17+
maxAllowed:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
{{- with .Values.langfuse.web.vpa.minAllowed }}
21+
minAllowed:
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
24+
targetRef:
25+
apiVersion: apps/v1
26+
kind: Deployment
27+
name: {{ include "langfuse.fullname" . }}-web
28+
{{- if .Values.langfuse.web.vpa.updatePolicy }}
29+
updatePolicy:
30+
{{- with .Values.langfuse.web.vpa.updatePolicy.updateMode }}
31+
updateMode: {{ . }}
32+
{{- end }}
33+
{{- end }}
34+
{{- end }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1") .Values.langfuse.worker.vpa.enabled }}
2+
apiVersion: autoscaling.k8s.io/v1
3+
kind: VerticalPodAutoscaler
4+
metadata:
5+
name: {{ include "langfuse.fullname" . }}-worker
6+
labels:
7+
{{- include "langfuse.labels" . | nindent 4 }}
8+
spec:
9+
resourcePolicy:
10+
containerPolicies:
11+
- containerName: {{ .Chart.Name }}-worker
12+
{{- with .Values.langfuse.worker.vpa.controlledResources }}
13+
controlledResources:
14+
{{- toYaml . | nindent 8 }}
15+
{{- end }}
16+
{{- with .Values.langfuse.worker.vpa.maxAllowed }}
17+
maxAllowed:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
{{- with .Values.langfuse.worker.vpa.minAllowed }}
21+
minAllowed:
22+
{{- toYaml . | nindent 8 }}
23+
{{- end }}
24+
targetRef:
25+
apiVersion: apps/v1
26+
kind: Deployment
27+
name: {{ include "langfuse.fullname" . }}-worker
28+
{{- if .Values.langfuse.worker.vpa.updatePolicy }}
29+
updatePolicy:
30+
{{- with .Values.langfuse.worker.vpa.updatePolicy.updateMode }}
31+
updateMode: {{ . }}
32+
{{- end }}
33+
{{- end }}
34+
{{- end }}

charts/langfuse/values.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,33 @@ langfuse:
2727
extraInitContainers: []
2828
extraVolumeMounts: []
2929

30+
web:
31+
hpa:
32+
enabled: false
33+
minReplicas: 1
34+
maxReplicas: 2
35+
targetCPUUtilizationPercentage: 50
36+
vpa:
37+
enabled: false
38+
controlledResources: []
39+
maxAllowed: {}
40+
minAllowed: {}
41+
updatePolicy:
42+
updateMode: Auto
43+
worker:
44+
hpa:
45+
enabled: false
46+
minReplicas: 1
47+
maxReplicas: 2
48+
targetCPUUtilizationPercentage: 50
49+
vpa:
50+
enabled: false
51+
controlledResources: []
52+
maxAllowed: {}
53+
minAllowed: {}
54+
updatePolicy:
55+
updateMode: Auto
56+
3057
additionalEnv:
3158
# REDIS
3259
- name: "REDIS_CONNECTION_STRING"
@@ -76,9 +103,6 @@ ingress:
76103

77104
resources: {}
78105

79-
autoscaling:
80-
enabled: false
81-
82106
nodeSelector: {}
83107

84108
tolerations: []

examples/values-example.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ ingress:
7373

7474
resources: {}
7575

76-
autoscaling:
77-
enabled: false
78-
7976
nodeSelector: {}
8077

8178
tolerations: []

0 commit comments

Comments
 (0)