Skip to content

Commit b355735

Browse files
Infra/add queue mode lg cloud (#234)
* feat: add queue split * feat: add queue split * feat: add queue split * feat: add queue split --------- Co-authored-by: infra <[email protected]>
1 parent 506544d commit b355735

10 files changed

+289
-3
lines changed

charts/langgraph-cloud/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ maintainers:
55
66
description: Helm chart to deploy the LangGraph Cloud application and all services it depends on.
77
type: application
8-
version: 0.1.8
8+
version: 0.1.9
99
appVersion: "0.2.0"

charts/langgraph-cloud/README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# langgraph-cloud
22

3-
![Version: 0.1.8](https://img.shields.io/badge/Version-0.1.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.0](https://img.shields.io/badge/AppVersion-0.2.0-informational?style=flat-square)
3+
![Version: 0.1.9](https://img.shields.io/badge/Version-0.1.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.0](https://img.shields.io/badge/AppVersion-0.2.0-informational?style=flat-square)
44

55
Helm chart to deploy the LangGraph Cloud application and all services it depends on.
66

@@ -216,6 +216,33 @@ the same format as the secret in the corresponding `secrets.yaml` file. Note: AP
216216
| ingress.studioHostname | string | `""` | |
217217
| ingress.tls | list | `[]` | |
218218
| nameOverride | string | `""` | Provide a name in place of `langgraph-cloud` for the chart |
219+
| queue.autoscaling.enabled | bool | `false` | |
220+
| queue.autoscaling.maxReplicas | int | `5` | |
221+
| queue.autoscaling.minReplicas | int | `1` | |
222+
| queue.autoscaling.targetCPUUtilizationPercentage | int | `80` | |
223+
| queue.containerPort | int | `8000` | |
224+
| queue.deployment.affinity | object | `{}` | |
225+
| queue.deployment.annotations | object | `{}` | |
226+
| queue.deployment.extraEnv | list | `[]` | |
227+
| queue.deployment.labels | object | `{}` | |
228+
| queue.deployment.nodeSelector | object | `{}` | |
229+
| queue.deployment.podSecurityContext | object | `{}` | |
230+
| queue.deployment.replicaCount | int | `1` | |
231+
| queue.deployment.resources.limits.cpu | string | `"2000m"` | |
232+
| queue.deployment.resources.limits.memory | string | `"4Gi"` | |
233+
| queue.deployment.resources.requests.cpu | string | `"1000m"` | |
234+
| queue.deployment.resources.requests.memory | string | `"2Gi"` | |
235+
| queue.deployment.securityContext | object | `{}` | |
236+
| queue.deployment.sidecars | list | `[]` | |
237+
| queue.deployment.tolerations | list | `[]` | |
238+
| queue.deployment.volumeMounts | list | `[]` | |
239+
| queue.deployment.volumes | list | `[]` | |
240+
| queue.enabled | bool | `false` | |
241+
| queue.name | string | `"queue"` | |
242+
| queue.serviceAccount.annotations | object | `{}` | |
243+
| queue.serviceAccount.create | bool | `true` | |
244+
| queue.serviceAccount.labels | object | `{}` | |
245+
| queue.serviceAccount.name | string | `""` | |
219246
| redis.containerPort | int | `6379` | |
220247
| redis.deployment.affinity | object | `{}` | |
221248
| redis.deployment.annotations | object | `{}` | |
@@ -311,6 +338,7 @@ the same format as the secret in the corresponding `secrets.yaml` file. Note: AP
311338
| config.auth.langSmithTenantId | string | `""` | |
312339
| config.existingSecretName | string | `""` | |
313340
| config.langGraphCloudLicenseKey | string | `""` | |
341+
| config.numberOfJobsPerWorker | int | `10` | |
314342

315343
## Api Server
316344

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Lightweight configuration. Only use this if you are running Langsmith in a development environment.
2+
config:
3+
langGraphCloudLicenseKey: "YOUR_LICENSE_KEY"
4+
5+
apiServer:
6+
deployment:
7+
resources:
8+
requests:
9+
cpu: 100m
10+
memory: 500Mi
11+
12+
queue:
13+
enabled: true
14+
deployment:
15+
resources:
16+
requests:
17+
cpu: 100m
18+
memory: 500Mi
19+
20+
postgres:
21+
statefulSet:
22+
resources:
23+
requests:
24+
cpu: 500m
25+
memory: 1000Mi

charts/langgraph-cloud/templates/_helpers.tpl

+8
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ the user or some other secret provisioning mechanism
112112
{{- end -}}
113113
{{- end -}}
114114

115+
{{- define "queue.serviceAccountName" -}}
116+
{{- if .Values.queue.serviceAccount.create -}}
117+
{{ default (printf "%s-%s" (include "langGraphCloud.fullname" .) .Values.queue.name) .Values.queue.serviceAccount.name | trunc 63 | trimSuffix "-" }}
118+
{{- else -}}
119+
{{ default "default" .Values.queue.serviceAccount.name }}
120+
{{- end -}}
121+
{{- end -}}
122+
115123
{{- define "postgres.serviceAccountName" -}}
116124
{{- if .Values.postgres.serviceAccount.create -}}
117125
{{ default (printf "%s-%s" (include "langGraphCloud.fullname" .) .Values.postgres.name) .Values.postgres.serviceAccount.name | trunc 63 | trimSuffix "-" }}

charts/langgraph-cloud/templates/api-server/deployment.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ spec:
6060
secretKeyRef:
6161
name: {{ include "langGraphCloud.secretsName" . }}
6262
key: langgraph_cloud_license_key
63+
{{- if .Values.queue.enabled }}
64+
- name: N_JOBS_PER_WORKER
65+
value: "0"
66+
{{- else }}
67+
- name: N_JOBS_PER_WORKER
68+
value: {{ .Values.config.numberOfJobsPerWorker | quote }}
69+
{{- end }}
6370
{{- if .Values.config.auth.enabled }}
6471
- name: LANGGRAPH_AUTH_TYPE
6572
value: "langsmith"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{{- if .Values.queue.enabled -}}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "langGraphCloud.fullname" . }}-{{ .Values.queue.name }}
6+
labels:
7+
{{- include "langGraphCloud.labels" . | nindent 4 }}
8+
{{- with.Values.queue.deployment.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
annotations:
12+
{{- include "langGraphCloud.annotations" . | nindent 4 }}
13+
{{- with.Values.queue.deployment.annotations }}
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
{{- if not .Values.queue.autoscaling.enabled }}
18+
replicas: {{ .Values.queue.deployment.replicaCount }}
19+
{{- end }}
20+
selector:
21+
matchLabels:
22+
{{- include "langGraphCloud.selectorLabels" . | nindent 6 }}
23+
app.kubernetes.io/component: {{ include "langGraphCloud.fullname" . }}-{{ .Values.queue.name }}
24+
template:
25+
metadata:
26+
{{- with .Values.queue.deployment.annotations }}
27+
annotations:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
labels:
31+
{{- with.Values.queue.deployment.labels }}
32+
{{- toYaml . | nindent 8 }}
33+
{{- end }}
34+
{{- include "langGraphCloud.labels" . | nindent 8 }}
35+
app.kubernetes.io/component: {{ include "langGraphCloud.fullname" . }}-{{ .Values.queue.name }}
36+
spec:
37+
serviceAccountName: {{ include "queue.serviceAccountName" . }}
38+
{{- with .Values.images.imagePullSecrets }}
39+
imagePullSecrets:
40+
{{- toYaml . | nindent 8 }}
41+
{{- end }}
42+
securityContext:
43+
{{- toYaml .Values.queue.deployment.podSecurityContext | nindent 8 }}
44+
containers:
45+
- name: {{ .Values.queue.name }}
46+
command:
47+
- "python"
48+
- "-m"
49+
- "langgraph_api.queue_entrypoint"
50+
env:
51+
- name: PORT
52+
value: {{ .Values.queue.containerPort | quote }}
53+
- name: POSTGRES_URI
54+
valueFrom:
55+
secretKeyRef:
56+
name: {{ include "langGraphCloud.postgresSecretsName" . }}
57+
key: postgres_connection_url
58+
- name: REDIS_URI
59+
valueFrom:
60+
secretKeyRef:
61+
name: {{ include "langGraphCloud.redisSecretsName" . }}
62+
key: redis_connection_url
63+
- name: LANGGRAPH_CLOUD_LICENSE_KEY
64+
valueFrom:
65+
secretKeyRef:
66+
name: {{ include "langGraphCloud.secretsName" . }}
67+
key: langgraph_cloud_license_key
68+
{{- if .Values.config.auth.enabled }}
69+
- name: LANGGRAPH_AUTH_TYPE
70+
value: "langsmith"
71+
- name: LANGSMITH_AUTH_ENDPOINT
72+
value: {{ .Values.config.auth.langSmithAuthEndpoint }}
73+
- name: LANGSMITH_TENANT_ID
74+
value: {{ .Values.config.auth.langSmithTenantId }}
75+
- name: N_JOBS_PER_WORKER
76+
value: {{ .Values.config.numberOfJobsPerWorker | quote }}
77+
{{- end }}
78+
{{- with .Values.queue.deployment.extraEnv }}
79+
{{- toYaml . | nindent 12 }}
80+
{{- end }}
81+
image: "{{ .Values.images.apiServerImage.repository }}:{{ .Values.images.apiServerImage.tag | default .Chart.AppVersion }}"
82+
imagePullPolicy: {{ .Values.images.apiServerImage.pullPolicy }}
83+
ports:
84+
- name: queue
85+
containerPort: {{ .Values.queue.containerPort }}
86+
protocol: TCP
87+
startupProbe:
88+
httpGet:
89+
port: {{ .Values.queue.containerPort }}
90+
path: "/ok"
91+
failureThreshold: 6
92+
periodSeconds: 10
93+
timeoutSeconds: 1
94+
readinessProbe:
95+
httpGet:
96+
port: {{ .Values.queue.containerPort }}
97+
path: "/ok"
98+
failureThreshold: 6
99+
periodSeconds: 10
100+
timeoutSeconds: 1
101+
livenessProbe:
102+
httpGet:
103+
port: {{ .Values.queue.containerPort }}
104+
path: "/ok"
105+
failureThreshold: 6
106+
periodSeconds: 10
107+
timeoutSeconds: 1
108+
resources:
109+
{{- toYaml .Values.queue.deployment.resources | nindent 12 }}
110+
securityContext:
111+
{{- toYaml .Values.queue.deployment.securityContext | nindent 12 }}
112+
{{- with .Values.queue.deployment.volumeMounts }}
113+
volumeMounts:
114+
{{- toYaml . | nindent 12 }}
115+
{{- end }}
116+
{{- with .Values.queue.deployment.sidecars }}
117+
{{- toYaml . | nindent 8 }}
118+
{{- end }}
119+
{{- with .Values.queue.deployment.nodeSelector }}
120+
nodeSelector:
121+
{{- toYaml . | nindent 8 }}
122+
{{- end }}
123+
{{- with .Values.queue.deployment.affinity }}
124+
affinity:
125+
{{- toYaml . | nindent 8 }}
126+
{{- end }}
127+
{{- with .Values.queue.deployment.tolerations }}
128+
tolerations:
129+
{{- toYaml . | nindent 8 }}
130+
{{- end }}
131+
{{- with .Values.queue.deployment.volumes }}
132+
volumes:
133+
{{- toYaml . | nindent 8 }}
134+
{{- end }}
135+
{{- end}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.apiServer.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "langGraphCloud.fullname" . }}-{{ .Values.apiServer.name }}
6+
labels:
7+
{{- include "langGraphCloud.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "langGraphCloud.fullname" . }}-{{ .Values.apiServer.name }}
13+
minReplicas: {{ .Values.apiServer.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.apiServer.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.apiServer.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
target:
21+
type: Utilization
22+
averageUtilization: {{ .Values.apiServer.autoscaling.targetCPUUtilizationPercentage }}
23+
{{- end }}
24+
{{- if .Values.apiServer.autoscaling.targetMemoryUtilizationPercentage }}
25+
- type: Resource
26+
resource:
27+
name: memory
28+
target:
29+
type: Utilization
30+
averageUtilization: {{ .Values.apiServer.autoscaling.targetMemoryUtilizationPercentage }}
31+
{{- end }}
32+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{- if .Values.queue.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "queue.serviceAccountName" . }}
6+
labels:
7+
{{- include "langGraphCloud.labels" . | nindent 4 }}
8+
{{- with.Values.queue.deployment.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
annotations:
12+
{{- include "langGraphCloud.annotations" . | nindent 4 }}
13+
{{- with.Values.queue.serviceAccount.annotations }}
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
16+
{{- end }}

charts/langgraph-cloud/values.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ images:
3333
config:
3434
existingSecretName: ""
3535
langGraphCloudLicenseKey: ""
36+
numberOfJobsPerWorker: 10 # Number of jobs per worker. Workers are bundled with the api server if queue is disabled."
3637
auth:
3738
enabled: false
3839
langSmithAuthEndpoint: ""
@@ -89,6 +90,41 @@ apiServer:
8990
labels: {}
9091
annotations: {}
9192

93+
queue:
94+
enabled: false
95+
name: "queue"
96+
containerPort: 8000
97+
deployment:
98+
replicaCount: 1
99+
labels: {}
100+
annotations: {}
101+
podSecurityContext: {}
102+
securityContext: {}
103+
resources:
104+
limits:
105+
cpu: 2000m
106+
memory: 4Gi
107+
requests:
108+
cpu: 1000m
109+
memory: 2Gi
110+
extraEnv: []
111+
sidecars: []
112+
nodeSelector: {}
113+
tolerations: []
114+
affinity: {}
115+
volumes: []
116+
volumeMounts: []
117+
autoscaling:
118+
enabled: false
119+
minReplicas: 1
120+
maxReplicas: 5
121+
targetCPUUtilizationPercentage: 80
122+
serviceAccount:
123+
create: true
124+
name: ""
125+
labels: {}
126+
annotations: {}
127+
92128
postgres:
93129
name: "postgres"
94130
external:

charts/langsmith/values.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ ingress:
6363
config:
6464
existingSecretName: ""
6565
langsmithLicenseKey: ""
66-
6766
# -- Optional. Used to enable the Langgraph platform. If enabled, the license key must be provided.
6867
langgraphPlatform:
6968
enabled: false

0 commit comments

Comments
 (0)