Skip to content

feat(k8s): deploy-stack declares its stack names once, and a cluster secret row can name its Secret type and hold derived entries #2008

Description

@dan-petty

Friction

Evidence

Checked at main a752a14.

Existing tool considered

  • A Kubernetes Secret has a type field. kubernetes.io/basic-auth is a built-in type with the keys username and password.
  • urllib.parse.quote(..., safe="") quotes the credentials of a derived connection string. No new library is necessary.

Proposed remedy

  • Declare the stack names once, in one tuple in networking.py. Derive all, the valid names and every help text that lists stacks from it.
  • Add derived entries to the push table: a value built from other values of the same push and never stored on its own.
  • Let a row name its Secret type, with the default Opaque.
  • Add the in-cluster Mattermost base URL as one constant in src/devops_cli/config/constants.py.
  • Change no manifest under k8s/.

Acceptance criteria

  • Stack names live in one tuple in networking.py. _resolve_stacks derives all and the valid names from that tuple, and stack_lifecycle.py keeps no copy.
  • Every help text that lists stacks takes the names from that tuple: the --stack help of deploy-stack and teardown-stack (HELP.k8s.stack), the deploy-stack summary and the push_stack help.
  • A derived entry's value is built from other values of the same push, and never stored on its own. --plan shows it as derived, and --dry-run as <placeholder>.
  • A row may name its Secret type. It defaults to Opaque. A test asserts that a pushed manifest carries the type of its row.
  • The in-cluster base URL http://mattermost.mattermost.svc.cluster.local:8065 is one constant in src/devops_cli/config/constants.py.
  • No manifest under k8s/ changes.
  • Tests run offline over the keyring and cluster fakes. uv run devops ci passes.

Source: #1391

Proposed design

Problem statement

Stack names appear in three places. A new stack can be left out of all or a help text. The cluster secret push table cannot build a value from other values of the same push. Every pushed Secret has the type Opaque. A database Secret of type kubernetes.io/basic-auth cannot come from the table.

Acceptance criteria

  • Criterion 1: Stack names live in one tuple. _resolve_stacks derives all and the valid names from that tuple. stack_lifecycle.py keeps no copy.
    Verification: Run grep -rn 'VALID_STACKS\|valid_stacks' src/devops_cli/commands/k8s/. Only one declaration exists. networking.py and stack_lifecycle.py import it from the single source.
  • Criterion 2: Every help text that lists stacks takes the names from the tuple. The --stack help, the deploy-stack summary, and the push_stack help all list every valid stack.
    Verification: Run devops k8s deploy-stack --help. The --stack option lists all valid stacks. Run devops k8s push-secrets --help. The help lists all valid stacks. No help text omits a valid stack.
  • Criterion 3: A derived entry builds its value from other values of the same push. It never stores on its own. --plan shows it as derived. --dry-run shows it as . Verification: Run `devops k8s push-secrets --plan` with a derived entry present. The output shows `derived`. Run `devops k8s push-secrets --dry-run`. The output shows . No keyring write occurs for the derived entry.
  • Criterion 4: A row may name its Secret type. The default is Opaque. A test asserts that a pushed manifest carries the type of its row.
    Verification: Run the test suite. A test creates a ClusterSecret with secret_type="kubernetes.io/basic-auth". The pushed manifest carries that type. A row with no explicit type carries Opaque.
  • Criterion 5: The in-cluster base URL http://mattermost.mattermost.svc.cluster.local:8065 is one constant in src/devops_cli/config/constants.py.
    Verification: Run grep -c 'mattermost.mattermost.svc.cluster.local' src/devops_cli/config/constants.py. The count is 1. No other file in src/ defines the same literal.
  • Criterion 6: No manifest under k8s/ changes.
    Verification: Run git diff --name-only. No path starts with k8s/.
  • Criterion 7: Tests run offline over the keyring and cluster fakes. uv run devops ci passes.
    Verification: Run uv run devops ci. The exit code is 0.

Key questions

  • Where does the single stack tuple live?: The tuple lives in src/devops_cli/config/constants.py as CONST_K8S_VALID_STACKS. networking.py and stack_lifecycle.py import it from there. This refines the issue's proposal of networking.py because the constant already exists in constants.py. (proposed) [sources: src/devops_cli/config/constants.py]
  • Does CONST_K8S_VALID_STACKS already exist in constants.py?: Yes. It is declared in src/devops_cli/config/constants.py with the values infra, llm, logging, devops, gitea, all. [sources: src/devops_cli/config/constants.py]
  • Does cluster_secrets.py already have a derived entry type?: No. The SecretEntry dataclass has no derived field. The SecretSource union has no derived member. A new source type or field must be added. [sources: src/devops_cli/k8s/cluster_secrets.py]
  • What is the structure of a derived entry?: A derived entry is a new source type in cluster_secrets.py. It references other keys of the same push by name. A builder function constructs the value from those keys using urllib.parse.quote(..., safe=""). The entry never stores on its own. (proposed) [sources: src/devops_cli/k8s/cluster_secrets.py]
  • Where does the Secret type field live?: The ClusterSecret dataclass gains a secret_type field. It defaults to Opaque. secret_push.py reads it when building the manifest. This is a row-level field, not an entry-level field. (proposed) [sources: src/devops_cli/k8s/cluster_secrets.py, src/devops_cli/k8s/secret_push.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    on Oct 23, 2026
  2. dan-petty commented on Oct 23, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/feature. The candidate adds new functionality for stack names and secret types.
    • Priority: P2-Medium. The change improves usability and supports new secret types.
    • Value: High. Users benefit from less error-prone stack management and better secret support.
    • Effort: Medium. The change requires updates in multiple files and adds derived entry logic.
  3. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at bb46660 (see proposed design in issue body).

  4. added
    priority/p2-medium
    status/ready
    effort/medium
    value/high
    on Oct 28, 2026
  5. added a commit that references this issue on Oct 29, 2026
  6. removed
    status/ready
    on Oct 30, 2026
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/mediumpriority/p2-mediumsource/agenttype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions