Skip to content

build(k8s): move the LiteLLM gateway to v1.109 #5091

Not planned

Description

@dan-petty

Problem or Motivation

k8s/llm/gateway/deployment.yaml pins ghcr.io/berriai/litellm v1.103.x (v1.103.10 live; the baseline #5065 takes the v1.103.11 patch). The newest is v1.109.1 (digest sha256:11175975a3093e05e92faee2fe2fe3412a3ae2fcaa849eb0fe25d5f0d8bcb2e9), 6 minor lines and 35 releases later. #4406 plans the upgrade; this item is the move itself. Renovate (#4893) will offer it, and it needs work:

  • Prisma schema migrations run on the gateway database at start and go forward only.
  • 1.106.1 asks for a script for old vector stores.
  • 1.109.0 needs list fallback targets (the config already uses lists), removes the disk cache, needs optional_pre_call_checks enforce_model_rate_limits for a hard rpm cap, and changes Gemini parameters.
  • The advisory table of the gateway test (GATEWAY_ADVISORY_FIXED_IN in tests/ai/benchmark/test_k8s_llm_gateway.py) stops at the 1.106 line, so the test needs the fixed-in release of each new line.

Notes read: https://github.com/BerriAI/litellm/releases v1.104.3 to v1.109.1. Research of 2026-11-12 (research-k8s, record image:ghcr.io/berriai/litellm).

Proposed Solution & Architectural Design

  1. Back up llm-gateway-db.
  2. Check k8s/llm/gateway/config.yaml against the 1.106.1 and 1.109.0 action items.
  3. Extend GATEWAY_ADVISORY_FIXED_IN; set the image with its digest.
  4. After the sync, run the gateway smoke calls (test(k8s): run gateway smoke calls after LiteLLM upgrade #4885).

Done when the gateway runs v1.109.x and the smoke calls of each model group pass.

Target Subsystem

AI & Agentic Review Pipeline

Existing Tool Considered

The upstream image and its release notes. No new code.

Source: #4893

Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: renovatebot/renovate (https://github.com/renovatebot/renovate), AGPL-3.0, last activity 2026-11-21, maintained.
Reason: Searches found only Renovate for the image bump and nothing for the config or schema work. It proposes the v1.109.1 tag and digest but leaves the config items, advisory table and backup to the change.

Covers:

  • Proposes the new LiteLLM image tag in the Deployment
  • Supports digest pinning in its image rule
  • Opens the bump pull request that the smoke calls follow

Lacks:

  • No rewrite of config.yaml for the 1.106.1 and 1.109.0 items
  • No fixed-in entries for the 1.109 advisory line
  • No migration resolver setting, backup step or smoke calls

Proposed design

Problem statement

The gateway Deployment pins ghcr.io/berriai/litellm v1.103.11, and the newest release is v1.109.1, 6 minor lines and 35 releases later. It applies forward-only Prisma migrations and the 1.106.1 and 1.109.0 action items: the removed disk cache, optional_pre_call_checks enforce_model_rate_limits, changed Gemini parameters and list fallback targets. The advisory table of the gateway test stops at line 1.106. The change sets the image, adapts the config, extends the table and enables the v2 migration resolver. A completed backup and the smoke calls of each hosted group prove the move.

Acceptance criteria

Requirement: gateway-image-is-v1-109-1

The gateway Deployment SHALL name the ghcr.io/berriai/litellm image at tag v1.109.1.

Scenario: the k8s row and the rollout show the new image

  • WHEN uv run devops ci --check --only k8s runs on the change and the Deployment rolls out
  • THEN the k8s row passes and kubectl -n llm get pod -l app.kubernetes.io/name=llm-gateway -o jsonpath='{.items[0].spec.containers[0].image}' prints ghcr.io/berriai/litellm:v1.109.1.

Requirement: gateway-advisory-table-names-line-1-109

The gateway advisory table SHALL name a fixed-in release for line (1, 109) that is at or below the pinned version.

Scenario: the advisory test on the new line

  • WHEN uv run pytest tests/ai/benchmark/test_k8s_llm_gateway.py::TestK8sLLMGatewayManifests::test_gateway_image_is_not_below_the_release_that_fixes_the_critical_advisories runs
  • THEN the test passes on the pinned v1.109.1 image.

Requirement: gateway-config-holds-the-1-109-form

The gateway config SHALL hold the 1.109.0 form of each setting that the 1.106.1 and 1.109.0 notes change.

Scenario: the gateway serves each hosted group after the move

  • WHEN the new pod runs on v1.109.1 and the documented smoke call of each hosted group in openspec/specs/ai-gateway-routing/spec.md runs
  • THEN each hosted group answers with a reply.

Requirement: gateway-uses-the-v2-migration-resolver

The litellm container SHALL set USE_V2_MIGRATION_RESOLVER to "true".

Scenario: the start log names the v2 resolver

  • WHEN the new pod starts
  • THEN its log holds Using v2 migration resolver and no Using default (v1) migration resolver line.

Requirement: gateway-database-is-backed-up-before-the-migration

The rollout SHALL start only after a backup of the llm-gateway-db database completes.

Scenario: a completed backup precedes the new pod

  • WHEN the new pod starts
  • THEN kubectl -n llm get backup shows a backup of the llm-gateway-db Cluster in phase completed with a completion time before the start time of the new pod.

Existing Tool Considered

No tool covers the need. The alternatives check of 2026-11-15 returned the verdict none, and its searches found no tool for LiteLLM schema migrations or for an image move with its config. The release notes show the steps are LiteLLM's own action-required items. Renovate (#4893) offers only the image bump. The change builds no code: it edits two manifests and one test table, so its build cost is none.

Key questions

  • Which Prisma migration resolver does the gateway use on the move to v1.109.1?: Set USE_V2_MIGRATION_RESOLVER to "true" on the litellm container, with a comment beside it. The v2 resolver holds a Postgres advisory lock during the migration. The v1 default runs a diff-and-force step for pending migrations while the old pod still writes. (best practice) [sources: k8s/llm/gateway/deployment.yaml, k8s/llm/gateway-db.yaml]
    • Chosen: v2 migration resolver. It holds a Postgres advisory lock, and the image installs the extra_proxy extra, so psycopg is present.
    • Rejected: v1 migration resolver (default). It has no lock and runs a diff-and-force step for pending migrations during the two-version window of a rolling update.
  • Does the image reference pin the digest, or only the tag?: Pin only the tag v1.109.1 and record the digest sha256:11175975a3093e05e92faee2fe2fe3412a3ae2fcaa849eb0fe25d5f0d8bcb2e9 in a comment. The gateway test derives the version from the tag with parse_repository_tag and asserts that the repository is exactly ghcr.io/berriai/litellm. (best practice) [sources: tests/ai/benchmark/test_k8s_llm_gateway.py, k8s/llm/gateway/deployment.yaml]
    • Chosen: tag only. The test parses v1.109.1 from the reference, and its repository assertion holds.
    • Rejected: tag and digest. parse_repository_tag splits at @ first, so it returns the digest as the tag and the repository assertion fails. The test would need a change to strip the digest.
  • Which fixed-in release does line (1, 109) need in GATEWAY_ADVISORY_FIXED_IN?: Line (1, 109) needs 1.109.0, the first release of the line. The two advisory fixes shipped by 1.103.10, so every 1.109 release holds them. The value stays at or below the pinned v1.109.1. [sources: tests/ai/benchmark/test_k8s_llm_gateway.py:65]
  • Which LiteLLM 1.106.1 and 1.109.0 action items change k8s/llm/gateway/config.yaml?: The change reads the file and applies each item that its settings use. The 1.109.0 items are the removed disk cache, optional_pre_call_checks enforce_model_rate_limits for a hard rpm cap, changed Gemini parameters and list fallback targets that the config already uses. The 1.106.1 item is a script for old vector stores. [sources: k8s/llm/gateway/config.yaml]
  • Does the Deployment change its update strategy for the move?: Keep the default RollingUpdate and add no strategy field. The v2 migration resolver makes the two-version window safe, and Recreate would stop every model call until the new pod starts. (best practice) [sources: k8s/llm/gateway/deployment.yaml]
    • Chosen: keep the default RollingUpdate. It starts the new pod first and keeps the old pod for its open calls in the 600 s grace period. The v2 lock serializes the migrations.
    • Rejected: Recreate. Every model call fails until the new pod is ready, and the 600 s termination grace exists to let open calls finish.
  • How does the change back up llm-gateway-db before the migration?: Take a CloudNativePG on-demand backup of the llm-gateway-db Cluster when its manifest configures a backup store. Use pg_dump of the database when it configures none. (best practice) [sources: k8s/llm/gateway-db.yaml, openspec/specs/llm-gateway-database/spec.md]
    • Chosen: CloudNativePG on-demand backup. The operator takes a consistent backup of the Cluster, and the manifest is read for its backup store.
    • Rejected: pg_dump. It is the fallback when the Cluster configures no backup store, because the dump needs a place to write.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/infra
    scope/k8s
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor

    New evidence (2026-11-13, read-only investigation of the LiteLLM gateway):

    • The gateway uses the default v1 migration resolver. Loki over 7 days: 15 lines Using default (v1) migration resolver. If your deployment has seen schema thrashing during rolling deploys, try --use_v2_migration_resolver (11 starts and 4 crashes). proxy_cli.py:962-972: flag, env var USE_V2_MIGRATION_RESOLVER, default False.
    • The Deployment sets no strategy, so each rollout runs two LiteLLM versions on one database. On 2026-11-12 at 14:28:41Z, the v1.103.11 pod started while the v1.103.10 pod still wrote to the database. There was no thrash (No pending migrations), but this upgrade moves 6 minor lines and applies many migrations while the old pod runs. v1 runs a diff-and-force step for pending migrations (litellm_proxy_extras utils.py:1373-1377). v2 holds a Postgres advisory lock (migration_lock.py). The image installs the extra_proxy extra (Dockerfile:83, :105), so v2 has psycopg.
    • Proposal: with this upgrade or after it, add the env entry USE_V2_MIGRATION_RESOLVER="true" to the litellm container in k8s/llm/gateway/deployment.yaml. Expect Using v2 migration resolver at the next start.
    • Caveat for runbooks and alerts, to write next to the env entry: under v2, a P1001 at start exits with code 2 and the text Database migration failed and cannot be auto-recovered. Manual intervention required. For a P1001 this text is false, because the database was only unreachable.
  6. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The searches for LiteLLM schema-migration tooling and for a tool that performs an image move with its config work returned nothing relevant, and the upstream release notes show the upgrade steps are LiteLLM's own action-required items, not a separate tool. This issue is an in-repo operational change (pin the image and digest, adapt config.yaml, extend GATEWAY_ADVISORY_FIXED_IN, back up the DB, run the smoke calls), and it explicitly states that no new code or tool is wanted, so no tool covers it.

    Tool: none found

    Lacks:

    • Applying the Prisma schema migrations of the 1.106/1.109 lines safely while the old pod still runs
    • Checking k8s/llm/gateway/config.yaml against the 1.106.1 and 1.109.0 action items
    • Extending GATEWAY_ADVISORY_FIXED_IN with the fixed-in release of each new line
    • Backing up llm-gateway-db and running the per-model-group smoke calls (test(k8s): run gateway smoke calls after LiteLLM upgrade #4885)
    • Bumping the image and digest in k8s/llm/gateway/deployment.yaml (Renovate only offers the bump; the rest of the work stays manual)

    Searches run:

    • LiteLLM proxy Prisma database schema migration rolling deployment v2 migration resolver, results: 5
    • tool to manage container image version bump and database migration safety for LiteLLM gateway, results: 5
    • Renovate update container image digest in Kubernetes deployment yaml, results: 5
    • BerriAI litellm releases v1.109.0 breaking changes USE_V2_MIGRATION_RESOLVER, results: 5

    Sources:

    Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.

  7. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  8. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at b8c7632 (see proposed design in issue body).

  9. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (4)

    Tools considered:

    Searches run:

    • Renovate automated container image digest updates Kubernetes manifests, results: 5
    • tool to automate LiteLLM proxy version upgrade and config migration, results: 5
    • Renovate bot github.com renovatebot renovate, results: 5
    • litellm prisma schema migration upgrade breaking changes, results: 5

    Sources:

  10. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Closed: the gateway already runs a newer release.

    k8s/llm/gateway/ is in dan-petty/homelab, which pins LiteLLM 1.111.0, and the live Deployment runs it. The advisory test in this repository is gone. The design also asked for USE_V2_MIGRATION_RESOLVER, which the homelab Deployment does not set. File a dan-petty/homelab item if you still want it.

  11. removed
    status/ready
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/k8ssource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions