Repository navigation
Description
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-requestclass. - 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-runif 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 orderedPlannedRequestitems (argv, stdin and env with<placeholders>, plusconditionandrepeat). Build eachPlannedRequestfrom the same argument builder that the real run uses, so that the plan cannot drift from the run. Print it withrender_request_plan. Give the command therequest-planclass. - Mark only: give the command the
no-external-requestclass.devops --dry-run <command>then runs it normally. - Remove an echo-only preview (
render_dry_run_resultor@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:
k8s deploy-stackandk8s push-secretsalready have request plans (feat(k8s): devops-cli runs in the homelab cluster as Jobs, and every cluster Secret is pushed from the keyring, also by deploy-stack (devops k8s push-secrets, devops k8s run-job) #741). Usek8s/secret_push.py:_RequestPlanas the model.k8s bootstrapuses@dry_run_command, which prints an echo preview. That preview makes no request, but it lists no request.k8s renderandkustomize buildfetch remote bases only when a kustomization names one. Decide per command, with evidence, whether the class isrequest-planorno-external-request.kustomizehas 3 commands, so it joins this group.- The table comes from a static walk of each callback and the functions that it calls. Check each row against the code before you change it. If a row is wrong, change the class to match the code, and record the evidence in the pull request.
| 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-runanddevops --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 jsonor--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 cipasses.
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_commandand 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
- Does the repository already have the dry-run request plan types and renderer?: Yes. PlannedRequest and render_request_plan exist, and roadmap dry-run tests show the pattern. [sources: tests/test_roadmap_dry_runs.py, CHANGELOG.md:1294]
- Do the test guards fail a test that makes an external request or starts a real process?: Yes. tests/conftest.py installs socket, subprocess, and keyring guards. [sources: tests/conftest.py]
- Which class does k8s render need?: request-plan. It may fetch remote bases when a kustomization names one. (proposed)
- Which class does kustomize build need?: request-plan. It may fetch remote bases when a kustomization names one. (proposed)
- Which commands are mark-only?: k8s lint and k8s validate-policy. They make no external request. (proposed)
- Is this item a duplicate of feat(k8s): k8s cluster read and access commands list their requests in a dry run and make none #2238?: No. feat(k8s): k8s cluster read and access commands list their requests in a dry run and make none #2238 changes k8s cluster read and access commands. This item changes k8s manifest, stack, and kustomize commands. (proposed)
- Does this item fit one pull request?: Yes. It is one split item from feat(cli): commands with no dry-run preview: read-only ones run, mutators gain one #886. (proposed)
- What must be done before this item?: Sub-issue 00, the dry-run class ratchet test, must be done first. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 25, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate proposes a new feature to improve dry-run behavior for k8s commands.This change is part of a larger effort (#886) to enforce dry-run rules across the project.Improves developer experience and tool reliability for Kubernetes operations.Requires implementing request plans for multiple commands and updating related code.k8s manifest, stack and kustomize commands list their requests in a dry run and make noneas 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.dan-petty commentedon Oct 25, 2026
Not a duplicate of #2238. Both are parts of #886, and each part changes a different set of commands: #2238 changes the
k8scluster read and access commands, and this item changes thek8smanifest and stack commands andkustomize. The agent that split #886 filed both.dan-petty commentedon Oct 27, 2026
Status set to Ready at d594b55 (see proposed design in issue body).
feat(k8s): preview requests in dry run for manifest and kustomize com…
feat(k8s): preview requests in dry run for manifest commands
chore(main): release 0.27.0 (#2852)