-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathsandboxes_test.yaml
More file actions
1235 lines (1155 loc) · 40.7 KB
/
Copy pathsandboxes_test.yaml
File metadata and controls
1235 lines (1155 loc) · 40.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
suite: self-hosted sandboxes
templates:
- validate.yaml
- config-map.yaml
- secrets.yaml
- redis/secrets.yaml
- postgres/secrets.yaml
- clickhouse/secrets.yaml
- frontend/config-map.yaml
- frontend/deployment.yaml
- ingress.yaml
- platform-backend/deployment.yaml
- ingest-queue/deployment.yaml
- sandboxes/proxy-ca.yaml
- sandboxes/juicefs-csi.yaml
- sandboxes/sandbox-host-rbac.yaml
- sandboxes/sandbox-host-service-account.yaml
- sandboxes/sandbox-host-deployment.yaml
- sandboxes/sandbox-host-pdb.yaml
- sandboxes/juicefs-csi-driver/csidriver.yaml
- sandboxes/juicefs-csi-driver/rbac.yaml
- sandboxes/juicefs-csi-driver/controller-statefulset.yaml
- sandboxes/juicefs-csi-driver/node-daemonset.yaml
- sandboxes/juicefs-csi-driver/configmap.yaml
tests:
- it: should not render sandbox runtime resources by default
set:
config.existingSecretName: langsmith-secrets
config.oauth.enabled: true
config.authType: oauth
templates:
- sandboxes/proxy-ca.yaml
- sandboxes/juicefs-csi.yaml
- sandboxes/sandbox-host-rbac.yaml
- sandboxes/sandbox-host-service-account.yaml
- sandboxes/sandbox-host-deployment.yaml
asserts:
- hasDocuments:
count: 0
- it: should wire platform backend sandbox environment when enabled
values:
- ./values/sandboxes-enabled.yaml
template: platform-backend/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_FEATURE_ENABLED
value: "true"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_FRONTEND_ENABLED
value: "true"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_RUNTIME_V2
value: always
- notContains:
path: spec.template.spec.containers[0].env
content:
name: LANGSMITH_LICENSE_REQUIRED_CLAIMS
value: sandbox_enabled
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_K8S_CLUSTER_NAME
any: true
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_X_SERVICE_AUTH_JWT_SECRET
valueFrom:
secretKeyRef:
name: langsmith-secrets
key: api_key_salt
optional: false
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_SERVICE_URLS
- it: should derive sandbox service URLs from the service URL base URL
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.serviceUrlBaseUrl: https://sandbox-services.example.com
template: platform-backend/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_SERVICE_URLS
value: '{"incluster":"https://sandbox-services.example.com"}'
- it: should not add a sandbox service URL ingress rule by default
values:
- ./values/sandboxes-enabled.yaml
set:
config.hostname: langsmith.example.com
ingress.enabled: true
ingress.ingressClassName: nginx
template: ingress.yaml
asserts:
- notContains:
path: spec.rules
content:
host: "*.sandbox-services.example.com"
- it: should add a sandbox service URL ingress rule when using chart ingress
values:
- ./values/sandboxes-enabled.yaml
set:
config.hostname: langsmith.example.com
sandboxes.serviceUrlBaseUrl: https://sandbox-services.example.com
ingress.enabled: true
ingress.ingressClassName: nginx
template: ingress.yaml
asserts:
- equal:
path: spec.rules[1].host
value: "*.sandbox-services.example.com"
- equal:
path: spec.rules[1].http.paths[0].path
value: /
- equal:
path: spec.rules[1].http.paths[0].pathType
value: Prefix
- equal:
path: spec.rules[1].http.paths[0].backend.service.name
value: RELEASE-NAME-langsmith-platform-backend
- equal:
path: spec.rules[1].http.paths[0].backend.service.port.number
value: 1986
- it: should wire the sandbox callback signing JWK from an existing LangSmith secret into platform backend
values:
- ./values/sandboxes-enabled.yaml
template: platform-backend/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: LANGSMITH_SANDBOX_CALLBACK_SIGNING_JWK
valueFrom:
secretKeyRef:
name: langsmith-secrets
key: sandbox_callback_signing_jwk
optional: true
- it: should not set VITE_HOST_ENABLED when only sandboxes are enabled
values:
- ./values/sandboxes-enabled.yaml
template: frontend/deployment.yaml
asserts:
- notContains:
path: spec.template.spec.containers[0].env
content:
name: VITE_HOST_ENABLED
value: "1"
- it: should route sandbox v2 API traffic through the chart frontend
values:
- ./values/sandboxes-enabled.yaml
template: frontend/config-map.yaml
asserts:
- matchRegex:
path: data["nginx.conf"]
pattern: 'location /api/v2/sandboxes/'
- matchRegex:
path: data["nginx.conf"]
pattern: 'rewrite /api/v2/sandboxes/\(\.\*\) /v2/sandboxes/\$1'
- matchRegex:
path: data["nginx.conf"]
pattern: 'proxy_set_header Upgrade \$http_upgrade;'
- matchRegex:
path: data["nginx.conf"]
pattern: 'proxy_set_header Connection \$connection_upgrade;'
- it: should route sandbox v2 API traffic through the chart frontend with basePath
values:
- ./values/sandboxes-enabled.yaml
set:
config.basePath: langsmith
template: frontend/config-map.yaml
asserts:
- matchRegex:
path: data["nginx.conf"]
pattern: 'location /langsmith/api/v2/sandboxes/'
- matchRegex:
path: data["nginx.conf"]
pattern: 'rewrite /langsmith/api/v2/sandboxes/\(\.\*\) /v2/sandboxes/\$1'
- it: should derive a relative platform endpoint for sandbox dataplane URLs
values:
- ./values/sandboxes-enabled.yaml
template: config-map.yaml
asserts:
- equal:
path: data.LANGSMITH_PUBLIC_API_ENDPOINT
value: /api
- it: should derive a basePath-aware relative platform endpoint for sandbox dataplane URLs
values:
- ./values/sandboxes-enabled.yaml
set:
config.basePath: langsmith
template: config-map.yaml
asserts:
- equal:
path: data.LANGSMITH_PUBLIC_API_ENDPOINT
value: /langsmith/api
- it: should derive an absolute platform endpoint for sandbox dataplane URLs when hostname is set
values:
- ./values/sandboxes-enabled.yaml
set:
config.hostname: langsmith.example.com
template: config-map.yaml
asserts:
- equal:
path: data.LANGSMITH_PUBLIC_API_ENDPOINT
value: https://langsmith.example.com/api
- it: should allow sandboxes when the chart frontend is disabled
values:
- ./values/sandboxes-enabled.yaml
set:
frontend.enabled: false
template: validate.yaml
asserts:
- hasDocuments:
count: 0
- it: should store sandbox auth material in the chart-managed LangSmith secret
set:
config.langsmithLicenseKey: test-license
config.apiKeySalt: test-api-key-salt
config.oauth.enabled: true
config.authType: oauth
sandboxes.enabled: true
sandboxes.sandboxHost.deployment.nodeSelector.sandbox\.langsmith\.com/host: "true"
sandboxes.callbackSigningJwk: test-callback-jwk
sandboxes.juicefs.redis.metaURL: redis://langsmith-redis.default.svc.cluster.local:6379/1
sandboxes.juicefs.bucket: https://langsmith-sandboxes-test.s3.us-west-2.amazonaws.com
images.sandboxHostImage.repository: example.com/langsmith/sandbox-host
images.sandboxHostImage.tag: test-sandbox-host
insights.encryptionKey: test-insights-encryption-key
polly.encryptionKey: test-polly-encryption-key
template: secrets.yaml
asserts:
- equal:
path: metadata.name
value: RELEASE-NAME-langsmith-secrets
- equal:
path: data.api_key_salt
value: dGVzdC1hcGkta2V5LXNhbHQ=
- notExists:
path: data.sandbox_x_service_auth_jwt_secret
- equal:
path: data.sandbox_callback_signing_jwk
value: dGVzdC1jYWxsYmFjay1qd2s=
- it: should keep local_kubernetes LANGCHAIN_ENV in the shared config map
values:
- ./values/sandboxes-enabled.yaml
template: config-map.yaml
asserts:
- equal:
path: data.LANGCHAIN_ENV
value: local_kubernetes
- it: should wire ingest queue sandbox environment when enabled
values:
- ./values/sandboxes-enabled.yaml
template: ingest-queue/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_FEATURE_ENABLED
value: "true"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_RUNTIME_V2
value: always
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_DEFAULT_BLUEPRINT_IMAGE
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_QUEUE_PRIORITY
value: "1"
- it: should use the same LANGCHAIN_ENV for sandbox-host as the shared config map
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: LANGCHAIN_ENV
value: local_kubernetes
- it: should sign sandbox callbacks with the public issuer when hostname is set
values:
- ./values/sandboxes-enabled.yaml
set:
config.hostname: langsmith.example.com
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: OAUTH_AS_ISSUER
value: https://langsmith.example.com/api
- it: should omit the callback issuer when no public hostname is configured
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- notContains:
path: spec.template.spec.containers[0].env
content:
name: OAUTH_AS_ISSUER
any: true
- it: should source sandbox service auth from the shared api key salt
values:
- ./values/sandboxes-enabled.yaml
templates:
- sandboxes/sandbox-host-deployment.yaml
- platform-backend/deployment.yaml
- ingest-queue/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_X_SERVICE_AUTH_JWT_SECRET
valueFrom:
secretKeyRef:
name: langsmith-secrets
key: api_key_salt
optional: false
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_X_SERVICE_AUTH_JWT_SECRET_PREVIOUS
any: true
- it: should append sandbox-host extraEnv
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.deployment.extraEnv:
- name: SANDBOX_HOST_JUICEFS_CLONE_CONCURRENCY
value: "40"
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_JUICEFS_CLONE_CONCURRENCY
value: "40"
- it: should hardcode replicas and disable pool autoscaling by default
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- equal:
path: spec.replicas
value: 1
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_ENABLED
value: "false"
- notContains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_MIN_REPLICAS
any: true
- it: should drop replicas and render autoscale env when pool autoscaling is enabled
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 8
targetUtilizationPercent: 60
headroomHosts: 2
scaleDownStabilizationSeconds: 600
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- isNull:
path: spec.replicas
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_ENABLED
value: "true"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_MIN_REPLICAS
value: "2"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_MAX_REPLICAS
value: "8"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_TARGET_UTILIZATION_PERCENT
value: "60"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_HEADROOM_HOSTS
value: "2"
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_AUTOSCALE_SCALE_DOWN_STABILIZATION_SECONDS
value: "600"
- it: should let the elected host read and scale its own Deployment
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-rbac.yaml
documentIndex: 0
asserts:
- isKind:
of: Role
- contains:
path: rules
content:
apiGroups: ["apps"]
resources: ["deployments"]
resourceNames: ["RELEASE-NAME-langsmith-sandbox-host"]
verbs: ["get", "patch"]
- it: should fail when autoscaling maxReplicas is below minReplicas
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.autoscaling.enabled: true
sandboxes.sandboxHost.autoscaling.minReplicas: 5
sandboxes.sandboxHost.autoscaling.maxReplicas: 2
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.sandboxHost.autoscaling.maxReplicas must be greater than or equal to minReplicas."
- it: should always allow private IP sandbox callbacks
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: SSRF_ALLOW_PRIVATE_IPS_CALLBACKS
value: "true"
- it: should render custom sandbox-host RBAC metadata
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.rbac.labels.review: requested
sandboxes.sandboxHost.rbac.annotations.review: requested
template: sandboxes/sandbox-host-rbac.yaml
documentIndex: 0
asserts:
- equal:
path: metadata.labels.review
value: requested
- equal:
path: metadata.annotations.review
value: requested
- it: should allow disabling sandbox-host RBAC resources
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.rbac.create: false
template: sandboxes/sandbox-host-rbac.yaml
asserts:
- hasDocuments:
count: 0
- it: should render custom sandbox-host scheduling on sandbox-host
values:
- ./values/sandboxes-enabled-no-scheduling.yaml
- ./values/sandboxes-custom-scheduling.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
sandbox.example.com/pool: hosts
- equal:
path: spec.template.spec.tolerations
value:
- key: sandbox.example.com/pool
operator: Equal
value: hosts
effect: NoSchedule
- it: should render JuiceFS CSI config and host PVC when enabled
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/juicefs-csi.yaml
documentIndex: 0
asserts:
- isKind:
of: Secret
- equal:
path: stringData.name
value: sandbox-juicefs
- equal:
path: stringData.metaurl
value: redis://langsmith-redis.default.svc.cluster.local:6379/1
- it: should pre-bind JuiceFS PV to the release PVC
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/juicefs-csi.yaml
documentIndex: 1
asserts:
- isKind:
of: PersistentVolume
- equal:
path: spec.claimRef.namespace
value: NAMESPACE
- equal:
path: spec.claimRef.name
value: smithbox-juicefs-csi
- it: should bind JuiceFS PVC to the release PV
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/juicefs-csi.yaml
documentIndex: 2
asserts:
- isKind:
of: PersistentVolumeClaim
- equal:
path: spec.volumeName
value: smithbox-juicefs-csi
- it: should render JuiceFS CSI host PV when enabled
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/juicefs-csi.yaml
documentIndex: 3
asserts:
- isKind:
of: PersistentVolume
- equal:
path: metadata.name
value: smithbox-juicefs-csi-host
- equal:
path: spec.claimRef.namespace
value: NAMESPACE
- equal:
path: spec.claimRef.name
value: smithbox-juicefs-csi-host
- equal:
path: spec.csi.volumeHandle
value: smithbox-juicefs-csi-host
- equal:
path: spec.csi.driver
value: csi.juicefs.com
- equal:
path: spec.csi.nodePublishSecretRef.name
value: juicefs-csi-config
- equal:
path: spec.csi.nodePublishSecretRef.namespace
value: NAMESPACE
- it: should bind JuiceFS host PVC to the host PV
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/juicefs-csi.yaml
documentIndex: 4
asserts:
- isKind:
of: PersistentVolumeClaim
- equal:
path: spec.volumeName
value: smithbox-juicefs-csi-host
- it: should allow an externally managed JuiceFS CSI config Secret
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.redis.metaURL: ""
sandboxes.juicefs.bucket: ""
sandboxes.juicefs.csi.existingSecretName: external-juicefs-csi-config
template: sandboxes/juicefs-csi.yaml
documentIndex: 2
asserts:
- isKind:
of: PersistentVolume
- equal:
path: metadata.name
value: smithbox-juicefs-csi-host
- equal:
path: spec.csi.nodePublishSecretRef.name
value: external-juicefs-csi-config
- equal:
path: spec.csi.nodePublishSecretRef.namespace
value: NAMESPACE
- it: should not require JuiceFS config values when using an externally managed CSI config Secret
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.redis.metaURL: ""
sandboxes.juicefs.bucket: ""
sandboxes.juicefs.csi.existingSecretName: external-juicefs-csi-config
template: validate.yaml
asserts:
- hasDocuments:
count: 0
- it: should mount the derived JuiceFS host PVC on sandbox-host
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- equal:
path: spec.template.spec.volumes[0].persistentVolumeClaim.claimName
value: smithbox-juicefs-csi-host
- it: should fail when sandboxes are enabled without image tags
set:
config.existingSecretName: langsmith-secrets
config.oauth.enabled: true
config.authType: oauth
sandboxes.enabled: true
sandboxes.sandboxHost.deployment.nodeSelector.sandbox\.langsmith\.com/host: "true"
sandboxes.juicefs.redis.metaURL: redis://langsmith-redis.default.svc.cluster.local:6379/1
sandboxes.juicefs.bucket: s3://langsmith-sandboxes-test
images.sandboxHostImage.repository: example.com/langsmith/sandbox-host
images.sandboxHostImage.tag: ""
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "images.sandboxHostImage.tag is required when sandboxes.enabled is true."
- it: should fail when JuiceFS name is invalid
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.name: Sandbox_JuiceFS
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.juicefs.name must be a DNS-label-style JuiceFS volume name: 3-63 characters, lowercase letters, numbers, and hyphens only. Do not use slashes or object-store subpaths here."
- it: should fail when JuiceFS name contains a slash
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.name: sandbox/juicefs
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.juicefs.name must be a DNS-label-style JuiceFS volume name: 3-63 characters, lowercase letters, numbers, and hyphens only. Do not use slashes or object-store subpaths here."
- it: should fail when AWS JuiceFS bucket uses s3 shorthand
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.storage: s3
sandboxes.juicefs.bucket: s3://langsmith-sandboxes-test
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.juicefs.bucket must use a region-explicit S3 endpoint URL such as https://bucket-name.s3.us-west-2.amazonaws.com when sandboxes.juicefs.storage is s3. The s3://bucket shorthand makes JuiceFS infer region with GetBucketLocation and is not supported."
- it: should allow GCP JuiceFS storage
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.storage: gs
sandboxes.juicefs.bucket: gs://langsmith-sandboxes-test
template: validate.yaml
asserts:
- hasDocuments:
count: 0
- it: should fail when sandbox JuiceFS storage is unsupported
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.storage: azure
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.juicefs.storage currently supports only s3 for AWS/EKS and gs for GCP/GKE. Azure-backed sandbox storage is not supported yet."
- it: should fail when sandbox service URL base URL does not use HTTP or HTTPS
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.serviceUrlBaseUrl: sandbox-services.example.com
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.serviceUrlBaseUrl must start with http:// or https://."
- it: should fail when sandbox service URL base URL contains a path
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.serviceUrlBaseUrl: https://sandbox-services.example.com/path
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.serviceUrlBaseUrl must not include a path, query string, or fragment."
- it: should fail when sandbox service URL base URL contains a query string
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.serviceUrlBaseUrl: https://sandbox-services.example.com?foo=bar
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.serviceUrlBaseUrl must not include a path, query string, or fragment."
- it: should fail when sandbox service URL base URL contains a fragment
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.serviceUrlBaseUrl: https://sandbox-services.example.com#fragment
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.serviceUrlBaseUrl must not include a path, query string, or fragment."
- it: should fail when chart ingress would render an invalid sandbox service URL host
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.serviceUrlBaseUrl: https://sandbox-services.example.com:8443
ingress.enabled: true
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.serviceUrlBaseUrl host must be a DNS hostname without a port when ingress.enabled is true."
- it: should fail when existing app Secret is used with chart-provided sandbox callback signing JWK
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.callbackSigningJwk: test-callback-jwk
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.callbackSigningJwk cannot be used when config.existingSecretName is set. Add key sandbox_callback_signing_jwk to the existing Secret instead."
- it: should fail when chart-managed app Secret is missing sandbox callback signing JWK
set:
config.langsmithLicenseKey: test-license
config.apiKeySalt: test-api-key-salt
config.oauth.enabled: true
config.authType: oauth
sandboxes.enabled: true
sandboxes.sandboxHost.deployment.nodeSelector.sandbox\.langsmith\.com/host: "true"
sandboxes.juicefs.redis.metaURL: redis://langsmith-redis.default.svc.cluster.local:6379/1
sandboxes.juicefs.bucket: https://langsmith-sandboxes-test.s3.us-west-2.amazonaws.com
images.sandboxHostImage.repository: example.com/langsmith/sandbox-host
images.sandboxHostImage.tag: test-sandbox-host
insights.encryptionKey: test-insights-encryption-key
polly.encryptionKey: test-polly-encryption-key
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.callbackSigningJwk is required when sandboxes.enabled is true and the chart manages the LangSmith app Secret. When config.existingSecretName is set, add key sandbox_callback_signing_jwk to the existing Secret instead."
- it: should fail when sandbox proxy CA mode is unsupported
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.proxyCa.mode: certManager
template: validate.yaml
asserts:
- failedTemplate:
errorMessage: "sandboxes.proxyCa.mode must be one of generatedSecret or existingSecret."
- it: should fail when raw sandbox env vars conflict with chart-managed platform env
values:
- ./values/sandboxes-enabled.yaml
- ./values/sandboxes-conflicting-env.yaml
template: platform-backend/deployment.yaml
asserts:
- failedTemplate:
errorMessage: "Duplicate keys detected: [SANDBOX_RUNTIME_V2]"
- it: should gate sandbox-host readiness on the host listener without a liveness probe
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe.tcpSocket.port
value: http
- isNull:
path: spec.template.spec.containers[0].livenessProbe
- it: should not render a sandbox-host PDB by default
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-pdb.yaml
asserts:
- hasDocuments:
count: 0
- it: should cap concurrent sandbox-host evictions when the PDB is enabled
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.pdb.enabled: true
template: sandboxes/sandbox-host-pdb.yaml
asserts:
- isKind:
of: PodDisruptionBudget
- equal:
path: metadata.name
value: RELEASE-NAME-langsmith-sandbox-host
- equal:
path: spec.maxUnavailable
value: 1
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: RELEASE-NAME-langsmith-sandbox-host
- it: should let minAvailable replace maxUnavailable in the sandbox-host PDB
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.pdb:
enabled: true
minAvailable: 2
template: sandboxes/sandbox-host-pdb.yaml
asserts:
- equal:
path: spec.minAvailable
value: 2
- isNull:
path: spec.maxUnavailable
- it: should skip the bundled JuiceFS CSI driver when the cluster already runs one
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.csi.install: false
templates:
- sandboxes/juicefs-csi-driver/csidriver.yaml
- sandboxes/juicefs-csi-driver/rbac.yaml
- sandboxes/juicefs-csi-driver/controller-statefulset.yaml
- sandboxes/juicefs-csi-driver/node-daemonset.yaml
- sandboxes/juicefs-csi-driver/configmap.yaml
asserts:
- hasDocuments:
count: 0
- it: should still render sandbox volumes when the bundled JuiceFS CSI driver is skipped
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.juicefs.csi.install: false
template: sandboxes/juicefs-csi.yaml
asserts:
- hasDocuments:
count: 5
- it: should not keep the CSIDriver behind on uninstall
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/juicefs-csi-driver/csidriver.yaml
asserts:
- isKind:
of: CSIDriver
- isNull:
path: metadata.annotations["helm.sh/resource-policy"]
- it: should release-prefix the sandbox-host Deployment and tell the host its name
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.name: hosts
templates:
- sandboxes/sandbox-host-deployment.yaml
asserts:
- equal:
path: metadata.name
value: RELEASE-NAME-langsmith-hosts
- contains:
path: spec.template.spec.containers[0].env
content:
name: SANDBOX_HOST_DEPLOYMENT_NAME
value: RELEASE-NAME-langsmith-hosts
- equal:
path: spec.selector.matchLabels["app.kubernetes.io/component"]
value: RELEASE-NAME-langsmith-hosts
- equal:
path: spec.template.spec.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].labelSelector.matchLabels["app.kubernetes.io/component"]
value: RELEASE-NAME-langsmith-hosts
- it: should scope the sandbox-host autoscaler RBAC to the release-prefixed Deployment
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.name: hosts
template: sandboxes/sandbox-host-rbac.yaml
documentIndex: 0
asserts:
- contains:
path: rules
content:
apiGroups: ["apps"]
resources: ["deployments"]
resourceNames: ["RELEASE-NAME-langsmith-hosts"]
verbs: ["get", "patch"]
- it: should name the sandbox-host Role after the component like other rbac templates
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-rbac.yaml
documentIndex: 0
asserts:
- isKind:
of: Role
- equal:
path: metadata.name
value: RELEASE-NAME-langsmith-sandbox-host
- equal:
path: metadata.namespace
value: NAMESPACE
- it: should bind the sandbox-host Role to its ServiceAccount
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-rbac.yaml
documentIndex: 1
asserts:
- isKind:
of: RoleBinding
- equal:
path: roleRef.name
value: RELEASE-NAME-langsmith-sandbox-host
- equal:
path: subjects[0].name
value: RELEASE-NAME-langsmith-sandbox-host
- equal:
path: subjects[0].namespace
value: NAMESPACE
- it: should render the sandbox-host ServiceAccount from its own template
values:
- ./values/sandboxes-enabled.yaml
template: sandboxes/sandbox-host-service-account.yaml
asserts:
- isKind:
of: ServiceAccount
- equal:
path: metadata.name
value: RELEASE-NAME-langsmith-sandbox-host
- equal:
path: automountServiceAccountToken
value: true
- it: should skip the sandbox-host ServiceAccount when create is false
values:
- ./values/sandboxes-enabled.yaml
set:
sandboxes.sandboxHost.serviceAccount.create: false
template: sandboxes/sandbox-host-service-account.yaml
asserts:
- hasDocuments:
count: 0