Repository navigation
Description
Split from #5498.
ProblemnA runner or stage pod holds DEVOPS_CLI_AI_API_KEY. src/devops_cli/k8s/cluster_secrets.py can adopt that key from key master-key of Secret llm/llm-gateway-secrets (adopt_from). If the key came from there, each pod holds the master key of the gateway.nnn## Why deferrednA person must create a virtual key for each Job and set its spend limit. No Secret value was read, so the values were not compared. #5498 narrows the GitHub token only.nnn## Acceptance criterian- uv run devops ci --check --only k8s passes and reports no Job that adopts key master-key of Secret llm/llm-gateway-secrets.n- A gate check fails when a Job template or cluster_secrets.py adopts the gateway master key.n- A live check shows that a runner Job calls the gateway with a virtual key that has a spend limit. The issue comment gives the key name and the limit, with no key value.
Proposed design
Problem statement
A runner or stage pod reads DEVOPS_CLI_AI_API_KEY from Secret devops/devops-cli. The table in src/devops_cli/k8s/cluster_secrets.py adopts that value from master-key of Secret llm/llm-gateway-secrets. Each pod then holds the gateway master key, so no spend limit applies. The change reads a LiteLLM virtual key with a spend limit from the keyring. A gate fails when a Job template or the table adopts the master key.
Acceptance criteria
Requirement: The job key is a keyring virtual key
The DEVOPS_CLI_AI_API_KEY entry of Secret devops/devops-cli SHALL read a LiteLLM virtual key from the keyring and MUST NOT adopt master-key of Secret llm/llm-gateway-secrets.
Scenario: The table has no master-key adoption
- WHEN the unit test loads
CLUSTER_SECRETSfromsrc/devops_cli/k8s/cluster_secrets.py - THEN no entry has an
adopt_fromthat names Secretllm-gateway-secretskeymaster-key, and theDEVOPS_CLI_AI_API_KEYentry readsKeyringSource.for_credential("runner.llm_key").
Requirement: The k8s gate reports no master-key adoption
The k8s gate check SHALL pass only when no Job template and no Secret entry adopts master-key of Secret llm/llm-gateway-secrets.
Scenario: The clean tree passes the gate
- WHEN a person runs
uv run devops ci --check --only k8s - THEN the command exits 0 and prints no finding that names Secret
llm-gateway-secretskeymaster-key.
Requirement: The gate finds an adoption in the table
The k8s master-key check SHALL report one finding for a Secret entry that adopts master-key of Secret llm/llm-gateway-secrets.
Scenario: A crafted table holds an adoption
- WHEN the unit test runs the master-key check on a
ClusterSecretwhose entry hasadopt_fromofllm/llm-gateway-secretskeymaster-key - THEN the check returns one finding that names the Secret and the key
master-key.
Requirement: The gate finds an adoption in a Job template
The k8s master-key check SHALL report one finding for a Job template that sets DEVOPS_CLI_AI_API_KEY from master-key of Secret llm/llm-gateway-secrets.
Scenario: A fixture Job template holds an adoption
- WHEN the unit test runs the master-key check on a fixture directory that holds a Job template with
secretKeyRefto Secretllm-gateway-secretskeymaster-key - THEN the check returns one finding that names the fixture file and the key
master-key.
Requirement: Pending a person after the merge
A runner Job SHALL call the gateway with a virtual key that has a spend limit.
Scenario: The key info after one runner Job
- WHEN a person mints the Job virtual key with a spend limit, stores it in the keyring under
runner.llm_key, pushes the Secrets, runs one runner Job, and runscurl -s -H "Authorization: Bearer $LITELLM_MASTER_KEY" "$LLM_GATEWAY_URL/key/info?key=$RUNNER_KEY" - THEN the response shows the key alias, the
max_budgetthat the issue comment records, and aspendabove zero.
Existing Tool Considered
No alternatives check has run. LiteLLM, the gateway that the cluster already runs, covers the need. Its virtual keys carry max_budget, budget_duration and rpm_limit. The repository already uses one for the Service (devops/roadmap-service-llm-key, #3685). LiteLLM lacks a way to keep its own master key out of a pod. The project's table and gate do that. This change adds them. LiteLLM also needs a person to mint the key and set the budget, because its admin API needs the master key or a management key. The change writes one table row and one gate check. It builds no budget code, because the gateway enforces the limit.
Key questions
- Which table entry adopts the gateway master key today?: The
DEVOPS_CLI_AI_API_KEYentry of Secretdevops/devops-clisetsadopt_from=SecretKeyRef("llm", "llm-gateway-secrets", "master-key"). It also setsvalue_prefix=LITELLM_KEY_PREFIX. [sources: src/devops_cli/k8s/cluster_secrets.py] - How does a Job pod get a virtual key with a spend limit?: The table reads a person-minted LiteLLM virtual key from the keyring under
runner.llm_key, withrequired=Falseandvalue_prefix="sk-", and drops the master-key adoption. The gateway enforces the spend limit on the key, so the pod holds no budget code. The change registersrunner.llm_keyas a managed credential, so a person stores the value withdevops config set. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py]- Chosen: Read a keyring virtual key for the Job pods. LiteLLM enforces
max_budgetandbudget_durationon the key. The repository already uses this pattern for the Service (feat(service): the roadmap Service uses its own gateway key #3685). - Rejected: Adopt the master key and set a gateway-wide budget. The master key creates and deletes keys and reads every key. A pod with it bypasses each per-key budget.
- Rejected: Make the Service mint one key per Job object. It needs a management key, a per-Job Secret and cleanup. The issue records one key name and one limit.
- Chosen: Read a keyring virtual key for the Job pods. LiteLLM enforces
- How does the gate catch a return of the master-key adoption?: The k8s check scans the Job templates under
k8s/and theCLUSTER_SECRETStable forllm/llm-gateway-secretskeymaster-key, and reports one finding for each adoption. Unit tests run the check on a fixture Job template and on a crafted table, so a check that stops catching the adoption fails. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py, docs/adr/0004-ci-is-the-authoritative-gate.md]- Chosen: Add the scan to
uv run devops ci --check --only k8sand test it. The required checkStatic Analysisruns the gate, so a return fails CI. - Rejected: Rely on review. A review is not a binding gate (ADR 0004).
- Chosen: Add the scan to
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 25, 2026
Both items work on the LiteLLM virtual-key infrastructure in-cluster, but #1635 builds the Postgres-backed key store while this candidate applies it to Jobs and adds a gate check.[-]feat(k8s): give each roadmap Job a virtual gateway key with a spend limit[/-][+]feat(k8s): give each job a virtual key with a spend limit[/+]devops-cli-service commentedon Nov 25, 2026
The job shortened the title of this item. The summary had 62 characters, and the limit is 60. The type and the scope stay.
feat(k8s): give each roadmap Job a virtual gateway key with a spend limitfeat(k8s): give each job a virtual key with a spend limitdevops-cli-service commentedon Nov 25, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 28, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.