Skip to content

feat(k8s): k8s manifest, stack and kustomize commands list their requests in a dry run and make none #2239

Description

@dan-petty

Part of #886. Depends on sub-issue 00 (the dry-run class ratchet test).

Problem or Motivation

The owner's dry-run rule (#412) says that a dry run makes no external request and returns the requests that the real run would make. The #886 inventory (2026-10-25, commit 1bb164b) found 18 k8s manifest, stack and kustomize commands that do not obey it:

  • 16 commands make an external request, or possibly make one, and have no request plan.
  • 2 commands make no external request and need only the no-external-request class.
  • Already done, not in scope: k8s deploy-stack, k8s push-secrets, k8s run-job, k8s volume reclaim, k8s volume move.

A command without a request plan either prints the generic Would run delegated command line under devops --dry-run, or fails with No such option: --dry-run, or prints an echo of its arguments. None of these shows the requests.

A command that makes no external request prints the generic Would run delegated command line under devops --dry-run and does not run, although running it is safe. Some of these commands have an echo-only --dry-run that prints only their arguments.

Proposed Solution & Architectural Design

For each command in the table:

  • Request plan: add --dry-run if it is missing. The dry run makes no external request, reads included. It returns the command's real result type, marked as a dry run, with the ordered PlannedRequest items (argv, stdin and env with <placeholders>, plus condition and repeat). Build each PlannedRequest from the same argument builder that the real run uses, so that the plan cannot drift from the run. Print it with render_request_plan. Give the command the request-plan class.
  • Mark only: give the command the no-external-request class. devops --dry-run <command> then runs it normally.
  • Remove an echo-only preview (render_dry_run_result or @dry_run_command) when the command gets its new dry run, with no shim.
  • Remove the command's paths from tests/fixtures/dry_run_gaps.json.

Notes from the inventory:

Command --dry-run today External request Work Evidence
k8s apply yes (echo only) yes request plan kubectl apply @ commands.k8s.cluster_context:apply:218
k8s bootstrap yes yes request plan kubectl get @ commands.k8s.networking:_discover_ingress_hosts:676
k8s bootstrap-openwebui yes (echo only) yes request plan kubectl get @ commands.k8s.stack_lifecycle:_bootstrap_openwebui_account:434
k8s chaos yes (echo only) yes request plan kubectl @ config.commands:build_kubectl_cmd:95
k8s check-deprecated yes (echo only) unclear request plan manual: pluto detect-files is local, detect-helm reads the cluster; the analyzer reached trivy only through Ba
k8s configure-urls yes (echo only) yes request plan kubectl get @ commands.k8s.networking:_discover_ingress_hosts:676
k8s create-tls-secret yes (echo only) yes request plan kubectl create @ commands.k8s.tls_management:create_tls_secret:164
k8s diff-helm yes (echo only) yes request plan helm diff @ config.commands:build_helm_diff_cmd:363
k8s enable-tls yes (echo only) yes request plan kubectl create @ commands.k8s.tls_management:_deploy_tls_secret:88
k8s lint yes (echo only) no mark only manual: kube-linter on local manifests; the analyzer reached trivy only through BaseSecurityScanner dispatch
k8s render no unclear request plan manual: kubectl kustomize renders locally; it fetches remote bases only when a kustomization names one
k8s sync-secrets yes (echo only) yes request plan kubectl get @ k8s.credentials:fetch_secret_data:194
k8s teardown-stack yes (echo only) yes request plan kubectl delete @ commands.k8s.stack_lifecycle:teardown_stack:1389
k8s validate yes (echo only) yes request plan trivy json @ config.commands:build_trivy_scan_cmd:137
k8s validate-policy yes (echo only) no mark only manual: opa eval or kyverno apply on local files (k8s/policy.py)
kustomize apply yes yes request plan kubectl kustomize @ k8s.template:_build_kustomize_dir:111
kustomize build no unclear request plan manual: kustomize build fetches remote bases only when a kustomization names one
kustomize diff no yes request plan kubectl @ config.commands:build_kubectl_cmd:95

Target Subsystem

Kubernetes & Minikube Automation

Existing Tool Considered

The work uses what the repository has: devops_cli.dry_run.requests.PlannedRequest and render_request_plan (#741), the dry-run class decorator and ratchet test from sub-issue 00, and the test guards in tests/conftest.py and tests/test_roadmap_dry_runs.py. No new dependency is necessary.

Acceptance Criteria

  • Each command in the table is out of tests/fixtures/dry_run_gaps.json, and the ratchet test passes.
  • For each request-plan command, devops <command> --dry-run and devops --dry-run <command> make no external request and print the ordered requests. Verified by tests with the process runner, the HTTP clients and the other clients patched to fail.
  • For each request-plan command with --format json or --json, the dry run returns the real result type marked as a dry run, with the planned requests. Verified by tests.
  • For each request-plan command, the plan holds the requests that the real run makes, in the same order. Verified by a test that runs the real command against a fake runner or client that records each call, and compares the calls with the plan (the pattern of tests/test_roadmap_dry_runs.py).
  • For each mark-only command, devops --dry-run <command> runs the command normally. Verified by tests with the process runner and the HTTP clients patched to fail.
  • Echo-only previews of these commands are gone, with no shim.
  • The new tests start no process and open no socket. The pull request records their time.
  • uv run devops ci passes.

Source: #886

Proposed design

Problem statement

Eighteen k8s manifest, stack, and kustomize commands do not obey the dry-run rule. Their dry runs either make a request, print only arguments, or fail. This item makes each dry run list the requests a real run would make and make no external request. It also marks safe local commands so their dry runs run normally.

Acceptance criteria

  • Criterion 1: Each command in the table is out of tests/fixtures/dry_run_gaps.json.
    Verification: Run the ratchet test and confirm it passes.
  • Criterion 2: Each request-plan command makes no external request in a dry run.
    Verification: Run tests that patch the process runner and HTTP clients to fail.
  • Criterion 3: Each request-plan dry run prints the ordered PlannedRequest items.
    Verification: Inspect the printed plan for argv, stdin, env, condition, and repeat.
  • Criterion 4: Each request-plan JSON dry run returns the real result type marked as a dry run.
    Verification: Run the command with --format json or --json and check the dry-run flag and planned requests.
  • Criterion 5: Each request-plan plan holds the requests the real run makes in the same order.
    Verification: Run the real command against a fake runner or client that records calls and compare the calls with the plan.
  • Criterion 6: Each mark-only command runs normally under devops --dry-run.
    Verification: Run tests that patch the process runner and HTTP clients to fail.
  • Criterion 7: Echo-only previews of these commands are gone, with no shim.
    Verification: Search the changed files for render_dry_run_result and @dry_run_command and confirm they are absent.
  • Criterion 8: The new tests start no process and open no socket.
    Verification: Run the new tests under the test guards and record their time in the pull request.
  • Criterion 9: The full CI check passes.
    Verification: Run uv run devops ci and confirm it passes.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    on Oct 25, 2026
  2. dan-petty commented on Oct 25, 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 proposes a new feature to improve dry-run behavior for k8s commands.
    • Priority: P1-High. This change is part of a larger effort (#886) to enforce dry-run rules across the project.
    • Value: High. Improves developer experience and tool reliability for Kubernetes operations.
    • Effort: High. Requires implementing request plans for multiple commands and updating related code.
    • Possible duplicate: feat(k8s): k8s cluster read and access commands list their requests in a dry run and make none #2238, which may ask for the same change. The model names k8s manifest, stack and kustomize commands list their requests in a dry run and make none as the change that both ask for. The candidate and item 2238 both ask for k8s commands to list their requests in a dry run and make none. A person closes one of the two if that is so.
  3. dan-petty commented on Oct 25, 2026

    @dan-petty
    OwnerAuthor

    Not a duplicate of #2238. Both are parts of #886, and each part changes a different set of commands: #2238 changes the k8s cluster read and access commands, and this item changes the k8s manifest and stack commands and kustomize. The agent that split #886 filed both.

  4. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

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

  5. added
    priority/p1-high
    status/ready
    effort/high
    value/high
    scope/k8s
    on Oct 28, 2026
  6. added 2 commits that reference this issue on Oct 31, 2026
    ed88617
    b9379bc
  7. added
    status/in-review
    and removed
    status/ready
    on Oct 31, 2026
  8. removed
    status/in-review
    on Oct 31, 2026
  9. added a commit that references this issue on Oct 31, 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/highpriority/p1-highscope/k8ssource/agenttype/featurevalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions