Skip to content

fix(k8s): load only the needed Secret keys in runner Jobs - #6520

Merged
dan-petty merged 5 commits into
mainfrom
fix/6518-runner-secret-keys
Nov 20, 2026
Merged

dan-petty merged 5 commits into
mainfrom
fix/6518-runner-secret-keys

Conversation

@dan-petty

@dan-petty dan-petty commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

The runner Job template took the whole Secret devops-cli with envFrom, so each implement and fix-checks pod held all 10 keys, but its jobs read only 2. It now takes only DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY and DEVOPS_CLI_AI_API_KEY through secretKeyRef, as a stage Job does. No Secret or key name is new.

The admission policy roadmap-service-jobs admits those 2 keys in a runner Job and still refuses them in a planner run Job. It refuses envFrom in the CREATE of a Job, and admits envFrom of devops-cli only in the UPDATE of a runner Job made before the sync, which the Service patches.

The docs and the qdrant-read-only-key spec name the pods that hold the MCP token and the Qdrant read-only key (the runner holds neither). Refs #5498: a key table for each job.

Closes #6518

Change: openspec/changes/archive/2026-11-20-6518-runner-secret-keys/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/k8s Kubernetes commands, Helm charts, pods, services, and policies labels Nov 20, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Key-to-reader map

The key names of Secret devops/devops-cli come from kubectl get secret -o go-template with the names only (2026-11-20). No value was read.

Key Reader in src/ Runner Job
DEVOPS_CLI_SERVICE_GITHUB_APP_PRIVATE_KEY github/app_installation.py, github/app_token.py: the job acts as the App kept
DEVOPS_CLI_AI_API_KEY get_ai_api_key: the model client and the step broker (implement_broker.py) kept
DEVOPS_CLI_VALKEY_PASSWORD valkey/cache.py, valkey/client.py: RAG embeddings, library store, vulnerability lookup, TUI dropped: no runner module calls them
DEVOPS_CLI_QDRANT_API_KEY ai/rag/qdrant.py, ai/rag/indexer.py dropped: no runner module calls them
DEVOPS_CLI_MCP_IMPLEMENT_TOKEN roadmap/mcp.py, only when roadmap.implement.mcp is true dropped: false by default and in the live ConfigMap
DEVOPS_CLI_MCP_STAGE_TOKEN roadmap/mcp.py, planning role (stage) dropped
DEVOPS_CLI_FIRECRAWL_API_KEY ai/web_search.py (refine and stage) dropped
DEVOPS_CLI_CRAWL4AI_API_TOKEN ai/page_text.py (Service); no NetworkPolicy lets a Job pod reach Crawl4AI dropped
DEVOPS_CLI_MATTERMOST_COMMAND_TOKEN server/ slash command (Service) dropped
DEVOPS_CLI_SERVICE_WEBHOOK_SECRETS server/service.py (Service) dropped

Other paths:

  • A child process gets no key: build_subprocess_env drops each name with KEY, TOKEN, SECRET or PASSWORD.
  • The step shell gets only PATH, HOME, LANG, LC_* and shell_environment.
  • Telemetry sends to the OTLP collector with no key.

Proof on head 301c7cf

  • kubectl kustomize k8s/overlays/homelab/devops: CronJob devops-cli-runner has envFrom: None and only 2 secretKeyRef entries.
  • build_job keeps both entries in the implement Job and the fix-checks Job. The Service passes only DEVOPS_CLI_SERVICE_GITHUB_APP_TOKEN_REPOSITORY, PYTEST_XDIST_AUTO_NUM_WORKERS and OTEL_SERVICE_NAME.
  • Red, new template with the old policy: uv run devops ci --check --only k8s gave 178 cases, 57 failed (An env entry must not use valueFrom ...). Green with the new policy: 178 cases, 0 failed.
  • Live policy, server dry run as the Service: the Job of the new template is refused with the same message, and the Job with envFrom is admitted. So the policy change must ship with the template.
  • load_settings with the live ConfigMap and only the 2 keys loads. The getters of the dropped keys return no value.
  • uv run devops ci test on the test modules that build Jobs from the runner template, and tests/k8s/: 1,043 passed and 1 failed. test_roadmap_implement_submit.py read entry["value"] from each env entry, and an entry with valueFrom has none; it now uses .get. After the fix: 210 passed in the submit, deadline, trace-subject and outside modules.
  • uv run devops ci docs passed. uv run devops openspec check passed.

Sync order and live Jobs

  • Argo CD applies a CronJob before a ValidatingAdmissionPolicy in one wave (gitops-engine sync_tasks.go). For some seconds, the old policy refuses a Job of the new template. The implement row takes back its claim, the fix-checks round counts round_error, and the next round tries again.
  • The policy still admits envFrom of the Secret for a runner Job. A Job made before the sync keeps envFrom, and the Service patches its deadline and resumes a waiting fix Job. A gate check holds this.

Not proved before the merge

The proof that the issue asks for: an implement Job and a fix-checks Job run green after the Argo CD sync. That needs the merge.

@dan-petty

Copy link
Copy Markdown
Owner Author

Overlap and review notes

@dan-petty

Copy link
Copy Markdown
Owner Author

Check results

Head commit: 301c7cf397e25c9d2e30eaf5411f3783b589c4dd

Check Conclusion Link
Tests & Coverage success run
Trivy success run
devops-cli success run
zizmor success run
trivy-config success run
Plan Check skipped run
CodeQL success run
Dependency Freshness skipped run
Tests on Main skipped run
Test Job Duration skipped run
Tests & Coverage (shard 4 of 5) success run
Service Image success run
Semantic PR title success run
Tests & Coverage (shard 1 of 5) success run
Static Analysis success run
Tests & Coverage (shard 2 of 5) success run
Changed-Test Independence success run
Image Pins success run
Tests & Coverage (shard 5 of 5) success run
MCP Server Image success run
Runner Image success run
Tests & Coverage (shard 3 of 5) success run
Analyze (actions) success run
Design Tokens success run
Fail-to-Pass Check success run
Docs Site Build success run
Analyze (python) success run

Fail-to-pass run: https://github.com/dan-petty/devops-cli/actions/runs/44752884972/job/136344999137

Skipped check: Plan Check
Skipped check: Dependency Freshness
Skipped check: Tests on Main
Skipped check: Test Job Duration

@dan-petty
dan-petty force-pushed the fix/6518-runner-secret-keys branch from 016aea7 to a813385 Compare November 20, 2026 15:38
@devops-cli-service

Copy link
Copy Markdown
Contributor

Pull request #6520 has merge conflicts with main at commit a813385c811d. GitHub cannot merge it. Rebase the branch onto the current main, resolve the conflicts and push the branch.

The runner template takes the App key and the gateway key of Secret
devops-cli through secretKeyRef in place of the whole Secret. The admission
policy admits the 2 keys for a runner Job.

Refs #6518
…r key guard

The policy admitted a runner Job with envFrom of Secret devops-cli on a
CREATE. It now reads request.operation and admits that envFrom only in
the UPDATE of a runner Job, which the Service sends to a Job made before
#6518. A gate check covers the planner guard of the valueFrom rule.

The docs name the pods that hold the MCP token, what turns an MCP client
on, and why the namespace of a Job is a plain value (fieldRef).
YAML ended the plain message of the envFrom rule at ' #6518'. The message
names the issue with no '#' now, and a check compares its whole text. New
cases refuse envFrom in the UPDATE of a stage Job and of a planner run Job,
and envFrom of a ConfigMap or another Secret in the UPDATE of a runner Job.

The runner pod holds no Qdrant key and no MCP token now, so the Qdrant
spec, SECURITY.md, k8s/README.md, ENV_VARS.md and the comments name the
pods that hold them.
… key (#6518)

A pod that loads Secret devops-cli with envFrom holds the read-only key only when it sets no Qdrant key of its own; rag-ingest sets the admin key. The cluster_secrets comment no longer names the runner and the Service.
@dan-petty
dan-petty force-pushed the fix/6518-runner-secret-keys branch from a813385 to d8d043e Compare November 20, 2026 15:58
@dan-petty
dan-petty marked this pull request as ready for review November 20, 2026 16:11
@dan-petty
dan-petty merged commit a656f4b into main Nov 20, 2026
30 checks passed
@dan-petty
dan-petty deleted the fix/6518-runner-secret-keys branch November 20, 2026 16:12
dan-petty pushed a commit that referenced this pull request Nov 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.183.1](v0.183.0...v0.183.1)
(2026-11-20)


### Bug Fixes

* **k8s:** load only the needed Secret keys in runner Jobs
([#6520](#6520))
([a656f4b](a656f4b)),
closes [#6518](#6518)
* **roadmap:** Name the failed refine form check to the model
([#6507](#6507))
([582ad22](582ad22))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(k8s): load only the needed Secret keys in runner Jobs

1 participant