Skip to content

fix(k8s): give the runner Jobs the credentials of the cache Valkey #7293

Done

Description

@dan-petty

Problem Description

The runner Jobs of the roadmap (stage, implement and fix-checks) send no credentials to valkey-devops, so the shared tier of the project brain is off in each of them. Each command fails with an authentication error, the circuit breaker opens, and each read goes to GitHub.

The Service pod reads DEVOPS_CLI_VALKEY_PASSWORD from the Kubernetes object of kind Secret named devops-cli (k8s/devops/roadmap-service/deployment.yaml:113). The Job templates do not: k8s/devops/cronjob-stage.yaml and k8s/devops/cronjob-runner.yaml hold only the App key and the gateway key. CONST_ROADMAP_STAGE_JOB_SECRET_KEYS (src/devops_cli/config/constants.py:4354) and the admission policy roadmap-service-jobs admit those two keys and no other.

Measured on 2026-11-26 in Prometheus, 24 hours:

Measure Value
devops_cli_valkey_cache_errors_total{job="roadmap-stage",error="auth"} 318
devops_cli_valkey_cache_errors_total{job="roadmap-stage",error="open"} 6,831
devops_cli_brain_reads_total{job="roadmap-stage",store="issue",result="fallback"} 3,507
devops_cli_brain_cache_total{job="roadmap-stage",row="stage"}, miss against hit 3,492 against 0
devops_cli_github_requests_total{job="roadmap-stage"} 11,756

The jobs roadmap-implement and roadmap-fix-checks show the same auth and open errors. The Service pod in the same hours: 3,650 hits of the row refine.

The network is not the cause: devops-default-perimeter-egress admits TCP 6379 to namespace llm, and the ingress policy of valkey-devops admits namespace devops.

Reproduction Steps

  1. Start a stage Job, and read the names of the environment variables of its pod: no variable of the Valkey password.
  2. Query sum by (job, error) (increase(devops_cli_valkey_cache_errors_total[24h])).

Expected vs Actual Behavior

  • Expected: a runner Job reads the brain caches (issue records, the listing snapshot, tool facts, embeddings) from the shared tier, as the Service pod does.
  • Actual: a runner Job has the local tier only, and it counts each read as fallback.

Proposed Fix

  • Add DEVOPS_CLI_VALKEY_PASSWORD from the object devops-cli only to the containers that already hold the private key of the App: prepare and publish of k8s/devops/cronjob-runner.yaml, and the one container stage of k8s/devops/cronjob-stage.yaml until refactor(k8s): run the stage Job as three containers #6814 splits it. The container agent gets no new key, so the rule of fix(k8s): load only the needed Secret keys in runner Jobs #6518 stays: a container in which a model runs commands holds only the keys that it needs.
  • Add the key to CONST_ROADMAP_STAGE_JOB_SECRET_KEYS, to its implement and fix-checks equals, and to the admission policy roadmap-service-jobs.
  • The key exists in the cluster today, so no step of a person comes before the merge.
  • These containers send the default user, as the Service does today. feat(k8s): turn off the valkey-devops default user #6600 moves each client to a role user and then turns the default user off.

Owner decision needed (AGENTS.md rule 5): the admission policy admits one more key for the Job pods. #6518 (2026-11-20) removed each key that a Job did not need, and the cache password was one of them, although the Job reads the cache. The containers that get the key already hold the private key of the App, which reads more than the cache does. The fix of the issue cache (#7292) must merge first, so that the cache holds public repositories only.

Acceptance Criteria

  • Test first: the Job that the builder makes for a stage item holds the variable of the Valkey password from the object devops-cli. The test fails on the base.
  • A test: the container agent of the runner Job holds no variable of the Valkey password.
  • A test: the admission policy admits the three keys and refuses a fourth.
  • Live proof after the release: devops_cli_valkey_cache_errors_total{job="roadmap-stage",error="auth"} stays at 0 for 24 hours, and devops_cli_brain_cache_total{job="roadmap-stage",result="hit"} is above 0. A comment gives the values and the GitHub requests of the stage Job for the same hours.

Environment Diagnostics

devops-cli 0.221.13, namespace devops, valkey-devops (valkey 9.2.0) with the default user and requirepass.

Dependencies

Related: #6013 (the issue cache), #4668 (the shared tiers), #4704 and #6600 (role users), #4624 (tracker).

Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches found only generic secret tooling (External Secrets Operator, Sealed Secrets, Kyverno), none of which passes a Valkey password into these Job containers; the fix is edits to this repo's Job manifests, constants and its own admission policy.

Lacks:

  • No tool adds the Valkey password variable to the Job pod specs
  • No tool maintains the Job secret key allowlist in the constants
  • No tool enforces the roadmap-service-jobs admission key list

Proposed design

Problem statement

The stage, implement and fix-checks Job pods have no Valkey password. Each cache read fails authentication, the circuit breaker opens, and the reads fall back to GitHub. The change adds the cache password to the Job containers that already hold the App private key and admits the third key in the constants and the admission policy. The change waits on #7292.

Acceptance criteria

Requirement: Stage Job builder cache password

The Job that build_job makes for a stage item SHALL set DEVOPS_CLI_VALKEY_PASSWORD from Secret devops-cli in container stage.

Scenario: Stage Job builder gate

  • WHEN I run uv run devops ci --check --only k8s.
  • THEN The command exits 0 and its stage-job check passes with the cache key in the built Job.

Requirement: Runner Job cache password

The runner Job template SHALL set DEVOPS_CLI_VALKEY_PASSWORD in containers prepare and publish and MUST NOT set it in container agent.

Scenario: Runner Job gate

  • WHEN I run uv run devops ci --check --only k8s.
  • THEN The command exits 0 and its runner check passes with the cache key in prepare and publish and no cache key in agent.

Requirement: Job secret key constants

The stage, implement and fix-checks Job secret-key constants SHALL include DEVOPS_CLI_VALKEY_PASSWORD.

Scenario: Constant key list

  • WHEN I run uv run pytest tests/gate/k8s_checks/job_admission_policy.py -q.
  • THEN The test passes and the constant lists the cache key for each Job kind.

Requirement: Admission policy key list

The admission policy roadmap-service-jobs SHALL admit DEVOPS_CLI_VALKEY_PASSWORD with the two existing Job keys and MUST refuse any other key.

Scenario: Admission policy gate

  • WHEN I run uv run devops ci --check --only k8s.
  • THEN The command exits 0 and the admission-policy check passes with the three admitted keys.

Requirement: Pending a person after the merge

After the release, the stage Job SHALL show no Valkey authentication errors and MUST show cache hits for 24 hours.

Scenario: Post-release live proof

  • WHEN A person queries Prometheus 24 hours after the release.
  • THEN devops_cli_valkey_cache_errors_total{job="roadmap-stage",error="auth"} is 0 and devops_cli_brain_cache_total{job="roadmap-stage",result="hit"} is above 0, and the comment gives the GitHub request count.

Existing Tool Considered

No alternatives check has run. No open, maintained tool covers this need: the work edits this repository's Job manifests, secret-key constants and admission policy. The written cost is about 6,000 tokens and 45 minutes to build, keep and test the change.

Key questions

  • Which containers receive the Valkey cache password?: Only container stage of the stage Job and containers prepare and publish of the runner Job receive DEVOPS_CLI_VALKEY_PASSWORD. Container agent receives no cache key. (best practice) [sources: k8s/devops/cronjob-stage.yaml:103, k8s/devops/cronjob-runner.yaml, k8s/devops/roadmap-service/deployment.yaml:113]
    • Chosen: App-key containers only. They already hold the App private key and need the cache. The agent runs model commands and stays minimal.
    • Rejected: All runner containers. It gives the cache secret to agent, which holds only the model key.
    • Rejected: No Job container. It keeps the shared cache off and leaves the measured auth errors.
  • Should the admission policy admit the cache password for Job pods?: Yes. Add DEVOPS_CLI_VALKEY_PASSWORD to the stage, implement and fix-checks key lists and to roadmap-service-jobs. The containers that receive it already hold the App private key, which reads more than the cache does. (best practice) [sources: src/devops_cli/config/constants.py:4354, k8s/devops/roadmap-service/admissionpolicy.yaml:172, k8s/devops/roadmap-service/deployment.yaml:113, k8s/README.md:285, docs/CLUSTER.md:99]
    • Chosen: Admit the third key. The Job reads the cache, and the same containers already hold the App private key.
    • Rejected: Keep the two keys. The Job keeps only the local tier and the measured auth errors continue.
    • Rejected: Admit the key to every container. Container agent runs model commands and needs no cache key.
  • Which Valkey user do the Job containers use?: Use the default user now, as the Service pod does. Move each client to a role user in feat(k8s): turn off the valkey-devops default user #6600. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml:113, k8s/README.md:285, docs/ENV_VARS.md:345]
  • Does the change need a new secret or a person step before the merge?: No. Secret devops-cli already holds the key, and the Service pod already reads it. [sources: k8s/devops/roadmap-service/deployment.yaml:113, k8s/README.md:285]
  • Which check proves the manifest and policy change before merge?: Run uv run devops ci --check --only k8s. It runs the stage-job, runner and admission-policy checks. (best practice) [sources: tests/gate/k8s_checks/stage_job.py, tests/gate/k8s_checks/runner.py, tests/gate/k8s_checks/job_admission_policy.py, AGENTS.md]
    • Chosen: Use the k8s gate. It already holds the three checks for these files.
    • Rejected: Add a new manifest test. It duplicates the gate and reads the file again.
    • Rejected: Use only the live proof. The proof comes after release and cannot gate the merge.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#7292

Activity

  1. added
    type/bug
    scope/k8s
    source/agent
    status/new
    effort/low
    value/high
    on Nov 26, 2026
  2. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor
    • Priority: Runner Jobs log 318 auth and 6,831 open errors per 24 h, and every read falls back to GitHub, causing increased error rates and API spend.
    • Related: fix(k8s): load only the needed Secret keys in runner Jobs #6518, which asks for a different change. Both items edit which Secret keys the runner Job pods receive, but #6518 removed excess keys while this candidate adds a missing key.
  3. added
    priority/p1-high
    on Nov 26, 2026
  4. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

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

    Searches (9)

    Tools considered:

    Searches run:

    • Kubernetes Job template inject Secret as environment variable secretKeyRef, results: 5
    • External Secrets Operator inject secret into CronJob pod environment, results: 5
    • Kyverno policy restrict which Secret keys may be referenced in env, results: 5
    • devops-cli roadmap runner Job cache Valkey credentials, results: 5
    • Valkey client password environment variable authentication cache, results: 5
    • kyverno policies documentation, results: 5
    • external-secrets operator documentation, results: 5
    • valkey documentation ACL requirepass clients, results: 5
    • Kubernetes documentation secrets, results: 5

    Sources:

  5. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  6. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Owner decision, 2026-11-26: approved as recommended.

    This changes one result of #6518: its gate check named the password of the cache as a key that the policy refuses for each container.

  7. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 26, 2026
  8. removed
    status/in-review
    owner/agent
    on Nov 26, 2026
  9. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-26 15:18 UTC

  10. dan-petty commented on Nov 27, 2026

    @dan-petty
    OwnerAuthor

    24-hour check, 2026-11-27 15:40 UTC (Prometheus, increase(...[24h])):

    • devops_cli_valkey_cache_errors_total{job="roadmap-stage"}: no series in the window, so 0 auth errors. Before the fix: 318 auth errors in 24 hours.
    • devops_cli_brain_cache_total{job="roadmap-stage"}: 923 hit and 691 miss. Before the fix: 0 hits in 3,492 reads. roadmap-implement: 171 hit, 137 miss.

    Both criteria of the live proof pass. The only series of devops_cli_valkey_cache_errors_total in the window come from a local devcontainer client with no valkey.url (about 403,000 open and 535 connection). #7427 holds that defect.

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/lowpriority/p1-highscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions