Kubernetes
Kubernetes is an open-source platform designed to automate deploying, scaling, and operating containerized applications. It provides a robust framework for running distributed systems resiliently, handling scaling and failover, and managing application updates seamlessly. Kubernetes has gained popularity because it enables organizations to efficiently manage complex applications at scale. It improves resource utilization, and supports cloud-native development practices.
The Kubernetes Service
Smarter manages the resources of its Kubernetes cluster, for example the Ingress of each
LLMClient, and the StatefulSet of each self-hosted vectorstore, with the Kubernetes service of
the infrastructure services. It uses
kubectl, the command-line tool for
Kubernetes, with the kubeconfig that the cloud provider writes, for example with
aws eks update-kubeconfig for AWS EKS. kubectl works the same with any cluster, so the
service does not depend on the cloud.
from string import Template
from smarter.apps.infrastructure.services import infrastructure
with open("k8s/ingress.yaml.tpl", encoding="utf-8") as ingress_template:
template = Template(ingress_template.read())
manifest = template.substitute(ingress_values)
infrastructure.kubernetes.apply_manifest(manifest)
Applying a manifest that provisions billable cloud resources, for example a PersistentVolumeClaim, which provisions a block storage volume, or a Service of type LoadBalancer, sends the infrastructure’s billable resource signals, and records the resources in the infrastructure resource ledger.
Kubernetes Service Technical Reference
Helm Chart
The Smarter Framework includes a Helm chart for deploying Smarter on Kubernetes. The chart is published at ArtifactHUB - Smarter.
Installation
helm install my-release oci://ghcr.io/smarter-sh/charts/smarter -f my-values.yaml
Examples
# Example values.yaml
global:
replicaCount: 3 # pods of the api, the workers and the egress proxy, and their autoscalers' minimum: 1 lite, 3 production
api:
workers: 1 # uvicorn worker processes per pod, about 290 MB each; scale with pods, not workers
limitConcurrency: 100 # per worker; uvicorn answers 503 above it
resources:
requests:
cpu: "250m" # what the scheduler reserves, and what the HPA's CPU target is measured against
memory: "640Mi"
limits:
cpu: "2"
memory: "2Gi"
Links
Configuration
The chart can be configured using the following values:
# ==============================================================================
# Smarter Platform - Helm Chart Values
# ==============================================================================
#
# Default configuration values for the Smarter Platform Helm chart.
#
# This file contains all configurable parameters for deploying the Smarter
# application stack including:
# - Django application server
# - Celery workers and beat scheduler
# - Redis cache
# - Database connections
# - Third-party API integrations
# - OAuth providers
#
# IMPORTANT: Replace all "SET-ME-IN-helm/charts/smarter/values.yaml" values
# with actual credentials before deployment.
#
# Usage:
# helm install smarter . -f values.yaml
# helm upgrade smarter . -f values.yaml
#
# Documentation: https://github.com/smarter-sh/smarter
#
# Note:
# The app.kubernetes.io/application-group label is used to identify pods to Calico
# and kubernetes_network_policy_v1 resources in order to allow pod-level communication
# between backing services. If the label is missing then the network policies are
# assured to PREVENT communication.
# ==============================================================================
# -----------------------------------------------------------------------------
## @param env Environment variables for the Smarter application. If set, these
## are consumed and set automatically in the Smarter app deployment templates.
# -----------------------------------------------------------------------------
env:
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are optional: prefer serviceAccount.awsRoleArn
# (IRSA). Static keys win over the role, so set them only for a cluster without IRSA.
AWS_REGION: "us-east-1"
# ///////////////////////////////////////////////////////////////////////////////////////////////
# DJANGO_<SETTING> overrides the Django setting <SETTING>, e.g. DJANGO_SESSION_COOKIE_AGE: "3600", after
# everything in smarter/smarter/settings/ (smarter.settings.overrides). A JSON value sets a list or a dict.
# WARNING: each one is a hammer. It replaces Smarter's value outright, and nothing derived from the
# old value is computed again. Only the type is checked, never the meaning: a wrong value can stop
# every pod, or quietly weaken the platform's security. Prefer a SMARTER_* variable where one exists,
# and try the change in alpha before prod.
DJANGO_AUTHENTICATION_BACKENDS: "social_core.backends.google.GoogleOAuth2,social_core.backends.github.GithubOAuth2,django.contrib.auth.backends.ModelBackend"
# DJANGO_CELERY_BROKER_URL: Celery's broker, also the workers' liveness probe's and RedBeat's Redis.
# Left out, the chart's own Redis in the release's namespace, with SMARTER_SUBSYSTEM_REDIS_PASSWORD,
# which smarter-infrastructure generates (infrastructureSecrets, below). The cache is the chart's Redis too,
# databases 1 and 2: for another, set DJANGO_CACHES, as JSON, with its default and sessions caches.
# DJANGO_SETTINGS_MODULE: left out, smarter.settings.<SMARTER_ENVIRONMENT>.
# DJANGO_SECRET_KEY: smarter_settings.django_secret_key, Django's SECRET_KEY. On a cluster that
# smarter-infrastructure built, read from its Kubernetes Secret smarter-django-secret-key
# (infrastructureSecrets, below). Otherwise, set it.
# The Docker Hub account that pulls Smarter's image: only the image-pull Secret, secret-docker.yaml,
# reads them. Unlike the rest of env, they reach no pod's environment (smarter.env in _helpers.tpl).
DOCKERHUB_PAT: "SET-ME-IN-helm/charts/smarter/values.yaml"
DOCKERHUB_USERNAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
# Optional. The platform's GitHub token, smarter_settings.github_token: SkillPlugin skill downloads
# (any token), and the bug reports that Smarter Sysadmin opens (a classic ghp_ token with the
# public_repo scope). Without it, create_bug_report says bug reports are not configured.
GITHUB_TOKEN: "SET-ME-IN-helm/charts/smarter/values.yaml"
# ///////////////////////////////////////////////////////////////////////////////////////////////
# SMARTER_<SETTING> sets the Smarter api setting <SETTING> for smarter_settings.
# e.g. SMARTER_PLATFORM_ROOT_DOMAIN: "example.com" sets smarter_settings.platform_root_domain (smarter.common.conf).
# Each one is validated when the pods start, and feeds every Django setting that Smarter derives
# from it, e.g. ALLOWED_HOSTS and the CORS and CSRF origins from the domains. A list is
# comma-separated, a boolean "true" or "false". To keep a setting's default, leave its key out, as
# the commented-out examples below are. A SET-ME placeholder or an empty string is a value: replace
# every placeholder with yours, or delete its line. Prefer one of these over a DJANGO_* variable
# whenever both could make the change. The prefix is required: PLATFORM_ROOT_DOMAIN sets nothing.
# The exceptions keep the names that other tools use: AWS_*, GITHUB_TOKEN and DJANGO_SECRET_KEY.
# See https://docs.smarter.sh, Configuration.
# smarter_settings.log_level: DEBUG, INFO, WARNING, ERROR or CRITICAL. Without it, DEBUG in
# debug mode, and INFO otherwise.
SMARTER_LOG_LEVEL: "INFO"
SMARTER_DEBUG_MODE: "false"
SMARTER_DUMP_DEFAULTS: "false"
SMARTER_ENVIRONMENT: "prod"
SMARTER_PLATFORM_CLOUD_PROVIDER: "aws"
SMARTER_PLATFORM_EMAIL_ADMIN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_FERNET_ENCRYPTION_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_INTERNAL_IP_PREFIXES: "192.168."
SMARTER_PLATFORM_ROOT_DOMAIN: "example.com"
# SMARTER_PLATFORM_S3_BUCKET: left out, the bucket that smarter-infrastructure creates, named after the
# environment's platform domain: <subdomain>.<root domain> in prod, <environment>.<subdomain>.<root domain>.
SMARTER_PLATFORM_SETTINGS_OUTPUT: "false"
SMARTER_PLATFORM_SHARED_RESOURCE_IDENTIFIER: "smarter"
# true: initialize_platform uploads the static files to the environment's S3 bucket on each deployment, and
# pages load them from its CDN, cdn.<platform>. It needs AWS. false: the server serves them.
SMARTER_PLATFORM_STATIC_FILES_ON_CDN: false
# The platform is at <SMARTER_PLATFORM_SUBDOMAIN>.<SMARTER_PLATFORM_ROOT_DOMAIN>.
SMARTER_PLATFORM_SUBDOMAIN: "platform"
SMARTER_PLATFORM_ADMIN_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_ADMIN_USERNAME: "admin"
SMARTER_PLATFORM_BRANDING_ADDRESS1: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_ADDRESS2: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_APP_NAME: "Smarter"
SMARTER_PLATFORM_BRANDING_BLOG_URL: "https://blog.smarter.sh"
SMARTER_PLATFORM_BRANDING_CDN_URL: "https://cdn.smarter.sh"
SMARTER_PLATFORM_BRANDING_CITY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_CONTACT_URL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_CORPORATE_NAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_COUNTRY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_CURRENCY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_DOCS_URL: "https://docs.smarter.sh"
SMARTER_PLATFORM_BRANDING_LOGO: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_MARKETING_SITE_URL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_POSTAL_CODE: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_PRIMARY_CONTACT: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_PRODUCT_DESCRIPTION: "An open source, no-code AI authoring platform designed for instructional use."
SMARTER_PLATFORM_BRANDING_PRODUCT_NAME: "The Smarter Project"
SMARTER_PLATFORM_BRANDING_STATE: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_SUPPORT_EMAIL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_SUPPORT_HOURS: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_SUPPORT_PHONE_NUMBER: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_PLATFORM_BRANDING_TIMEZONE: "SET-ME-IN-helm/charts/smarter/values.yaml"
# Optional links in the page footer and emails, each a full https:// url. Left out: Smarter's own.
# SMARTER_PLATFORM_BRANDING_URL_FACEBOOK: "https://facebook.com/example"
# SMARTER_PLATFORM_BRANDING_URL_LINKEDIN: "https://www.linkedin.com/company/example"
# SMARTER_PLATFORM_BRANDING_URL_SLACK: "https://join.slack.com/t/example"
# SMARTER_PLATFORM_BRANDING_URL_TWITTER: "https://x.com/example"
# Smarter Subsystem configuration
# -----------------------------------------------------------------------------------------------
SMARTER_SUBSYSTEM_LOGGING_LOKI_URL: "http://smarter-loki:3100"
SMARTER_SUBSYSTEM_CACHE_CHAT_EXPIRATION: "5"
SMARTER_SUBSYSTEM_CACHE_EXPIRATION: "60"
SMARTER_SUBSYSTEM_CACHE_LISTVIEW_EXPIRATION: "3600"
SMARTER_SUBSYSTEM_CACHE_LLM_CLIENT_EXPIRATION: "300"
# The Kubernetes cluster that hosts the platform (e.g. its EKS cluster on AWS), where Smarter deploys
# LLMClients and LLMHosts. SMARTER_SUBSYSTEM_K8S_NAMESPACE, left out, is the release's namespace.
SMARTER_SUBSYSTEM_K8S_CLUSTER_NAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
# The Slack app's tokens, which only the optional Slack bot reads (slackBot.enabled).
SMARTER_SUBSYSTEM_SLACK_APP_TOKEN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SLACK_BOT_TOKEN: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SMTP_FROM_EMAIL: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SMTP_HOST: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SMTP_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SMTP_PORT: "587"
SMARTER_SUBSYSTEM_SMTP_SENDER: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SMTP_USERNAME: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SMTP_USE_SSL: "false"
SMARTER_SUBSYSTEM_SMTP_USE_TLS: "true"
SMARTER_SUBSYSTEM_SOCIAL_AUTH_GITHUB_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SOCIAL_AUTH_GITHUB_SECRET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SOCIAL_AUTH_GOOGLE_OAUTH2_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SQL_BACKUP_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml" # the read-only account for the nightly backup. Unset: the backup dumps as root
SMARTER_SUBSYSTEM_SQL_BACKUP_USERNAME: "smarter_backup"
SMARTER_SUBSYSTEM_SQL_DATABASE: "smarter_platform_prod"
SMARTER_SUBSYSTEM_SQL_HOST: "mysql"
SMARTER_SUBSYSTEM_SQL_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SQL_PORT: "3306"
SMARTER_SUBSYSTEM_SQL_ROOT_PASSWORD: "SET-ME-IN-helm/charts/smarter/values.yaml"
SMARTER_SUBSYSTEM_SQL_ROOT_USERNAME: "root"
SMARTER_SUBSYSTEM_SQL_USER: "smarter_platform_prod"
# Smarter App configuration
# -----------------------------------------------------------------------------------------------
# One group per app, in alphabetical order. Each SAM resource app has a SMARTER_APP_<APP>_ENABLE
# flag: false turns its resource types off everywhere (pages, api, cli). Warning: there are
# dependencies between them. For example, turning off LLMClient also turns off LLMHost and LLMTool,
# because the client is the host's only user, and the tool is the client's only user.
SMARTER_APP_API_THROTTLE_RATE_ANON: "120/minute"
SMARTER_APP_API_THROTTLE_RATE_USER: "600/minute"
SMARTER_APP_CONNECTION_ENABLE: true
# dashboard: the web console's own features.
SMARTER_APP_DASHBOARD_MANIFEST_DROPZONE_ENABLE: true
SMARTER_APP_DASHBOARD_PASSTHROUGH_PROMPT_ENABLE: true
SMARTER_APP_DASHBOARD_SERVER_LOGS_ENABLE: true
SMARTER_APP_DASHBOARD_WEB_CONSOLE_TERMINAL_ENABLE: false
SMARTER_APP_GUARDRAIL_ENABLE: true
# infrastructure: the cloud-agnostic service layer, whose Celery queue the other apps' infrastructure
# tasks use too.
SMARTER_APP_INFRASTRUCTURE_TASKS_CELERY_TASK_QUEUE: "infrastructure_celery_task_queue"
# the tool worker's queue (workerTools). SMARTER_APP_LLMTOOL_TOOL_RUNNER, which sends the app's tool
# calls there, is derived from workerTools.enabled (smarter.env in templates/_helpers.tpl).
SMARTER_APP_TOOLS_TASKS_CELERY_TASK_QUEUE: "tools_celery_task_queue"
# llmclient: deploying LLMClients: its Celery tasks' DNS records, ingresses, retries and queue.
SMARTER_APP_LLMCLIENT_ENABLE: true
SMARTER_APP_LLMCLIENT_TASKS_CELERY_MAX_RETRIES: "3"
SMARTER_APP_LLMCLIENT_TASKS_CELERY_RETRY_BACKOFF: "True"
SMARTER_APP_LLMCLIENT_TASKS_CELERY_TASK_QUEUE: "default_celery_task_queue"
SMARTER_APP_LLMCLIENT_TASKS_CREATE_DNS_RECORD: "True"
SMARTER_APP_LLMCLIENT_TASKS_CREATE_INGRESS_MANIFEST: "True"
SMARTER_APP_LLMCLIENT_TASKS_DEFAULT_TTL: "600"
# llmhost: self-hosted models. The IAM role and the subnets (comma-separated) of the EKS node groups
# that Smarter creates for LLMHosts. Needed with SMARTER_APP_LLMHOST_ENABLE on AWS, e.g.
# smarter-infrastructure's node role and the cluster's private subnets.
SMARTER_APP_LLMHOST_ENABLE: true
# SMARTER_APP_LLMHOST_NODE_ROLE_ARN: "arn:aws:iam::123456789012:role/eks-node-role"
# SMARTER_APP_LLMHOST_NODE_SUBNET_IDS: "subnet-0123456789abcdef0,subnet-0fedcba9876543210"
# llmtool: plugins and extensions.
SMARTER_APP_LLMTOOL_ENABLE: true
# The Smarter Extension registry's base64 Ed25519 public key. This is a
# public key, not a secret. An empty value disables the registry.
SMARTER_APP_LLMTOOL_EXTENSION_REGISTRY_PUBLIC_KEY: "i0kR0g3ZEf6YzyyjnQbIwq85D7QGwTrvzubYsw6sdtg="
SMARTER_APP_LLMTOOL_EXTENSION_REGISTRY_URL: "https://smarter-sh.github.io/extensions-registry/index.json"
SMARTER_APP_LLMTOOL_PLUGIN_MAX_DATA_RESULTS: "50"
SMARTER_APP_MCPCLIENT_ENABLE: true
# mcpserver: the platform's MCP server.
SMARTER_APP_MCPSERVER_RATE_LIMIT: "1200"
SMARTER_APP_ORCHESTRATOR_ENABLE: true
# provider: the built-in LLM Providers. Their keys are bootstrapSecrets, below, not env.
SMARTER_APP_PROVIDER_ENABLE: true
SMARTER_APP_PROXY_ENABLE: true
SMARTER_APP_SECRET_ENABLE: true
SMARTER_APP_VECTORSEARCH_ENABLE: true
# vectorstore: the managed vector databases, which manage.py initialize_vectorstore_providers
# connects. Their keys are bootstrapSecrets, below; Qdrant Cloud also needs its url.
SMARTER_APP_VECTORSTORE_ENABLE: true
# SMARTER_APP_VECTORSTORE_QDRANT_CLOUD_URL: "https://xyz-example.us-east-1-0.aws.cloud.qdrant.io:6333"
# -----------------------------------------------------------------------------
## The platform's bootstrap secrets: the Smarter Secrets that the init Job creates (issue #1099), by name, e.g.
## openai_api_key: "sk-...". The chart puts them in the Kubernetes Secret smarter-bootstrap-secrets, which only
## the init Job mounts, at smarter_settings.bootstrap_secrets_dir, and manage.py initialize_bootstrap_secrets
## turns each into the Smarter admin's Secret of that name. Every service then reads the Secret, never an
## environment variable. An empty value is skipped. Each key is optional: a Provider, plugin or connection whose
## Secret doesn't exist says which Secret to set. An existing platform's Secrets are kept when a key is left out.
##
## The built-in Providers: anthropic_api_key, cohere_api_key, fireworks_api_key, gemini_api_key, llama_api_key,
## mistral_api_key, openai_api_key, togetherai_api_key. Google: google_maps_api_key (the weather extension), and
## google_service_account (its json, for Google Cloud bearer tokens). The search plugins: tavily_api_key,
## brave_search_api_key. The managed vector databases: pinecone_api_key, qdrant_cloud_api_key.
# -----------------------------------------------------------------------------
bootstrapSecrets: {}
# -----------------------------------------------------------------------------
## @param infrastructureSecrets The Kubernetes Secrets that smarter-infrastructure creates in each
## environment's namespace, and the env variables that their keys set: the database, administrator,
## email and Django credentials. The chart reads them when it is installed or upgraded, so they are never
## copied into a values file. A value read from one of them supersedes the same variable in env. A Secret
## that doesn't exist is skipped, so the chart also works on a cluster that smarter-infrastructure didn't
## build: then set these variables in env. See smarter.env in templates/_helpers.tpl.
# -----------------------------------------------------------------------------
infrastructureSecrets:
enabled: true
secrets:
mysql-smarter:
SMARTER_MYSQL_DATABASE: SMARTER_SUBSYSTEM_SQL_DATABASE
SMARTER_MYSQL_USERNAME: SMARTER_SUBSYSTEM_SQL_USER
SMARTER_MYSQL_PASSWORD: SMARTER_SUBSYSTEM_SQL_PASSWORD
MYSQL_HOST: SMARTER_SUBSYSTEM_SQL_HOST
MYSQL_PORT: SMARTER_SUBSYSTEM_SQL_PORT
mysql-root:
MYSQL_ROOT_USERNAME: SMARTER_SUBSYSTEM_SQL_ROOT_USERNAME
MYSQL_ROOT_PASSWORD: SMARTER_SUBSYSTEM_SQL_ROOT_PASSWORD
smarter-admin:
SMARTER_ADMIN_USERNAME: SMARTER_PLATFORM_ADMIN_USERNAME
SMARTER_ADMIN_PASSWORD: SMARTER_PLATFORM_ADMIN_PASSWORD
smarter-django-secret-key:
SECRET_KEY: DJANGO_SECRET_KEY
# Redis's password, which the Redis subchart reads from the same Secret (redis.auth below).
smarter-redis-password:
REDIS_PASSWORD: SMARTER_SUBSYSTEM_REDIS_PASSWORD
aws-ses-config:
SMTP_HOST: SMARTER_SUBSYSTEM_SMTP_HOST
SMTP_PORT: SMARTER_SUBSYSTEM_SMTP_PORT
SMTP_USE_SSL: SMARTER_SUBSYSTEM_SMTP_USE_SSL
SMTP_USE_TLS: SMARTER_SUBSYSTEM_SMTP_USE_TLS
SMTP_USERNAME: SMARTER_SUBSYSTEM_SMTP_USERNAME
SMTP_PASSWORD: SMARTER_SUBSYSTEM_SMTP_PASSWORD
# -----------------------------------------------------------------------------
# Global Configuration
# -----------------------------------------------------------------------------
global:
appName: smarter
# The replicas of the platform's scalable Deployments: the api, the Celery worker, the tool worker,
# the Extension worker and the egress proxy each start with this many pods, and their autoscalers
# (hpa, keda) never scale them below it. Their maximums are their own (hpa.maxReplicas,
# keda.workers.<worker>.maxReplicas), so load still scales them out. Suggested values:
# 1: (default) Good for environments with expected long idle periods. Ensures the lowest cost.
# 3: production. Guaranteed responsiveness under varying load conditions.
replicaCount: 1
image:
pullPolicy: Always
repository: mcdaniel0073/smarter
tag: v9999.9999.9999.dev9999
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: node-group
operator: In
values:
- smarter
defaultStorageClass: gp3
imagePullSecrets:
- name: dockerhub-secret
tolerations:
- key: "node-group"
operator: "Equal"
value: "smarter"
effect: "NoSchedule"
# The security contexts of the pods that run the Smarter image: the app, the Celery
# workers, beat and the init job. They run as smarter_user, the user that the Dockerfile
# creates (uid and gid 1000), which reads the image's code through its group. runAsGroup
# must stay 1000: with only runAsUser set, the process's group would be root's, and it
# could not read the code. The root filesystem is read-only; the directories that the
# processes write are emptyDirs (templates/_helpers.tpl, smarter.writableVolumes).
podSecurityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: RuntimeDefault
containerSecurityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
# -----------------------------------------------------------------------------
# Smarter api (uvicorn web server) Configuration
# -----------------------------------------------------------------------------
api:
# The number of uvicorn worker processes in each app pod (uvicorn --workers). Each worker
# is a separate Python process that loads all of Django, about 300 MB at rest, and runs
# Python on at most one core at a time, so give resources.limits.cpu at least one core per
# worker, and grow resources.requests.memory with it. uvicorn starts each worker as a
# new interpreter, so its workers share no memory (issue #1118). Django's synchronous
# code runs on a thread pool inside each worker, so a worker that waits on an LLM
# provider keeps serving other requests. Capacity beyond that comes from more pods (hpa),
# not more workers per pod.
workers: 1
# The most concurrent connections and tasks that each uvicorn worker accepts
# (uvicorn --limit-concurrency). Above it, uvicorn answers 503 at once instead of
# accepting the request. Without a limit, every request gets its own thread for
# Django's synchronous code, so under load a pod accepts work until it runs out
# of memory and is killed, dropping every request in flight. With a limit, an
# overloaded pod sheds the excess, its CPU and memory stay bounded, and the
# HorizontalPodAutoscaler adds pods. Leave it empty to disable the limit.
limitConcurrency: 100
# Seconds that the web server waits for the platform database to answer a read or
# a write (env SMARTER_DATABASE_READ_TIMEOUT, PyMySQL's read_timeout and
# write_timeout). A query that the database never answers would otherwise hold
# the request's thread forever. Rendered only into the app Deployment, never
# into api.env or the global env map: api.env also reaches the init job and the
# backup job's email container, and the workers, beat and the init job run
# migrations, management commands and tasks that can legitimately take longer
# than a web request. Leave it empty for no timeout.
databaseReadTimeout: 60
# Threads in each uvicorn worker that run streamed chat prompts (env
# SMARTER_PROMPT_THREADS). A prompt holds its thread while it waits on the LLM
# and its tools, so a worker runs this many prompts at once and queues the next
# ones. The pool is the prompts' own, apart from the event loop's default
# executor (6 threads on a 2-vCPU node), where Django renders error pages.
# Keep it below limitConcurrency. Rendered only into the app Deployment: only
# the web server streams prompts. Leave it empty for the default, 32.
promptThreads: 32
resources:
requests:
# What the scheduler reserves for each pod, not what it may use: an idle pod uses
# under 0.01 vCPU, and limits.cpu lets a busy one use up to two cores. The
# HorizontalPodAutoscaler measures CPU against it, so with
# hpa.targetCPUUtilizationPercentage at 75 it adds pods when they average about
# 0.19 vCPU each, well before a uvicorn worker saturates its one core. A whole core
# per pod, times global.replicaCount, reserved more than one node's CPU for pods that
# sat idle.
cpu: "250m"
# About 340Mi for the uvicorn worker (api.workers), idle in production, plus headroom for
# the threads and buffers of requests in flight. The scheduler only places a pod on a
# node with this much memory free, and the HorizontalPodAutoscaler measures memory
# utilization against it (hpa.targetMemoryUtilizationPercentage), so it is kept well
# above idle use: Python rarely returns memory, and a pod that has served requests
# would otherwise keep the app scaled out.
memory: "640Mi"
limits:
cpu: "2"
memory: "2Gi"
# The RollingUpdate strategy of the app's Deployment. A deploy first adds maxSurge new pods
# on top of the current ones, then replaces up to maxUnavailable old pods at a time. With
# maxUnavailable: 0, it never stops an old pod until a new one is ready, so when no node has
# a free resources.requests.cpu for the extra pod, and the cluster autoscaler can't add a
# node (spot capacity, a node group at its max size), the new pod stays Pending and the
# deploy never finishes. maxUnavailable: 1 lets it stop one old pod to make room, so the
# deploy always completes, with one pod fewer than replicas for a minute or so at worst.
# Keep it at or below api.podDisruptionBudget.maxUnavailable. With global.replicaCount 1, the
# Deployment ignores it, and uses maxSurge 1 and maxUnavailable 0 (templates/deployment-api.yaml).
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
extraVolumeMounts: []
# A PodDisruptionBudget that keeps voluntary disruptions (node drains, cluster
# upgrades, Karpenter or cluster-autoscaler consolidation) from evicting more than
# maxUnavailable app pods at a time. See templates/pdb-api.yaml.
podDisruptionBudget:
enabled: true
maxUnavailable: 1
# The api's Deployment, Service, HorizontalPodAutoscaler and PodDisruptionBudget are named
# <appName>-api. They were named <appName> before v0.43.0. Enabled, legacyName also renders a
# twin of each under the old name, and both Services reach both Deployments' pods, so that an
# install upgrading from an older release drops no request while its Ingresses still name the
# old Service. Such an install upgrades once with it enabled, points its Ingresses at
# <appName>-api (smarter-infrastructure's do; the init job retargets every LLMClient's), then
# upgrades again with it disabled, which deletes the twins. See smarter.apiNames in _helpers.tpl.
legacyName:
enabled: false
names:
mysqlName: mysql
mariadbName: mariadb
service:
port: 8000
targetPort: 8000
# Memory requests match what the processes use once they are running, plus headroom, because
# the scheduler places pods by their requests. Requests below real use let it put too many
# pods on one node, which then runs out of memory, and the kubelet evicts the pods that
# use the most memory above their requests. Idle in production (v1.0.11), the worker used
# about 590Mi, the infrastructure worker 400Mi, the tool worker 280Mi, the Extension worker
# 310Mi and beat 270Mi. A task grows its process while it runs, and the infrastructure
# worker's kubectl and aws cli count against its pod, so the limits stay well above them.
worker:
# How the worker runs its tasks (celery worker --pool), and how many at once (--concurrency).
# prefork runs each task in a process of its own, forked from the worker's main process, which
# freezes its objects first so that the processes share their memory (issue #1118). threads runs
# them in threads of one process, which uses less memory, about 80Mi less per pod at rest with 4
# tasks, and more under load. The tasks wait on the network, not the cpu, so threads suit them.
# But Celery enforces the task time limit (CELERY_TASK_TIME_LIMIT, 30 minutes) only with prefork,
# by killing the process: with threads, a task that hangs holds its thread until the pod restarts.
pool: prefork
concurrency: 5
resources:
requests:
cpu: "250m"
memory: "896Mi"
limits:
cpu: "1"
memory: "2Gi"
# The Celery worker of the infrastructure queue, which deploys, verifies and destroys
# cloud, Kubernetes and DNS resources. See templates/deployment-worker-infrastructure.yaml.
workerInfrastructure:
replicaCount: 1
# How the worker runs its tasks (celery worker --pool), and how many at once (--concurrency).
# prefork runs each task in a process of its own, forked from the worker's main process, which
# freezes its objects first so that the processes share their memory (issue #1118). threads runs
# them in threads of one process, which uses less memory, about 80Mi less per pod at rest with 4
# tasks, and more under load. The tasks wait on the network, not the cpu, so threads suit them.
# But Celery enforces the task time limit (CELERY_TASK_TIME_LIMIT, 30 minutes) only with prefork,
# by killing the process: with threads, a task that hangs holds its thread until the pod restarts.
pool: prefork
concurrency: 4
resources:
requests:
cpu: "250m"
memory: "640Mi"
limits:
# 2, the minimum that Django settings recommend. Each of its 4 concurrent tasks runs kubectl and
# the aws cli, which are CPU bound while they start, and slowed one another down on 1.
cpu: "2"
memory: "2Gi"
# The tool worker (ADR-038), which executes the tool calls that the app resolves: API, SQL and MCP
# calls, extension tools, web search page fetches. It has no database, no Smarter Secret, no IAM role
# and no Kubernetes token: its environment is a Secret of its own, with the broker's and the cache's
# url and a few settings that aren't secret (templates/secret-env-tools.yaml). With enabled, the
# app's pods send every tool call to it (SMARTER_APP_LLMTOOL_TOOL_RUNNER=remote); without, they run
# each call themselves. Enable it after smarter-infrastructure's network policies for its pods
# (application-group <appName>-tools), which let it reach Redis. See
# templates/deployment-worker-tools.yaml.
workerTools:
enabled: false
# concurrent tool calls per pod, threads of one process (pool). Tool calls wait on the network, rarely
# on the cpu, so scale with replicas (global.replicaCount, keda) rather than past what
# resources.limits.memory holds.
concurrency: 4
# threads or prefork (celery worker --pool), as worker.pool describes. threads by default: tool calls
# wait on the network, each kind of call has a timeout of its own, and the app stops waiting for a call
# after at most 10 minutes, so Celery's time limit, which only prefork enforces, is a last resort here.
# One process already runs every call, one after another, and holds no credential but each call's own.
# The Extension worker is always prefork: each Extension call needs a process of its own.
pool: threads
resources:
requests:
cpu: "250m"
memory: "448Mi"
limits:
cpu: "1"
memory: "2Gi"
# The Extension worker (issue #1077), deployed with the tool worker: it runs Extensions' tool calls, which
# the app sends to their own queue, each in a process of its own (--max-tasks-per-child=1), as the Redis
# user extensions, which can't read the tool worker's queue. Extensions are third-party code: apart from
# the tool worker, they can't see the API, SQL and MCP calls' credentials, in their process or in Redis.
# Its pods are in the same application-group, so the same network policies apply. Its Secret holds the
# Redis user extensions' password, from smarter-infrastructure's smarter-redis-users. See
# templates/deployment-worker-extensions.yaml.
extensions:
# concurrent Extension calls per pod, each in a process forked for it from the worker's loaded parent,
# and discarded after it.
concurrency: 2
resources:
requests:
cpu: "100m"
memory: "448Mi"
limits:
cpu: "1"
memory: "1Gi"
beat:
replicaCount: 1
resources:
requests:
cpu: "100m"
memory: "384Mi"
limits:
cpu: "500m"
memory: "1Gi"
# The egress proxy (ADR-038, phase 4, #1085): Stripe's Smokescreen, an HTTP CONNECT proxy, in the
# namespace. With enabled, the app, the workers, Beat and the Jobs send their HTTP and HTTPS requests
# through it (HTTPS_PROXY, HTTP_PROXY and NO_PROXY, smarter.egressProxyEnv in _helpers.tpl), and it
# logs one CANONICAL-PROXY-DECISION line per connection: the host, the client pod's address, and
# whether the allowlist would refuse it (enforce_would_deny). It refuses private, link-local and
# metadata addresses whatever the action, so NO_PROXY sends the cluster's own services around it. The
# tool worker, the Extension worker and the bastion don't use it: their network policies are their own.
#
# Enable it after smarter-infrastructure's network policies for its pods (application-group
# <appName>-egress), which let the platform's pods reach it, and it reach the internet. See
# templates/deployment-egress-proxy.yaml.
egressProxy:
enabled: false
# ghcr.io/stripe/smokescreen, Stripe's own image (distroless, non-root), pinned by digest.
image: "ghcr.io/stripe/smokescreen:v1.0.1@sha256:e62052a184ce5ef97c32b00a32583fc5376d4ca5d9ec941cf9a4566eef0556e8"
port: 4750
# report: allow every host, and log the ones that allowedDomains doesn't list (stage 1, a week of
# the live traffic's inventory). enforce: refuse them (stage 2).
action: report
# The fixed hosts of ADR-038's inventory of the code (docs/source/_static/adr-038/egress.svg), the
# seed of stage 2's allowlist, which stage 1's log corrects. A leading "*." matches every subdomain,
# not the domain itself.
allowedDomains:
# the LLM providers
- api.openai.com
- api.anthropic.com
- generativelanguage.googleapis.com
- api.mistral.ai
- api.cohere.com
- api.cohere.ai
- api.fireworks.ai
- api.together.xyz
- api.together.ai
- api.llama.com
# Pinecone, the managed vectorstore's control plane and indexes
- api.pinecone.io
- "*.pinecone.io"
# GitHub: load_from_github, skills, bug reports, indexing, smarter version, the extension registry
- github.com
- api.github.com
- codeload.github.com
- raw.githubusercontent.com
- objects.githubusercontent.com
- smarter-sh.github.io
# social sign-in
- accounts.google.com
- oauth2.googleapis.com
- www.googleapis.com
- www.linkedin.com
- api.linkedin.com
# Slack, the Jobs' notifications
- slack.com
# the blog, which the worker indexes
- blog.smarter.sh
# More hosts to send around the proxy, after the chart's own (smarter.egressProxyNoProxy).
noProxy: []
resources:
requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "500m"
memory: "256Mi"
database:
type: mysql # Options: mysql, mariadb, external
## @param deployTimestamp Deployment timestamp for forcing pod restarts
deployTimestamp: ""
deployment:
containerPort: 8000
# -----------------------------------------------------------------------------
# Horizontal Pod Autoscaler Configuration
# ----------------------------------------------------------------------------
# targetMemoryUtilizationPercentage and behavior apply to the app's
# HorizontalPodAutoscaler (templates/hpa-api.yaml); maxReplicas and
# targetCPUUtilizationPercentage apply to it and to the Celery worker's
# (templates/hpa-worker.yaml). Their minimum is global.replicaCount.
hpa:
maxReplicas: 25
targetCPUUtilizationPercentage: 75
# Measured against api.resources.requests.memory. The uvicorn worker of an idle pod
# already uses about half of its 640Mi request, and Python rarely returns memory
# to the operating system, so a lower target would keep the app scaled out after
# the load is gone. Leave it empty to scale on CPU only.
targetMemoryUtilizationPercentage: 90
# Rendered as the autoscaling/v2 spec.behavior of the app's HorizontalPodAutoscaler.
# Scale up by up to 100% a minute; scale down only after 5 minutes of lower load.
behavior:
scaleUp:
stabilizationWindowSeconds: 60
selectPolicy: Max
policies:
- type: Percent
value: 100
periodSeconds: 60
scaleDown:
stabilizationWindowSeconds: 300
selectPolicy: Min
policies:
- type: Percent
value: 100
periodSeconds: 60
# KEDA (issue #1097): the Celery workers scale on the length of their own queue, as well as on CPU. CPU is
# a poor signal for a queue worker: a task that waits on the network uses almost none, while hundreds of
# tasks wait behind it. When enabled, each worker gets a KEDA ScaledObject (templates/scaledobject-workers.yaml),
# which creates and owns its HorizontalPodAutoscaler, in place of hpa-worker.yaml, and the workers'
# Deployments leave their replicas to it. Each scales out by one replica per listLength waiting tasks, or
# when its pods' CPU passes cpuUtilization, between global.replicaCount and maxReplicas (the infrastructure
# worker from its own minReplicas). Never to zero: Beat's entries and the tool calls need a worker ready.
#
# It needs, from smarter-infrastructure: the KEDA operator on the cluster (install_keda), the Redis user keda,
# whose password is in the Secret smarter-redis-users, and the Secret smarter-redis-keda, which the
# TriggerAuthentication reads, and the network policy that lets KEDA's operator reach Redis. The user keda
# may only run LLEN on the four queues (redis.master.preExecCmds). Celery's Redis transport keeps each queue
# as a list named after it, and with CELERY_WORKER_PREFETCH_MULTIPLIER = 1 the list's length is the backlog.
# A message sent with a priority would go to another list, which the metric would miss: Smarter sends none.
keda:
enabled: false
# how often KEDA reads the queues, in seconds
pollingInterval: 15
# Rendered as the HorizontalPodAutoscaler's spec.behavior: scale out at once, scale in only after 5
# minutes of a shorter queue, one pod a minute, so that a pod isn't removed while the backlog drains.
behavior:
scaleUp:
stabilizationWindowSeconds: 0
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Pods
value: 1
periodSeconds: 60
workers:
# hpa-worker.yaml's maximum, hpa.maxReplicas
worker:
maxReplicas: 25
listLength: 10
cpuUtilization: 75
workerInfrastructure:
minReplicas: 1
maxReplicas: 4
listLength: 5
cpuUtilization: 75
# with workerTools.enabled
workerTools:
maxReplicas: 10
listLength: 10
cpuUtilization: 75
workerExtensions:
maxReplicas: 6
listLength: 5
cpuUtilization: 75
# -----------------------------------------------------------------------------
# Backing Services Configuration
# -----------------------------------------------------------------------------
databaseInit:
# post-install/post-upgrade Job: create db + user, migrate, initialize platform. Also a pre-upgrade Job
# that migrates before the rollout (job-migrate.yaml), so that new pods never run without their schema.
enabled: true
notifyEmail: "" # the Job emails its log here when it completes. Empty: smarter_settings.platform_email_admin
# the Slack channel, e.g. smarter, that the Job also posts its outcome to, with its log in the message's
# thread. Empty: don't post. Needs env.SMARTER_SUBSYSTEM_SLACK_BOT_TOKEN, and a bot with the scopes chat:write and
# files:write that is a member of the channel.
notifySlackChannel: ""
databaseScheduledBackup:
enabled: true
schedule: "0 2 * * *" # Every day at 2am UTC
notifyEmail: "" # the Job emails the backup's result and log here. Empty: smarter_settings.platform_email_admin
# the Slack channel, e.g. smarter, that the Job also posts the backup's result to, with its log in the
# message's thread. Empty: don't post. Needs env.SMARTER_SUBSYSTEM_SLACK_BOT_TOKEN, and a bot with the scopes
# chat:write and files:write that is a member of the channel.
notifySlackChannel: ""
# where backups are uploaded, e.g. s3://my-private-bucket/backups/sql. Empty: s3://<env.SMARTER_PLATFORM_S3_BUCKET>/backups/sql.
# Use a private bucket: the backup is a full copy of the database. The environment bucket that
# serves static assets is often public-read, so don't rely on the default there.
s3Uri: ""
awsCliVersion: "" # the AWS CLI release to install. Empty: the version pinned in configmap-debian-setup.yaml
# the IAM role (IRSA) of the backup's ServiceAccount, smarter-backup, which only needs s3:PutObject on
# s3Uri. smarter-infrastructure creates one per environment. Empty: the AWS keys in env, if any.
awsRoleArn: ""
# -----------------------------------------------------------------------------
# The platform's ServiceAccounts (templates/serviceaccount.yaml, templates/rbac.yaml)
# -----------------------------------------------------------------------------
# Each kind of pod runs as its own ServiceAccount, <appName>-<pod>: the app (api), the
# Celery workers, beat, the init Job and the migrate Job (ADR-038, phase 3). kubectl
# authenticates as it, with only its kind's Role and ClusterRole in templates/rbac.yaml.
serviceAccount:
# each kind of pod's own IAM role (IRSA), whose trust policy names its ServiceAccount, e.g.
# api: arn:aws:iam::<account>:role/<namespace>-smarter-api-irsa. smarter-infrastructure creates
# them, one per kind and environment, with only what that kind does in AWS (ADR-038, phase 3).
# The kinds that call AWS: api, worker, worker-infrastructure, job-init. Celery Beat and the
# migrate Job make no AWS call, and get no role.
awsRoleArns: {}
# the IAM role of a kind that awsRoleArns leaves out, e.g. one role for every kind.
# Empty, and no awsRoleArns: the pods use env.AWS_ACCESS_KEY_ID and env.AWS_SECRET_ACCESS_KEY.
awsRoleArn: ""
# create the ServiceAccounts' read-only ClusterRoles (their namespace, nodes, PersistentVolumes,
# node metrics, each kind's own), which need a deployer with cluster-wide permissions. smarter-sh's
# own deploy workflow turns it off, because smarter-infrastructure creates the same ClusterRoles, so
# that each environment deploys with namespace-scoped permissions only. See templates/rbac.yaml.
createClusterRole: true
# -----------------------------------------------------------------------------
# Optional Slack bot (the slack-bot subchart, helm/charts/slack-bot)
# -----------------------------------------------------------------------------
# A single pod that answers questions in a Slack workspace with a deployed
# LLMClient, through its chat api. It connects to Slack with Socket Mode, so it
# needs no Ingress. It reads env.SMARTER_SUBSYSTEM_SLACK_BOT_TOKEN and
# env.SMARTER_SUBSYSTEM_SLACK_APP_TOKEN. Enable it in one environment only: two bots with
# the same Slack app would each receive part of the messages. The deploy workflow
# enables it in prod only, when the repository secrets SLACK_BOT_TOKEN,
# SLACK_APP_TOKEN and SLACK_BOT_AGENT_URL are set.
# See helm/charts/slack-bot/values.yaml for the other values.
slackBot:
enabled: false
# The deployed LLMClient that answers, e.g.
# https://smarter-developer.<account-number>.api.<root-domain>/. Required when enabled.
agentUrl: ""
externalDatabase:
host: "" # Will use .Values.env.SMARTER_SUBSYSTEM_SQL_HOST if empty
port: 3306 # Will use .Values.env.SMARTER_SUBSYSTEM_SQL_PORT if empty
database: "" # Will use .Values.env.SMARTER_SUBSYSTEM_SQL_DATABASE if empty
username: "" # Will use .Values.env.SMARTER_SUBSYSTEM_SQL_USER if empty
password: "" # Will use .Values.env.SMARTER_SUBSYSTEM_SQL_PASSWORD if empty
mysql:
enabled: false
nameOverride: "mariadb" # every resource becomes <release>-mariadb = smarter-mariadb
primary:
# Smarter stores emoji and other 4-byte characters (prompts, manifests,
# chat history), which need utf8mb4. The Bitnami chart's default my.cnf sets
# character-set-server=UTF8, which is the 3-byte utf8mb3. Command-line flags
# take precedence over my.cnf.
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
containerSecurityContext:
enabled: true
runAsUser: 1001
runAsGroup: 1001
fsGroup: 1001
image:
pullPolicy: Always
initdbScripts: {}
livenessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
nodeSelector: {}
persistence:
enabled: true
size: 8Gi
storageClassName: "gp3"
accessModes:
- ReadWriteOnce
podSecurityContext:
enabled: true
fsGroup: 1001
resources:
requests:
memory: "1Gi"
cpu: "250m"
limits:
memory: "2Gi"
cpu: "1"
readinessProbe:
enabled: true
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
mariadb:
enabled: true
nameOverride: "mariadb" # every resource becomes <release>-mariadb = smarter-mariadb
auth:
# the passwords, from templates/secret-mariadb.yaml: the platform's database credentials, i.e.
# smarter-infrastructure's Kubernetes Secrets mysql-root and mysql-smarter. The name is the one that
# this subchart gives its own Secret, so that MariaDB's pod spec stays the same.
existingSecret: "{{ .Release.Name }}-mariadb"
# Bitnami publishes bitnami/mariadb only as `latest`, so a version tag can't be pinned. The
# digest pins the image, so that a pod rescheduled onto a new node runs the same MariaDB as
# before, and never a new major version against the existing data directory. A digest
# replaces the tag in the pod's image reference. This one is MariaDB 13.1.1 (amd64 and arm64).
# To upgrade, take the digest of the new `latest`, e.g. with
# `docker buildx imagetools inspect bitnami/mariadb:latest`.
image:
digest: "sha256:687181819d6e3f04124a21aec1aeef1d8a5d6a924c0d8e8f0cf66b8f0ce15a7c"
primary:
# MariaDB is one pod on a ReadWriteOnce volume, so any eviction is a database outage of
# about a minute, while the new pod waits for the volume to detach from the old node
# (issue #931, as for Redis in #929). This annotation stops the cluster autoscaler from
# scaling down MariaDB's node.
podAnnotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
# maxUnavailable: 1 lets a node drain evict the only pod, so that an upgrade of the stateful
# node group (a new AMI or Kubernetes version) proceeds on its own: EKS starts the new node,
# drains the old one, and MariaDB moves over with an outage of a minute or two. A
# minAvailable: 1 would block every drain, and EKS fails the upgrade after 15 minutes. The
# other evictors stay away: the annotation above stops the cluster autoscaler, and the
# descheduler's policy (smarter-infrastructure) protects every pod with a PVC.
pdb:
create: true
minAvailable: ""
maxUnavailable: 1
# Smarter stores emoji and other 4-byte characters (prompts, manifests,
# chat history), which need utf8mb4. The Bitnami chart's default my.cnf sets
# character-set-server=UTF8, which is the 3-byte utf8mb3. Command-line flags
# take precedence over my.cnf. The init Job also creates the database, or
# alters it, with utf8mb4 as its default.
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
# Sized to fit the stateful node (a t3.medium, about 3.4 GiB allocatable) together with
# Redis and Loki. MariaDB uses about 300Mi and a few tens of millicores in prod. The scheduler
# places pods by their requests, so a request far above use keeps them off the node.
resources:
requests:
cpu: 250m
memory: 1Gi
limits:
cpu: 2
memory: 2Gi
livenessProbe:
enabled: true
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
# A spot node that AWS reclaims takes MariaDB with it, whatever the annotation above says
# (issue #942). So MariaDB prefers the stateful node pool: on-demand nodes, labeled and
# tainted smarter.sh/node-pool=stateful, that only pods with this toleration may use.
# smarter-infrastructure creates the pool (aws/terraform/smarter/node-group-stateful.tf), in
# the zone of MariaDB's volume.
#
# The toleration and affinity are defined once, here, as YAML anchors. Every service that
# belongs on the pool references them (redis.master and loki.singleBinary below), so the
# pool's key and value live in one place. The affinity is preferred, not required: when the
# pool has no node (a cluster without one, or while its node is replaced), the pod runs on
# any node that can attach its volume, rather than staying Pending. It doesn't move back by
# itself; delete the pod at a quiet time to return it to the pool.
tolerations: &statefulNodePoolTolerations
- key: smarter.sh/node-pool
operator: Equal
value: stateful
effect: NoSchedule
affinity: &statefulNodePoolAffinity
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: smarter.sh/node-pool
operator: In
values:
- stateful
nodeSelector: {}
readinessProbe:
enabled: true
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
successThreshold: 1
persistence:
enabled: true
size: 8Gi
storageClass: "gp3"
accessModes:
- ReadWriteOnce
# -----------------------------------------------------------------------------
# Redis Configuration
#
# **IMPORTANT**:After any change to Redis's values or its image, run make
# redis-chart-check: it starts this Redis as its pod does, and checks its users,
# which neither docker-compose nor helm template can show.
# -----------------------------------------------------------------------------
redis:
enabled: true
external:
host: ""
port: 6379
password: ""
fullnameOverride: "smarter-redis"
# Redis's password is generated per environment by smarter-infrastructure, in the Kubernetes Secret
# smarter-redis-password, which the platform's pods read too (infrastructureSecrets, above). It guards
# the Celery queues, whose workers hold the platform's credentials, and every user's session, so it is
# never a default here (smarter ADR-030, rule 5). On a cluster that smarter-infrastructure didn't build,
# create that Secret, with the key REDIS_PASSWORD, before installing. Letters and digits only: the pods
# put it in a redis:// url.
auth:
enabled: true
existingSecret: "smarter-redis-password"
existingSecretPasswordKey: "REDIS_PASSWORD"
architecture: standalone
# Bitnami publishes bitnami/redis only as `latest`, so a version tag can't be pinned. The
# digest pins the image, so that a restarted pod runs the same Redis as before. A digest
# replaces the tag in the pod's image reference. This one is Redis 8.10.3 (amd64 and arm64).
# To upgrade, take the digest of the new `latest`, e.g. with
# `docker buildx imagetools inspect bitnami/redis:latest`.
image:
digest: "sha256:59078af5aec997137eb95f34fed376487b471e05c9a244c2812a13598c434950"
master:
disableCommands: []
# Redis's ACL (smarter ADR-030, rule 8). Every pod but the tool worker is Redis's default user, whose
# password is auth.existingSecret's, and which may do anything. The tool worker, which runs Extensions
# and the requests that the LLM chooses, is the user tools, which may touch only:
# ~tools_celery_task_queue* its queue, and kombu's in-flight keys under it (settings/base.py)
# ~celery-task-meta-* the tool calls' results, which Celery reads before it writes
# %R~...extension:archive:* Extensions' archives in the cache, read-only
# ~tools_cache:* its own @cache_results cache, e.g. the robots.txt rules of a page
# fetch's redirects (CACHE_RESULTS["CACHE"] in settings/base.py)
# %W~stream:logs:* the console's log streams, write-only, and the logs:* channels
# and no command that lists keys or channels, whose names include sessions' keys. The Extension worker
# (issue #1077), which runs Extensions' code, is the user extensions, with the same rules for its own
# queue, extensions_celery_task_queue, and its own @cache_results cache, extensions_cache:*: it can't
# read the tools queue, where API, SQL and MCP calls wait with their credentials, nor the tool worker's
# cache. Without it, code in
# the tool worker could push a task to the infrastructure worker, which holds the Kubernetes Role and
# the IAM role, or read every session.
#
# KEDA's operator (keda above, issue #1097) is the user keda, which may run LLEN and TYPE on the four
# Celery queues and nothing else, besides what a client needs to connect (PING, HELLO, SELECT, CLIENT
# SETINFO and SETNAME): it reads their lengths to scale the workers, and can read no message. KEDA's
# Redis scaler sends a Lua script with EVAL, which calls TYPE, then LLEN (redis_scaler.go, KEDA 2.21),
# so it may run EVAL too. Redis checks every command that a script runs against the user's ACL, keys
# included, so a script of keda's can still run only TYPE and LLEN, on the four queues.
#
# The users' passwords are in smarter-infrastructure's Secret smarter-redis-users, keys tools,
# extensions and keda, mounted
# whole at /opt/bitnami/redis/users. When Redis starts, the start script has copied master.conf to a
# writable directory; this appends the user to that copy, which Redis includes, after a newline: the
# copy doesn't end with one, and its last line is a comment, which would swallow the user. Not the subchart's
# auth.acl: it mounts its ACL file as a subPath inside the ConfigMap's directory, which runc can't
# create on the cluster's nodes ("not a directory"), and Redis never started (2026-11-27). The Secret
# is optional: without it no user tools is written, the tool worker can't log in, and Redis starts.
# Keep these rules the same as docker-compose.yml's and docker-compose.shard.yml's smarter-redis
# (tests/test_env_secret.py), and the queue's name the same as SMARTER_APP_TOOLS_TASKS_CELERY_TASK_QUEUE.
extraVolumes:
- name: redis-users
secret:
secretName: smarter-redis-users
optional: true
extraVolumeMounts:
- name: redis-users
mountPath: /opt/bitnami/redis/users
readOnly: true
preExecCmds:
- |
if [[ -f /opt/bitnami/redis/users/tools ]]; then
printf '\n%s\n' "user tools on >$(< /opt/bitnami/redis/users/tools) ~tools_celery_task_queue* ~celery-task-meta-* %R~django*:1:smarter:extension:archive:* ~tools_cache:* %W~stream:logs:* &logs:* &celery-task-meta-* +@all -@dangerous -@admin -scan -randomkey -pubsub -subscribe -psubscribe -ssubscribe" >> /opt/bitnami/redis/etc/master.conf
fi
- |
if [[ -f /opt/bitnami/redis/users/keda ]]; then
printf '\n%s\n' "user keda on >$(< /opt/bitnami/redis/users/keda) ~default_celery_task_queue ~infrastructure_celery_task_queue ~tools_celery_task_queue ~extensions_celery_task_queue -@all +llen +type +eval +ping +hello +select +client|setinfo +client|setname" >> /opt/bitnami/redis/etc/master.conf
fi
- |
if [[ -f /opt/bitnami/redis/users/extensions ]]; then
printf '\n%s\n' "user extensions on >$(< /opt/bitnami/redis/users/extensions) ~extensions_celery_task_queue* ~celery-task-meta-* %R~django*:1:smarter:extension:archive:* ~extensions_cache:* %W~stream:logs:* &logs:* &celery-task-meta-* +@all -@dangerous -@admin -scan -randomkey -pubsub -subscribe -psubscribe -ssubscribe" >> /opt/bitnami/redis/etc/master.conf
fi
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
# Redis is one pod on a ReadWriteOnce volume, so any eviction is an outage of about a
# minute, while the new pod waits for the volume to detach from the old node (issue #929).
# This annotation stops the cluster autoscaler from scaling down Redis's node.
podAnnotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
# As for MariaDB: a node drain may evict Redis, so that an upgrade of the stateful node group
# proceeds on its own.
pdb:
create: true
minAvailable: ""
maxUnavailable: 1
# As for MariaDB: a reclaimed spot node takes Redis with it (issue #942), so Redis prefers the
# stateful node pool, with the anchors that mariadb.primary defines. Its volume must be in
# the pool's zone, or it can't run there.
tolerations: *statefulNodePoolTolerations
affinity: *statefulNodePoolAffinity
nodeSelector: {}
containerSecurityContext:
enabled: true
persistence:
enabled: true
size: 10Gi
storageClass: gp3
podSecurityContext:
enabled: true
# Sized to fit the stateful node together with MariaDB and Loki (see
# mariadb.primary.resources).
# Redis uses about 10Mi in prod: it holds the cache, Celery's queues and sessions.
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "1"
memory: "1Gi"
service:
headless:
sessionAffinity: None
replica:
disableCommands: []
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
# ----------------------------------------------------------------------------
# Monitoring Components
# Enable/disable and configure Prometheus, Grafana, and Loki
# ----------------------------------------------------------------------------
prometheus:
enabled: false
server:
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
persistentVolume:
enabled: false # For demo/dev. Set to true and configure storage for production.
grafana:
enabled: false
podLabels:
app.kubernetes.io/application-group: "{{ .Values.global.appName }}"
adminPassword: "admin" # Change for production!
persistence:
enabled: false # For demo/dev. Set to true and configure storage for production.
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus-server
- name: Loki
type: loki
access: proxy
url: http://smarter-loki:3100
# ----------------------------------------------------------------------------
# Pod logs: Loki stores them, Alloy collects them
# ----------------------------------------------------------------------------
# The last 72 hours of the logs of the app, the Celery workers, beat and MariaDB,
# which the Smarter MCP Server's log tools search (smarter.apps.mcpserver.services.logs).
#
# - Loki runs as one pod (deploymentMode SingleBinary) with its chunks and index on
# its own gp3 volume. Nothing is sent to S3 or CloudWatch, which would add cost.
# Its compactor deletes logs older than limits_config.retention_period.
# - Alloy runs as one pod, not a DaemonSet on every node. loki.source.kubernetes
# tails the logs through the Kubernetes api, so Alloy needs no host paths, and
# reads only its own namespace, with the Role in templates/role-alloy.yaml. Its
# own ClusterRole and CRDs are off: the cluster is shared by every environment,
# and two releases would each claim the same cluster-wide objects.
# - Alloy redacts email addresses, IP addresses, tokens, api keys and passwords
# before a line is stored (loki.process "redact"). A failed sign-in is logged
# with a hash of the email address instead (smarter.apps.account.auth.login_audit).
# - Both pods carry the application-group label, so the namespace's network
# policies admit them. The application group's egress policy must allow TCP 3100
# to Loki (smarter-infrastructure, aws/terraform/kubernetes/network_policy.tf).
# - Loki has no authentication (auth_enabled: false). Only pods in the namespace
# can reach it, and it has no Service outside the cluster.
loki:
enabled: true
fullnameOverride: "smarter-loki"
deploymentMode: SingleBinary
# a Role in this namespace, not a ClusterRole: every environment's release is named
# smarter, and they would each claim the same cluster-wide smarter-loki-clusterrole.
rbac:
namespaced: true
loki:
auth_enabled: false
commonConfig:
replication_factor: 1
# one pod: no memberlist ring, whose port the network policies don't open.
ring:
kvstore:
store: inmemory
storage:
type: filesystem
schemaConfig:
configs:
- from: "2026-11-01"
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: loki_index_
period: 24h
limits_config:
retention_period: 72h
# Alloy can resend lines after a restart; older ones are already deleted.
reject_old_samples_max_age: 72h
max_query_lookback: 72h
compactor:
retention_enabled: true
delete_request_store: filesystem
pattern_ingester:
enabled: false
ui:
enabled: false
singleBinary:
replicas: 1
podLabels:
app.kubernetes.io/application-group: "smarter"
# Loki is one pod on a ReadWriteOnce volume, like MariaDB and Redis, so it prefers the
# stateful node pool too, with the anchors that mariadb.primary defines. These replace the
# Loki chart's default affinity, a pod anti-affinity that means nothing with one replica.
tolerations: *statefulNodePoolTolerations
affinity: *statefulNodePoolAffinity
persistence:
enabled: true
size: 10Gi
storageClass: gp3
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "1"
memory: 1Gi
# the other deployment modes' components, and the extras that SingleBinary doesn't need.
backend:
replicas: 0
read:
replicas: 0
write:
replicas: 0
gateway:
enabled: false
chunksCache:
enabled: false
resultsCache:
enabled: false
lokiCanary:
enabled: false
test:
enabled: false
minio:
enabled: false
sidecar:
rules:
enabled: false
alloy:
enabled: true
fullnameOverride: "smarter-alloy"
crds:
create: false
# templates/role-alloy.yaml grants the service account a Role in this namespace.
rbac:
create: false
serviceAccount:
create: true
name: smarter-alloy
controller:
type: deployment
replicas: 1
podLabels:
app.kubernetes.io/application-group: "smarter"
alloy:
enableReporting: false
resources:
requests:
cpu: 50m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
configMap:
# Alloy's configuration language. The chart passes it through tpl, so Helm
# expressions work, and Alloy's own braces need no escaping.
content: |
// The pods of the app, the Celery workers, beat and MariaDB, in this namespace only.
// The tool worker's pods are in another application-group, but the same namespace.
discovery.kubernetes "pods" {
role = "pod"
namespaces {
own_namespace = true
}
selectors {
role = "pod"
label = "app.kubernetes.io/name in ({{ .Values.global.appName }},{{ .Values.global.appName }}-api,{{ .Values.global.appName }}-worker,{{ .Values.global.appName }}-worker-infrastructure,{{ .Values.global.appName }}-worker-tools,{{ .Values.global.appName }}-worker-extensions,{{ .Values.global.appName }}-beat,mariadb)"
}
}
// The labels that the MCP Server's queries select on: component, pod and container.
discovery.relabel "pods" {
targets = discovery.kubernetes.pods.targets
rule {
source_labels = ["__meta_kubernetes_namespace"]
target_label = "namespace"
}
rule {
source_labels = ["__meta_kubernetes_pod_label_app_kubernetes_io_name"]
target_label = "component"
}
rule {
source_labels = ["__meta_kubernetes_pod_name"]
target_label = "pod"
}
rule {
source_labels = ["__meta_kubernetes_pod_container_name"]
target_label = "container"
}
}
loki.source.kubernetes "pods" {
targets = discovery.relabel.pods.output
forward_to = [loki.process.redact.receiver]
}
// Each stage.replace replaces what its expression's capture group matched.
// Alloy's expressions are RE2: no lookahead or lookbehind. They are tested by
// helm/charts/smarter/tests/test_alloy_redact.py, which reads them from this file.
loki.process "redact" {
stage.replace {
expression = "([\\w.+-]+@[\\w-]+\\.[\\w.-]+)"
replace = "<email>"
}
stage.replace {
expression = "\\b((?:\\d{1,3}\\.){3}\\d{1,3})\\b"
replace = "<ip>"
}
// A token, but not code that calls something, e.g. the traceback source line
// stored_token = self.redis.get(self.name): the value must not run into a "(".
// The word must not end a longer word, e.g. "SmarterAuthToken <name>" (#971).
stage.replace {
expression = "(?i)(?:^|[^a-z])(?:bearer|token)[\"' :=]+([A-Za-z0-9._~+/-]{12,})(?:[^A-Za-z0-9._~+/(-]|$)"
replace = "<redacted>"
}
stage.replace {
expression = "\\b(sk-[A-Za-z0-9_-]{20,})"
replace = "<redacted>"
}
stage.replace {
expression = "\\b((?:AKIA|ASIA)[A-Z0-9]{16})\\b"
replace = "<redacted>"
}
stage.replace {
expression = "\\b(gh[pousr]_[A-Za-z0-9]{30,}|xox[abposr]-[A-Za-z0-9-]{10,})"
replace = "<redacted>"
}
stage.replace {
expression = "\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})"
replace = "<redacted>"
}
// A password or api key, and the password of a url, but not a value that Smarter
// already masked: mask_string() and SqlConnection.get_connection_string() write
// masks that start with "*", e.g. "api_key": "****abcd" and mysql://user:******@host.
// The word must not end a longer word, e.g. "tokenSecret": "<name>", which names a
// Smarter Secret (#990). A JSON null, true or false is matched outside the capture
// group, which stage.replace then leaves as it is, e.g. "apiKeySecret": null.
stage.replace {
expression = "(?i)(?:^|[^a-z])(?:password|passwd|secret|api_key|apikey)[\"']?\\s*[:=]\\s*(?:(?:null|true|false)(?:[\\s,}\\]]|$)|[\"']?([^\\s\"',}*][^\\s\"',}]{3,}))"
replace = "<redacted>"
}
stage.replace {
expression = "://[^:/\\s]+:([^@\\s*][^@\\s]*)@"
replace = "<redacted>"
}
forward_to = [loki.write.default.receiver]
}
loki.write "default" {
endpoint {
url = "http://smarter-loki.{{ .Release.Namespace }}.svc.cluster.local:3100/loki/api/v1/push"
}
}