diff --git a/charts/langsmith/templates/_helpers.tpl b/charts/langsmith/templates/_helpers.tpl index 85a80d11..5576b5af 100644 --- a/charts/langsmith/templates/_helpers.tpl +++ b/charts/langsmith/templates/_helpers.tpl @@ -461,6 +461,14 @@ Template containing common environment variables that are used by several servic key: insights_encryption_key optional: false {{- end }} +{{- if .Values.config.polly.enabled }} +- name: POLLY_ENCRYPTION_KEY + valueFrom: + secretKeyRef: + name: {{ include "langsmith.secretsName" . }} + key: polly_encryption_key + optional: false +{{- end }} {{- end }} @@ -601,6 +609,9 @@ Template containing common environment variables that are used by several servic {{- if .Values.config.insights.enabled }} {{- $createProducts = append $createProducts "insights" }} {{- end }} +{{- if .Values.config.polly.enabled }} +{{- $createProducts = append $createProducts "smith_polly" }} +{{- end }} {{ toYaml $createProducts }} {{- end -}} @@ -612,6 +623,9 @@ Template containing common environment variables that are used by several servic {{- if not .Values.config.insights.enabled }} {{- $destroyProducts = append $destroyProducts "insights" }} {{- end }} +{{- if not .Values.config.polly.enabled }} +{{- $destroyProducts = append $destroyProducts "smith_polly" }} +{{- end }} {{ toYaml $destroyProducts }} {{- end -}} diff --git a/charts/langsmith/templates/agent-bootstrap/bootstrap-job.yaml b/charts/langsmith/templates/agent-bootstrap/bootstrap-job.yaml index 27174fdb..1085e3a6 100644 --- a/charts/langsmith/templates/agent-bootstrap/bootstrap-job.yaml +++ b/charts/langsmith/templates/agent-bootstrap/bootstrap-job.yaml @@ -116,6 +116,20 @@ spec: "memory_limit_mb": {{ .Values.config.insights.agent.resources.memoryLimitMb }}, "min_scale": {{ .Values.config.insights.agent.resources.minScale }}, "max_scale": {{ .Values.config.insights.agent.resources.maxScale }} + }{{- if .Values.config.polly.enabled }},{{- end }} + {{- end }} + {{- if .Values.config.polly.enabled }} + "smith-polly": { + "image": "{{ include "langsmith.image" (dict "Values" .Values "Chart" .Chart "component" "pollyAgentImage") }}", + "configmap_name": "{{ include "langsmith.fullname" . }}-polly-config", + "k8s_namespace": "{{ .Values.namespace | default .Release.Namespace }}", + "restart_deployments": ["{{ include "langsmith.fullname" . }}-{{ .Values.frontend.name }}"], + "cpu": {{ .Values.config.polly.agent.resources.cpu }}, + "cpu_limit": {{ .Values.config.polly.agent.resources.cpuLimit }}, + "memory_mb": {{ .Values.config.polly.agent.resources.memoryMb }}, + "memory_limit_mb": {{ .Values.config.polly.agent.resources.memoryLimitMb }}, + "min_scale": {{ .Values.config.polly.agent.resources.minScale }}, + "max_scale": {{ .Values.config.polly.agent.resources.maxScale }} } {{- end }} } diff --git a/charts/langsmith/templates/agent-bootstrap/rbac.yaml b/charts/langsmith/templates/agent-bootstrap/rbac.yaml index 3d25d726..164a5e57 100644 --- a/charts/langsmith/templates/agent-bootstrap/rbac.yaml +++ b/charts/langsmith/templates/agent-bootstrap/rbac.yaml @@ -20,7 +20,7 @@ automountServiceAccountToken: {{ .Values.backend.agentBootstrap.serviceAccount.a {{- end }} --- # Role + RoleBinding: only when at least one product is enabled (create path patches ConfigMaps and restarts deployments) -{{- if and .Values.backend.agentBootstrap.enabled .Values.config.deployment.enabled (or .Values.config.agentBuilder.enabled .Values.config.insights.enabled) }} +{{- if and .Values.backend.agentBootstrap.enabled .Values.config.deployment.enabled (or .Values.config.agentBuilder.enabled .Values.config.insights.enabled .Values.config.polly.enabled) }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -47,6 +47,9 @@ rules: {{- if .Values.config.insights.enabled }} - {{ include "langsmith.fullname" . }}-insights-config {{- end }} + {{- if .Values.config.polly.enabled }} + - {{ include "langsmith.fullname" . }}-polly-config + {{- end }} # Permission to restart deployments after ConfigMap updates - apiGroups: ["apps"] resources: ["deployments"] diff --git a/charts/langsmith/templates/config-map.yaml b/charts/langsmith/templates/config-map.yaml index 1fc79a88..9aa49bf3 100644 --- a/charts/langsmith/templates/config-map.yaml +++ b/charts/langsmith/templates/config-map.yaml @@ -62,6 +62,9 @@ data: FF_USE_PG_FOR_FEEDBACK_CONFIGS_FETCH_ENABLED_ALL: "true" FF_USE_PG_FOR_FEEDBACK_FETCH_ENABLED_ALL: "true" IS_SELF_HOSTED: "true" + {{- if .Values.config.polly.enabled }} + SELF_HOSTED_POLLY_ENABLED: "true" + {{- end }} # Security - CORS configuration {{- if .Values.config.security.cors.allowedOriginsRegex }} CORS_ALLOWED_ORIGINS_REGEX: {{ .Values.config.security.cors.allowedOriginsRegex | quote }} diff --git a/charts/langsmith/templates/frontend/deployment.yaml b/charts/langsmith/templates/frontend/deployment.yaml index f3b8d4cd..c5cd3b59 100644 --- a/charts/langsmith/templates/frontend/deployment.yaml +++ b/charts/langsmith/templates/frontend/deployment.yaml @@ -3,6 +3,10 @@ - name: VITE_SELF_HOSTED_CLIO_ENABLED value: {{ .enabled | quote }} {{- end }} +{{- with .Values.config.polly }} +- name: VITE_SELF_HOSTED_POLLY_ENABLED + value: {{ .enabled | quote }} +{{- end }} {{- /* Agent Builder OAuth provider IDs for frontend */ -}} {{- if .Values.config.agentBuilder.oauth.googleOAuthProvider }} - name: VITE_GOOGLE_OAUTH_PROVIDER @@ -138,6 +142,11 @@ spec: name: {{ include "langsmith.fullname" . }}-agent-builder-config optional: true {{- end }} + {{- if .Values.config.polly.enabled }} + - configMapRef: + name: {{ include "langsmith.fullname" . }}-polly-config + optional: true + {{- end }} image: {{ include "langsmith.image" (dict "Values" .Values "Chart" .Chart "component" "frontendImage") | quote }} imagePullPolicy: {{ .Values.images.frontendImage.pullPolicy }} ports: diff --git a/charts/langsmith/templates/secrets.yaml b/charts/langsmith/templates/secrets.yaml index 0a433e35..5ee886d8 100644 --- a/charts/langsmith/templates/secrets.yaml +++ b/charts/langsmith/templates/secrets.yaml @@ -22,4 +22,5 @@ data: azure_storage_connection_string: {{ .Values.config.blobStorage.azureStorageConnectionString | b64enc | quote }} agent_builder_encryption_key: {{ .Values.config.agentBuilder.encryptionKey | b64enc | quote }} insights_encryption_key: {{ .Values.config.insights.encryptionKey | b64enc | quote }} + polly_encryption_key: {{ .Values.config.polly.encryptionKey | b64enc | quote }} {{- end }} diff --git a/charts/langsmith/templates/validate.yaml b/charts/langsmith/templates/validate.yaml index 908a1822..914defbc 100644 --- a/charts/langsmith/templates/validate.yaml +++ b/charts/langsmith/templates/validate.yaml @@ -195,6 +195,14 @@ AWS Marketplace Helm template verification). {{- fail "config.insights.encryptionKey is required when Insights is enabled. Generate one with: python -c \"from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())\"" -}} {{- end -}} +{{- /* Validate polly configuration */ -}} +{{- if and .Values.config.polly.enabled (not .Values.config.deployment.enabled) -}} +{{- fail "config.deployment.enabled must be true when Polly is enabled. Polly requires LangSmith Deployments." -}} +{{- end -}} +{{- if and .Values.config.polly.enabled (not .Values.config.polly.encryptionKey) (not .Values.config.existingSecretName) -}} +{{- fail "config.polly.encryptionKey is required when Polly is enabled. Generate one with: python -c \"from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())\"" -}} +{{- end -}} + {{- /* Validate autoscaling configuration for all services */ -}} {{- $autoscalingServices := dict "aceBackend" .Values.aceBackend.autoscaling diff --git a/charts/langsmith/values.yaml b/charts/langsmith/values.yaml index f1fe7abc..38baf8fc 100644 --- a/charts/langsmith/values.yaml +++ b/charts/langsmith/values.yaml @@ -143,6 +143,19 @@ config: minScale: 1 maxScale: 5 + # Polly configuration + polly: + enabled: false + encryptionKey: "" + agent: + resources: + cpu: 2 + cpuLimit: 4 + memoryMb: 4096 + memoryLimitMb: 8192 + minScale: 1 + maxScale: 5 + # Agent Builder configuration - UI for creating and managing agents # Requires config.deployment.enabled to be true agentBuilder: