Skip to content

feat(k8s): give valkey-devops one ACL user for each role #4704

Done

Description

@dan-petty

Problem or Motivation

valkey-devops has only the default user with requirepass (measured). Any pod with the password can read every key. So the shared caches hold public repositories only, and 2 of the 7 managed repositories are private (measured).

Proposed Solution & Architectural Design

  • Valkey ACL users, with the default user off:
    • sweep: read and write ~valkey:roadmap:* and ~valkey:gh:*;
    • brain: read and write ~valkey:brain:*, read ~valkey:roadmap:*;
    • agent: read and write ~valkey:rag:*, read ~valkey:brain:v1:fact:*.
  • The passwords are generated managed credentials of devops k8s push-secrets, which a person runs after the merge (owner decision 2026-11-11). Agents write no secret value.
  • After the users exist, the snapshot and fact caches admit private repositories for the sweep and brain users only.

Target Subsystem

Workstation Caching & Valkey (k8s/llm/valkey-devops.yaml, src/devops_cli/k8s/cluster_secrets.py).

Existing Tool Considered

Valkey ACL with an aclfile, in the form of the valkey-roadmap users of #4563, and devops k8s push-secrets for the passwords. No new tool. Cost: about 60,000 tokens and 2 hours to build, plus the person step.

Acceptance Criteria

  • valkey-cli ACL USERS lists the 3 users, and the default user is off.
  • A test: the agent user gets NOPERM on valkey:roadmap:*.
  • A test: the tiered cache writes the snapshot of a private repository only under the sweep user.

Dependencies

#4668. Person step: uv run devops k8s push-secrets after the merge. Part of the project brain plan #4624.

Source: #4624

Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: valkey-io/valkey (https://github.com/valkey-io/valkey), BSD-3-Clause, last activity 2026-11-22, maintained.
Reason: The searches returned the Valkey server itself, whose ACL already gives named users, per-key patterns, command categories, an aclfile and NOPERM refusal, so only project wiring remains.

Covers:

  • Several named users with separate passwords in one aclfile
  • Per-key patterns, including read-only and write-only prefixes
  • Command categories such as read-only, plus NOPERM refusal
  • Turning the default user off in the same file

Lacks:

  • No generated role passwords; push-secrets rows are ours
  • No client setting that sends a username
  • No render of the aclfile from Secret values in the pod
  • No admission of private repositories to the caches

Proposed design

Problem statement

valkey-devops has one default user with requirepass, so any pod that holds the password reads every key. The change gives the sweep, brain, agent and metrics roles their own ACL users, turns the default user off, and adds the generated passwords and client wiring. A person runs uv run devops k8s push-secrets and restarts the pod after the merge. The admission of private repositories to the snapshot and fact caches moves to a new issue.

Acceptance criteria

Requirement: ACL users and default user

The valkey-devops Deployment SHALL load an aclfile that defines the sweep, brain, agent and metrics users and turns the default user off.

Scenario: Rendered aclfile

  • WHEN An operator runs uv run devops k8s push-secrets. The operator restarts the deployment with kubectl -n llm rollout restart deploy/valkey-devops. The operator reads the aclfile with kubectl -n llm exec deploy/valkey-devops -c valkey -- sh -c "sed -E 's/>[^ ]+/>***/' /run/valkey/users.acl".
  • THEN The output holds user default off and one user <name> on >*** line for each of sweep, brain, agent and metrics.

Requirement: Role key patterns

Each role user SHALL hold only the key patterns of its role, with read and write access where the role needs it.

Scenario: Agent key patterns

  • WHEN An operator runs kubectl -n llm exec deploy/valkey-devops -c valkey -- sh -c "grep '^user agent ' /run/valkey/users.acl | sed -E 's/>[^ ]+/>***/'".
  • THEN The line holds ~valkey:rag:* and %R~valkey:brain:v1:fact:*, and no pattern that matches valkey:roadmap:*.

Requirement: Agent refuses roadmap keys

The agent user SHALL get NOPERM on a valkey:roadmap:* key.

Scenario: Agent read of a roadmap key

  • WHEN An operator runs kubectl -n llm exec deploy/valkey-devops -c valkey -- valkey-cli --user agent --pass "$AGENT_PASSWORD" --no-auth-warning GET valkey:roadmap:probe. The operator reads the agent password from Secret llm/valkey-devops-auth key agent.
  • THEN The command prints an error that starts with NOPERM and reads no value.

Requirement: Generated role passwords

Each role password SHALL be a generated managed credential of devops k8s push-secrets.

Scenario: Cluster Secret plan

  • WHEN The test tests/k8s/test_cluster_secret_plan.py builds the plan for llm/valkey-devops-auth and devops/devops-cli.
  • THEN The plan holds one generated hex 32-byte value for each key sweep, brain, agent and metrics in llm/valkey-devops-auth, and devops/devops-cli adopts sweep as DEVOPS_CLI_VALKEY_PASSWORD, brain as DEVOPS_CLI_VALKEY_BRAIN_PASSWORD and agent as DEVOPS_CLI_VALKEY_AGENT_PASSWORD.

Requirement: Client user setting

A client SHALL send the ACL user that the valkey.username setting names.

Scenario: Settings declaration

  • WHEN The test tests/security/test_config_declarations.py reads the Settings declarations.
  • THEN valkey.username is declared, maps to DEVOPS_CLI_VALKEY_USER, and an empty value keeps the default user.

Requirement: Exporter user

The redis-exporter sidecar SHALL authenticate as the metrics user.

Scenario: Exporter scrape

  • WHEN An operator runs kubectl -n llm port-forward deploy/valkey-devops 9121:9121 and curl -s localhost:9121/metrics | grep '^redis_up'.
  • THEN The redis_up line is 1.

Requirement: Metrics user command set

The metrics user SHALL hold no write command.

Scenario: Metrics user line

  • WHEN An operator runs kubectl -n llm exec deploy/valkey-devops -c valkey -- sh -c "grep '^user metrics ' /run/valkey/users.acl | sed -E 's/>[^ ]+/>***/'".
  • THEN The line holds no +@write and no +@all.

Requirement: Manifest validation

The valkey-devops manifest SHALL pass the repository Kubernetes check.

Scenario: Kubernetes check

  • WHEN An operator runs uv run devops ci --check --only k8s.
  • THEN The command exits 0 and reports no error for k8s/llm/valkey-devops.yaml.

Existing Tool Considered

valkey-io/valkey (BSD-3-Clause, maintained, last activity 2026-11-17) is the tool, and the alternatives check of 2026-11-17 in the issue body records the verdict in-use. The comment of that check lists what the tool covers and what it lacks. The proposal adds only the wiring that the check lists as lacking: the aclfile render in the manifest, the Secret entries and their adoptions, the valkey.username setting, and REDIS_USER on the exporter. The issue writes the cost as about 60,000 tokens and 2 hours, plus the person step.

Key questions

  • How does valkey-devops load its ACL users?: The pod renders an aclfile on the memory volume at start and loads it with valkey-server --aclfile /run/valkey/users.acl. The file holds user default off and one user line for each role, with each password from a Secret value. No password goes into git. (best practice) [sources: k8s/llm/valkey-devops.yaml]
    • Chosen: aclfile rendered at pod start. The pod already writes a config file from the Secret on the memory volume, and the users survive a restart.
    • Rejected: ACL SETUSER from a client after start. It needs a second client and a password in the pod, and a restart loses every user.
    • Rejected: Keep requirepass with one user. It gives every pod that holds the password every key, which is the defect.
  • Which users does the aclfile define, and why is metrics one of them?: Four role users: sweep, brain, agent and metrics. The redis-exporter sidecar sends REDIS_PASSWORD and no user, so it authenticates as the default user. With the default user off it would lose its scrape. The metrics user holds the read, connection and slow command categories, and the sidecar sets REDIS_USER to metrics. (best practice) [sources: k8s/llm/valkey-devops.yaml]
    • Chosen: Add a read-only metrics user. The sidecar keeps its scrape and holds no key access.
    • Rejected: Keep the default user on. Any pod with the password then reads every key, which is the defect.
    • Rejected: Give the sidecar the sweep user. The sidecar would hold write access to the roadmap and GitHub keys.
  • Where do the four role passwords come from?: Generated hex 32-byte entries of devops k8s push-secrets. llm/valkey-devops-auth gets keys sweep, brain, agent and metrics. devops/devops-cli adopts sweep as DEVOPS_CLI_VALKEY_PASSWORD, brain as DEVOPS_CLI_VALKEY_BRAIN_PASSWORD and agent as DEVOPS_CLI_VALKEY_AGENT_PASSWORD. A person runs uv run devops k8s push-secrets after the merge, and no agent writes a value. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py, src/devops_cli/commands/k8s/cluster_secret_push.py]
    • Chosen: Generated hex entries. secrets.token_hex(32) gives 64 hex characters, which need no quoting in an aclfile, and the existing valkey rows use this generator.
    • Rejected: One password for the four users. One leaked password opens every role, and a role cannot be revoked alone.
    • Rejected: A person types each password. It adds four person steps and puts each value in a shell history.
  • How does a client name its ACL user?: The client sends the user that the valkey.username setting names, as DEVOPS_CLI_VALKEY_USER beside DEVOPS_CLI_VALKEY_PASSWORD. An empty value keeps the default user, so the workstation Valkey that still uses requirepass needs no change. Each pod sets valkey.username and takes its password from the role key of Secret devops/devops-cli. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py, k8s/devops/configmap.example.yaml, tests/security/test_config_declarations.py]
    • Chosen: A valkey.username setting. It pairs with the existing valkey.password, and each pod sets it in its own manifest.
    • Rejected: The user in valkey.url. One connection would take its user from the URL and its password from a setting.
    • Rejected: One Secret for each role. The table holds one row for this cache, and three more rows would repeat its restart and its labels.
  • Which role does each consumer send?: The roadmap Service sends sweep, and it opens a read-only brain connection for the brain digest. brain-daily and brain-weekly send brain. The runner and rag-ingest send agent. The redis-exporter sidecar sends metrics. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/llm/valkey-devops.yaml, CONTEXT.md]
    • Chosen: One user for each pod role. Each pod holds the narrowest key patterns that its work needs.
    • Rejected: Every pod sends sweep. It gives the runner and the RAG pods write access to the roadmap and GitHub caches.
    • Rejected: Widen sweep to read the brain keys. It breaks the key table of the issue, and one connection would read two roles.
  • What proves each requirement of the manifest and the ConfigMap, when a test may not read either file?: A live check of the running pod proves the aclfile, the agent NOPERM and the exporter scrape. uv run devops ci --check --only k8s proves the manifests. A test of source code proves CLUSTER_SECRETS and the valkey.username declaration. docs/TESTING.md:61-62 and the test-tree row forbid a test that asserts a value of a manifest or a config file. (best practice) [sources: docs/TESTING.md:61-62, tests/gate/tree_checks/config_values.py, tests/security/test_config_declarations.py]
    • Chosen: Live checks and source-code tests. They prove the deployed state and the table, and docs/TESTING.md:61-62 forbids a test that reads a manifest or a config file.
    • Rejected: A test that renders the aclfile from the manifest. It reads k8s/llm/valkey-devops.yaml, which the test-tree row refuses.
    • Rejected: A test that reads k8s/devops/configmap.example.yaml. It asserts a value of a config file, which docs/TESTING.md:61-62 forbids.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4668

Moved to new items

#6589

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/k8s. The (k8s) scope of the title gives the scope.
    • Priority: P2-Medium. It improves access control and enables private-repo caching but does not fix a live defect or advisory.
    • Value: Medium. It restricts key access to per-role patterns and unlocks private-repository caching for two of seven managed repositories.
    • Effort: Low. The body estimates about 2 hours of build plus one person step for push-secrets.
    • Related: feat(service): share the GitHub budget and holds in Valkey #4563, which asks for a different change. Both create Valkey ACL users, but #4563 targets valkey-roadmap for GitHub budget sharing while this targets valkey-devops for role-based cache access.
  4. added
    priority/p2-medium
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 0820a64 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  6. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: Searches turned up only the Valkey server itself (and the young valkey-operator, still pre-1.0) as candidates, and Valkey's built-in ACL with an aclfile covers the whole need: one user per role, per-user key patterns, command categories, and user default off. The issue already names Valkey ACL with an aclfile as the tool in place, so only the wiring (aclfile render, Secret rows, client username setting, exporter env) is left to build.

    The repository already uses this tool.

    Tool: valkey-io/valkey (https://github.com/valkey-io/valkey)

    • License: BSD-3-Clause
    • Last activity: 2026-11-17
    • Maintained: yes

    Covers:

    • Per-user ACL rules in an aclfile of the form user <name> on >password ~pattern +@commands, loaded with valkey-server --aclfile
    • Per-role key patterns, so agent holds only ~valkey:rag:* and ~valkey:brain:v1:fact:* and gets NOPERM on valkey:roadmap:*
    • Command-category restriction per user, so the metrics user can be limited to read commands with no +@write or +@all
    • user default off, which retires the single requirepass user that gives every pod every key
    • ACL USERS and ACL LIST output to assert the users and the default-user state in tests

    Lacks:

    • No way to generate or hold the four role passwords: those stay generated entries of devops k8s push-secrets and a Secret, rendered into the aclfile at pod start
    • No git-friendly password storage; the aclfile must be rendered at start from valkey-devops-auth rather than committed
    • No client-side wiring: the valkey.username / DEVOPS_CLI_VALKEY_USER setting and the exporter's REDIS_USER are project code, not the server
    • No k8s-side rendering of the aclfile from Secret values, which the manifest and cluster_secrets.py must add

    Tools considered:

    Searches run:

    • Kubernetes operator manage Valkey Redis ACL users per role, results: 5
    • Valkey ACL aclfile per-user key patterns command permissions, results: 5
    • valkey documentation ACL SETUSER aclfile username key pattern, results: 5
    • valkey-io valkey-operator Kubernetes ACL configuration, results: 5
    • valkey.io ACL docs, results: 5
    • "valkey" ACL USERS command reference documentation, results: 5
    • redis ACL user management open source tool Kubernetes secrets rotation, results: 5
    • valkey-operator valkey.io Kubernetes operator release, results: 5
    • Valkey ACL file documentation, results: 5

    Sources:

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

  7. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor

    This comment reports that this body gives two different counts of ACL users, and that five of its scenarios assert values of a manifest or a config file.

    User count. The body does not agree with itself:

    • Proposed Solution (lines 7-10) lists 3 users: sweep, brain and agent.
    • Acceptance Criteria (line 24) says that valkey-cli ACL USERS lists "the 3 users".
    • The refined design adds a fourth user, metrics, because the redis-exporter sidecar otherwise loses its login when the default user is off (key question at line 98). The requirement "ACL users and the default user" (line 45) and the scenario "Rendered aclfile" (line 49) expect 4 role users.

    ACL USERS lists every user, the default user too. With 4 role users, it lists 5 names: agent, brain, default, metrics and sweep. Before this item goes to Ready, make Proposed Solution and Acceptance Criteria name the 4 role users, and check that default is off with ACL GETUSER default or ACL LIST.

    Scenarios that assert manifest or config values. docs/TESTING.md:61-62 forbid a test that asserts a value of a manifest or a config file, and the test-tree row refuses one (tests/gate/tree_checks/config_values.py). The pod renders the aclfile at start from a shell command in k8s/llm/valkey-devops.yaml (key question at line 90), so a test of that render reads the manifest. These scenarios ask for such a test:

    Scenario Body line What it reads
    Rendered aclfile 47-49 the aclfile that the manifest renders
    Agent key patterns 54-56 the user agent line of the same aclfile
    Devops ConfigMap 68-70 DEVOPS_CLI_VALKEY_USER in k8s/devops/configmap.example.yaml
    Exporter environment 75-77 REDIS_USER and the Secret key of the exporter container
    Manifest comment 82-84 the header comment of k8s/llm/valkey-devops.yaml

    This body was refined on 2026-11-15, before #6080 changed the plan rules on 2026-11-17. Give each of these requirements a validator command or a live check as its proof, in the form of #6080 and #6083. The acceptance test "the agent user gets NOPERM on valkey:roadmap:*" can be such a live check when it runs against the deployed Valkey. The scenario "Cluster Secret table" reads CLUSTER_SECRETS in src/devops_cli/k8s/cluster_secrets.py, which is source code, so it can stay.

  8. devops-cli-service commented on Nov 19, 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.

  9. removed
    status/new
    on Nov 21, 2026
  10. 19 remaining items

  11. added
    status/blocked
    status/ready
    and removed
    status/blocked
    on Nov 24, 2026
  12. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Cleared the stop at job by the rule continue: the runner Job devops-cli-implement-devops-cli-4704-7f165d ended without a result. The class ci_infra of the stop is one that a new attempt can fix. This is continuation 1 of 4 for this item. The item is Ready again. The Service takes it in the next round. The new Job takes the branch from origin, so it keeps the work that the run pushed there.

  13. added
    status/in-review
    and removed
    status/ready
    on Nov 24, 2026
  14. removed
    status/in-review
    on Nov 24, 2026
  15. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-24 20:09 UTC

  16. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    This item is closed, but its change is not live (measured on 2026-11-26, review of #4624).

    • Task 4.1 of the plan names dan-petty/homelab. The plan marks it done, but k8s/llm/valkey-devops.yaml of that repository did not change: the pod still starts with requirepass and no --aclfile.
    • The role passwords were never pushed: uv run devops k8s push-secrets --plan reads would generate for sweep, brain, agent and metrics of llm/valkey-devops-auth.
    • The acceptance criterion "valkey-cli ACL USERS lists the 3 users" is not met.

    The work that remains is dan-petty/homelab#261, with the draft pull request dan-petty/homelab#262. A person runs uv run devops k8s push-secrets --only llm/valkey-devops-auth before that merge. A temporary pod with the new pod template and throwaway passwords proved the criterion "the agent user gets NOPERM on valkey:roadmap:*". #6600 holds two more findings about the role users.

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/p2-mediumscope/k8ssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions