Repository navigation
Description
Problem
The roadmap Service calls the LLM gateway with the master key, the same key as every other caller. So the gateway cannot set a budget or a requests-per-minute limit for the Service, and a fault in the Service can spend without limit. The end_user label shows the spend per caller, but this label sets no limit.
The Service and the cluster Jobs read DEVOPS_CLI_AI_API_KEY from the same Secret devops/devops-cli (k8s/devops/roadmap-service/deployment.yaml, k8s/devops/cronjob.yaml). #1635 puts the change of the key of the Jobs out of its scope. So the Service needs its own source for this variable.
This work cannot start yet. LiteLLM keeps virtual keys only in Postgres, and the gateway has no database: no manifest under k8s/ sets DATABASE_URL, and general_settings in k8s/llm/gateway/config.yaml has no database setting. #1635 adds the database.
Blocked by #1635.
Expected
The Service calls the gateway with its own virtual key, and the key has a budget and a requests-per-minute limit. The Jobs keep their key. The Service holds no reference to the master key.
A person mints the key and stores it, because only a person changes secrets (AGENTS.md). The pull request names the Secret and the key name, and no key value.
Acceptance criteria
kustomize build k8s/devops/roadmap-service/gives a Deployment that readsDEVOPS_CLI_AI_API_KEYfrom the source of the virtual key, and not from the source of the master key.- A person mints the key, with a budget and a requests-per-minute limit. This is a step for a person, and
k8s/README.mdgives the step. k8s/README.mdsays which key the Service uses and how to rotate it.CLUSTER_SECRETS(src/devops_cli/k8s/cluster_secrets.py) has a row for the key ifdevops k8s push-secretspushes it, and a test covers the row.
Existing tool considered
LiteLLM virtual keys, on the gateway that is deployed. Nothing is built.
Related
- feat(k8s): the LiteLLM gateway keeps virtual keys in an in-cluster Postgres, so devops-cli can mint scoped, expiring gateway keys #1635 adds the database that this item needs. It must merge first.
- feat(service): the devops-cli dashboard shows the Service and filters by job #2479 was the first home of this part. It keeps the dashboard row, the
jobvariable and the budget sentence.
Source: #2479
Alternatives check of 2026-11-08: covers.
Tool: BerriAI/litellm (https://github.com/BerriAI/litellm), NOASSERTION, last activity 2026-11-08, maintained.
Proposed design
Problem statement
The roadmap Service and CronJob roadmap-stage read DEVOPS_CLI_AI_API_KEY from Secret devops-cli, which holds the gateway master key. The gateway sets no budget and no requests-per-minute limit for the Service, so a fault in the Service can spend without limit. The gateway database that LiteLLM virtual keys need is delivered (#1635), so the change can be built. The change gives the Service and its stage Job one virtual key with a budget, a requests-per-minute limit and a model list, and leaves the other cluster Jobs on their key.
Acceptance criteria
Requirement: Service reads its virtual key
The roadmap Service Deployment SHALL read DEVOPS_CLI_AI_API_KEY from the api-key key of Secret roadmap-service-llm-key and SHALL NOT take that variable from Secret devops-cli.
Scenario: Build the roadmap Service kustomization
- WHEN A person runs
kustomize build k8s/devops/roadmap-service/. - THEN The Deployment has one
enventryDEVOPS_CLI_AI_API_KEYwithsecretKeyRefnameroadmap-service-llm-keyand keyapi-key, and the pod template has noenvFromentry for Secretdevops-cli.
Requirement: Service stops loading the shared Secret
The roadmap Service pod template SHALL NOT load Secret devops-cli with envFrom, and SHALL read each other variable of that Secret with an explicit secretKeyRef.
Scenario: Inspect the pod environment sources
- WHEN The built Deployment is read.
- THEN The pod template has no
envFromentry, and the six variablesDEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY,DEVOPS_CLI_SERVICE_WEBHOOK_SECRETS,DEVOPS_CLI_FIRECRAWL_API_KEY,DEVOPS_CLI_VALKEY_PASSWORD,DEVOPS_CLI_MATTERMOST_COMMAND_TOKENandDEVOPS_CLI_CRAWL4AI_API_TOKENeach have asecretKeyRefto Secretdevops-cli, withoptional: trueon the four optional keys.
Requirement: Stage Job reads the virtual key
CronJob roadmap-stage SHALL read DEVOPS_CLI_AI_API_KEY from the api-key key of Secret roadmap-service-llm-key and SHALL keep DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY from Secret devops-cli.
Scenario: Build the devops kustomization
- WHEN A person runs
kustomize build k8s/devops/. - THEN CronJob
roadmap-stagehas anenventryDEVOPS_CLI_AI_API_KEYwithsecretKeyRefnameroadmap-service-llm-keyand keyapi-key, and itsDEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEYentry still names Secretdevops-cli.
Requirement: Stage Job key constant and policy agree
CONST_ROADMAP_STAGE_JOB_SECRET_KEYS and the admission policy roadmap-service-jobs SHALL name Secret roadmap-service-llm-key key api-key as the source of DEVOPS_CLI_AI_API_KEY of a stage Job pod.
Scenario: Read the stage Job key constant and the policy
- WHEN A test reads
CONST_ROADMAP_STAGE_JOB_SECRET_KEYSandk8s/devops/roadmap-service/admissionpolicy.yaml. - THEN The entry of
DEVOPS_CLI_AI_API_KEYnames Secretroadmap-service-llm-keyand keyapi-key, and no entry of the constant or the policy names Secretdevops-clifor that variable.
Requirement: Virtual key is a cluster secret row
CLUSTER_SECRETS SHALL hold a row for Secret devops/roadmap-service-llm-key with the key api-key from keyring roadmap_service_llm_key, and keyring_only_keys() SHALL declare that keyring key.
Scenario: Read the cluster secret table
- WHEN A test reads
CLUSTER_SECRETSandkeyring_only_keys(). - THEN It finds the row
devops/roadmap-service-llm-keywith the entryapi-keyfrom keyringroadmap_service_llm_keyand the restart ofdeployment/roadmap-service, andkeyring_only_keys()holdsroadmap_service_llm_key.
Requirement: README gives the Service key step
k8s/README.md SHALL give the step for a person to mint the virtual key of the roadmap Service with a budget and a requests-per-minute limit, and to rotate it.
Scenario: Read the Service key section
- WHEN A person reads the roadmap Service steps and the Cluster Secrets table of
k8s/README.md. - THEN It names Secret
devops/roadmap-service-llm-key, keyapi-key, keyringroadmap_service_llm_key, the modelsdeepseek-v4.1-flash-1017andqwen3-embedding:0.6b,max_budget100 withbudget_duration30d,rpm_limit300, the mint step and the rotation step, and the Cluster Secrets table holds the row.
Requirement: README names the Service as a virtual-key caller
k8s/README.md SHALL name the roadmap Service as a caller that sends a virtual key, and SHALL keep the master key for the cluster Jobs and Open WebUI.
Scenario: Read the gateway caller paragraph
- WHEN A person reads the AI spend dashboard paragraph and the gateway database section of
k8s/README.md. - THEN The text names Secret
roadmap-service-llm-keyas the key of the Service and the master key as the key of the cluster Jobs and Open WebUI, and it no longer says that every caller sends the master key.
Requirement: Cluster Job templates keep their key
The cluster Job templates SHALL keep reading DEVOPS_CLI_AI_API_KEY from Secret devops/devops-cli, and no template other than roadmap-stage SHALL name Secret roadmap-service-llm-key.
Scenario: Build the devops kustomization
- WHEN A person runs
kustomize build k8s/devops/. - THEN CronJob
devops-clistill has itsenvFromentry for Secretdevops-cliand noDEVOPS_CLI_AI_API_KEYoverride, and no other CronJob underk8s/devops/names Secretroadmap-service-llm-key.
Existing Tool Considered
LiteLLM virtual keys (https://github.com/BerriAI/litellm) cover the need: the deployed gateway mints a per-key budget, a requests-per-minute limit and a model list, stored in the gateway database. LiteLLM lacks a way to mint or rotate a key without a person, and it ships no Kubernetes manifest and no keyring row; this repository adds those. Nothing is built.
Key questions
- The alternatives check found that
https://github.com/BerriAI/litellmcovers this item. Adopt the tool, or keep the item and give the reason.: Adopt the tool. The reply of the issue works from the Service's own virtual key and asks for the stage Job to share it. The Service and its stage Job then get one LiteLLM virtual key with a per-key budget, a requests-per-minute limit and a model list. (best practice) [sources: k8s/README.md, k8s/llm/gateway/config.yaml]- Chosen: Adopt LiteLLM virtual keys for the Service. The key bounds the spend and the request rate of the Service, and the gateway database that keys need is delivered.
- Rejected: Keep the master key. The gateway sets no budget and no requests-per-minute limit for the Service, which is the problem.
- Does this item change the key source of the stage Job, and which key does the stage Job get?: Yes. CronJob
roadmap-stagereads the same virtual key as the Service: Secretroadmap-service-llm-key, keyapi-key. The reply of the issue asks for the same key or one of its own, with a budget, and it names the template,CONST_ROADMAP_STAGE_JOB_SECRET_KEYSand the admission policyroadmap-service-jobsas one change. The stage Job template exists now, and feat(roadmap): run each stage item in its own Job #4559 only makes the Service create the Jobs, so the change needs no other item first. (best practice) [sources: k8s/devops/cronjob-stage.yaml, src/devops_cli/config/constants.py, k8s/devops/roadmap-service/admissionpolicy.yaml, docs/CLUSTER.md]- Chosen: The stage Job reads the same virtual key as the Service. One key, one budget and one person step cover the Service and the Jobs that it creates, and the stage Job is the Service's own work.
- Rejected: The stage Job gets its own virtual key. A second key needs a second Secret, a second keyring entry, a second cluster secret row and a second person step.
- Rejected: The stage Job keeps the master key. After feat(roadmap): run each stage item in its own Job #4559 most of the Service's model spend runs in that pod, so the gateway would bound nothing there.
- Which Secret and key hold the Service virtual key?: Secret
devops/roadmap-service-llm-keywith keyapi-key, from keyringroadmap_service_llm_key. TheCLUSTER_SECRETSrow restartsdeployment/roadmap-service. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py, k8s/devops/roadmap-service/deployment.yaml, k8s/README.md]- Chosen: A new Secret
roadmap-service-llm-keyin namespacedevops. The Service has one source for its key,push-secretswrites one row, and Secretdevops-clikeeps only the variables that the Service and the Jobs share. - Rejected: A new key in Secret
devops-cli. The Service reads that Secret withenvFrom, so it would still receive the master key under the nameDEVOPS_CLI_AI_API_KEY. - Rejected: Reuse the master key. The gateway cannot set a budget or a requests-per-minute limit for the Service.
- Chosen: A new Secret
- How does the Service stop reading the master key from Secret
devops-cli?: Remove theenvFromentry for Secretdevops-cliand read each other Service variable with an explicitsecretKeyRef, withoptional: trueon the optional keys. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, src/devops_cli/k8s/cluster_secrets.py]- Chosen: Remove
envFromand use explicitsecretKeyRefentries. The Deployment then names one source for each variable, and no source ofDEVOPS_CLI_AI_API_KEYis Secretdevops-cli. - Rejected: Keep
envFromand add anenvoverride. The Deployment then readsDEVOPS_CLI_AI_API_KEYfrom two sources, and a reader cannot tell which source wins. - Rejected: Split Secret
devops-cliinto a Service Secret and a Job Secret. The cluster Job templates read that one Secret withenvFrom, so a split changes their templates and their secret row too.
- Chosen: Remove
- Which model list does the Service virtual key allow?: The two models that the Service ConfigMap names:
deepseek-v4.1-flash-1017for every chat slot andqwen3-embedding:0.6bfor embedding. A model change needs a new key. (best practice) [sources: k8s/devops/configmap.example.yaml, k8s/llm/gateway/config.yaml]- Chosen: Restrict the key to the two models of the ConfigMap. The key cannot call another group, such as a hosted model that the Service does not name.
- Rejected: Allow every model of the gateway. The key could call every hosted group, and only the budget would bound the spend.
- What budget and requests-per-minute limit does the Service virtual key set?:
max_budget100 USD withbudget_duration30d, andrpm_limit300. The budget bounds a runaway loop, and 300 requests a minute is above the burst of a stage round and still caps a loop. (best practice) [sources: k8s/devops/configmap.example.yaml, k8s/README.md]- Chosen: 100 USD per 30 days and 300 requests per minute. It bounds the Service's own hosted spend and request rate, with room for a stage round of 3 plans of about 23 requests each.
- Rejected: No limit. A fault in the Service spends without limit, which is the problem.
- Rejected: 10 USD per 30 days and 60 requests per minute. A stage round of 3 plans can exceed 60 requests in a minute, so the gateway would refuse legitimate work.
- Does the gateway database that virtual keys need exist?: Yes. feat(k8s): the LiteLLM gateway keeps virtual keys in an in-cluster Postgres, so devops-cli can mint scoped, expiring gateway keys #1635 is delivered:
k8s/llm/gateway-db.yamldefines the gateway database, and the gateway Deployment readsDATABASE_URLfrom theurikey of Secretllm-gateway-db-app. The block in the issue is stale. [sources: k8s/llm/gateway-db.yaml, k8s/llm/gateway/deployment.yaml, k8s/README.md, openspec/changes/archive/2026-11-06-1635-gateway-database/design.md] - Who mints the virtual key and sets its budget and requests-per-minute limit?: A person, because only a person changes secrets. The person mints the key at the gateway with
POST /key/generate(aliasroadmap-service, the two models,max_budget100 withbudget_duration30d,rpm_limit300), stores it withuv run keyring set devops-cli roadmap_service_llm_key, and pushes it withuv run devops k8s push-secrets --only devops/roadmap-service-llm-keybeforepush-secrets --stack devops. To rotate, the person mints a new key, stores it, pushes with--rotate, and deletes the old key in the gateway. (a person decides) [sources: AGENTS.md, k8s/README.md]
Open questions
- Who mints the virtual key and sets its budget and requests-per-minute limit? (a person decides)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(service)scope of the title gives the scope.It reduces blast radius of the master key but is blocked by #1635 and the Service works today.It caps Service spend and isolates its fault, but the master key still functions and no user-facing feature is added.The change is a k8s manifest edit, a README note, and one CLUSTER_SECRETS row with a test.Both concern virtual gateway keys, but #1635 adds the Postgres backend so keys can be minted, while the candidate points the Service Deployment at one such key.feat(service): chart the Service and filter the CLI dashboard by job (#…
devops-cli-service commentedon Nov 7, 2026
Refine cannot set this item to Ready at 72c52c6 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
devops-cli-service commentedon Nov 8, 2026
Alternatives check: covers
Reason: LiteLLM's virtual keys are the mechanism the item itself names, and they give a per-key budget, a requests-per-minute limit and a model list stored in the gateway database, so one key minted for the Service bounds its spend and rate without touching the Jobs' key. The searches found only LiteLLM itself (an active, non-archived gateway project with Postgres-backed keys, budgets and spend tracking), and no other tool covers this need.
Tool: BerriAI/litellm (https://github.com/BerriAI/litellm)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-08. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 8, 2026
Refine cannot set this item to Ready at 1f03ee3 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
https://github.com/BerriAI/litellmcovers this item. Adopt the tool, or keep the item and give the reason. (a person decides)dan-petty commentedon Nov 13, 2026
A new caller of the gateway: the stage Job (#5483, PR #5545; the Service switches to it in #4559). CronJob
roadmap-stagegives its podDEVOPS_CLI_AI_API_KEYthroughsecretKeyRefof Secretdevops-cli, which is a copy of the master key. After #4559 the stage planner runs in this pod and not in the Service pod, so most of the model spend of the Service moves to it.When this item gives the Service a virtual key, give the stage Job the same key or one of its own, with a budget. The admission policy
roadmap-service-jobspins the key names of a stage Job (CONST_ROADMAP_STAGE_JOB_SECRET_KEYS), so the change of the key source changes the template, the constant and the policy in one pull request. Found in the review of #4559 (findinggateway-master-key-in-job-pods).devops-cli-service commentedon Nov 14, 2026
Refine cannot set this item to Ready at ffce5d9 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
fix(k8s): push the Service gateway key from the keyring (#3685)
test(k8s): hold the Service key row in the cluster expectations (#3685)
merge origin/main into the Service key branch (#3685)
devops-cli-service commentedon Nov 14, 2026
Released in v0.140.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.140.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 21:08 UTC