Skip to content

feat(k8s): render a credential-free planner ConfigMap - #6723

Merged
dan-petty merged 3 commits into
mainfrom
feat/4147-render-a-credential-free-configmap-for
Nov 22, 2026
Merged

dan-petty merged 3 commits into
mainfrom
feat/4147-render-a-credential-free-configmap-for

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

ConfigMap devops-cli-config-sandbox is the credential-free copy of the Service config that the planner run Job of #4003 mounts at /config, and #4147 records that no command renders it: src/devops_cli/commands/k8s/stack_lifecycle.py:947:return render_active_devops_configmap(product) renders only devops-cli-config, so a person copies the ConfigMap by hand, strips the credential keys, and the copy drifts from the active config at the next deploy.

Closes #4147

Change: openspec/changes/archive/2026-11-22-4147-render-a-credential-free-configmap-for/

@devops-cli-service devops-cli-service Bot added scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/feature Type feature: a new function labels Nov 22, 2026
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Step Status Attempts Tokens in/out Last failing command
group 1 done 2 2140328/11997 -
group 2 done 2 6994348/48768 -
group 3 done 1 11084678/28073 pytest on base: tests/commands/k8s/test_k8s.py
group 4 done 1 720709/3856 -
  • tools: run_command 94, edit_file 58, read_file 52, grep 30, write_file 4, create_directory 1
  • scoped check pre-push: passed, 5 s
  • scoped check static: passed, 26 s
  • scoped check tests: passed, 32 s
  • scoped check strength: passed, 0 s
  • scoped check tests: the changed files select more than 30 test modules, so only the changed test modules ran. The required checks of CI run the others
  • group 4: skipped, group 4: kind other
  • fail-to-pass of group 1: fails on the base commit. Tests that fail on the base commit: tests.security.test_secret_redaction::test_drop_credential_keys_removes_each_credential_key_at_any_depth.
  • fail-to-pass of group 2: fails on the base commit. Tests that fail on the base commit: tests.k8s.test_k8s_configmap::test_the_sandbox_config_map_drops_every_credential_key_and_keeps_its_name, tests.k8s.test_k8s_configmap::test_the_sandbox_config_map_keeps_a_number_under_a_credential_like_name.
  • fail-to-pass of group 3: fails on the base commit. Tests that fail on the base commit: tests.commands.k8s.test_k8s::test_k8s_teardown_stack_dry_run, tests.commands.k8s.test_k8s::test_deploy_stack_on_argo_cd_applies_the_config_map_and_sets_hosts_from_each_applications_revision, tests.commands.k8s.test_k8s::test_deploy_stack_on_argo_cd_pushes_secrets_after_deriving_the_hosts_and_before_writing, tests.commands.k8s.test_k8s::test_deploy_stack_on_a_native_cluster_applies_the_rendered_config_map_and_no_file_of_it, tests.commands.k8s.test_k8s::test_deploy_stack_applies_the_credential_free_sandbox_config_map, tests.commands.k8s.test_k8s::test_teardown_stack_devops_deletes_the_config_map_deploy_stack_rendered, tests.commands.k8s.test_k8s::test_deploy_stack_dry_run_reports_the_config_map_and_host_overrides_and_runs_nothing.
  • verify of group 4: uv run devops ci docs exits 0.
\u2139 Quality gate root: /home/devops/.data/roadmap/implement-runs/devops-implement-q0isbfdf/work/model-clone
\u2713 All documentation files are up to date.

@dan-petty

Copy link
Copy Markdown
Owner

Advisory pre-merge review (automated; a person decides).

Recommendation: merge after minor fixes. The code is correct and all checks pass, but three minor document and test points stay open (findings 1 to 3).

Head reviewed: 859824396b90901d2926c96e44bba9b572b8c426.

Findings

  1. Minor. Archived task 2.1 names a test that does not exist.

    • Where: openspec/changes/archive/2026-11-22-4147-render-a-credential-free-configmap-for/tasks.md task 2.1; tests/k8s/test_k8s_configmap.py:391.
    • Problem: Task 2.1 is ticked [x]. It names test_the_sandbox_config_map_of_the_real_template_holds_no_credential_key, which renders k8s/devops/configmap.example.yaml and checks the four token budgets. The PR has no such case. The second case, test_the_sandbox_config_map_keeps_a_number_under_a_credential_like_name, renders _COUNT_TEMPLATE. That template is a copy of SAMPLE_TEMPLATE (line 326), not the real template. No test asserts the four budget values of the real template.
    • Evidence: grep -rn of_the_real_template tests returns no match. Line 399 renders _COUNT_TEMPLATE. The real template holds the budgets at k8s/devops/configmap.example.yaml:208, :271, :317 and :318.
    • Context: A lens rated this major. The refute pass lowered it to minor. The spec text at openspec/specs/k8s-planner-run-job/spec.md:86 states correct behavior: a render of the real template keeps 64000, 16000000, 32000000 and 80000000 and holds no credential key path. Also, test_deploy_stack_applies_the_credential_free_sandbox_config_map (tests/commands/k8s/test_k8s.py:2120) renders the real template through resolve_product_root and asserts exit 0 and no credential key. Thus only the budget values have no test, and only the task text is wrong.
    • Fix: Add the case that task 2.1 names. Render k8s/devops/configmap.example.yaml and assert the four budget values. As an alternative, correct the text of task 2.1 so that it agrees with the test in the PR.
  2. Minor. ADR 0018 control 2 is out of date and has no Status History line.

    • Where: docs/adr/0018-a-sandboxed-read-only-run-tool-for-the-planner.md:33 (the PR does not change this file).
    • Problem: Control 2 says: "The config volume is a ConfigMap that a person makes from devops-cli-config". After this PR, devops k8s deploy-stack renders devops-cli-config-sandbox. docs/adr/README.md says that the same pull request adds a dated "Fact out of date" line when it makes a fact of a record wrong (AGENTS.md rule 8).
    • Evidence: The last Status History line is at line 129: "2026-11-13: Fact out of date: ... (feat(k8s): a gVisor RuntimeClass for pods that run untrusted code #5431)." git diff --stat origin/main...HEAD -- docs shows no change.
    • Fix: Add one line at the end of the Status History, for example: "2026-11-22: Fact out of date: devops k8s deploy-stack renders ConfigMap devops-cli-config-sandbox; a person does not make it (feat(k8s): render a credential-free ConfigMap for the planner run Job #4147)." Do not edit the body, because the body-hash test protects it.
  3. Minor. The helper _credential_key_paths has two identical copies.

    • Where: tests/k8s/test_k8s_configmap.py:290; tests/commands/k8s/test_k8s.py:2094.
    • Problem: docs/TESTING.md:100 says that tests/support/ holds what tests share. Two copies can drift.
    • Evidence: grep -rn 'def _credential_key_paths' tests shows the two lines. A diff of the two bodies shows no difference.
    • Fix: Move the helper to one module under tests/support/. Import it in both test files.
  4. Nit. The "no credential key" oracle repeats the product rule.

    • Where: tests/k8s/test_k8s_configmap.py:296-302; tests/commands/k8s/test_k8s.py:2094-2117.
    • Problem: The helper uses the same condition as drop_credential_keys (src/devops_cli/security/sanitizer.py:521): is_secret_parameter_name(...) and the value is not int | float. Thus _credential_key_paths(inner) == [] agrees with the product by construction. The risk is small, because tests/security/test_secret_redaction.py:1022-1050 checks drop_credential_keys against an explicit expected dict.
    • Fix (optional): In test_the_sandbox_config_map_drops_every_credential_key_and_keeps_its_name, also assert that github_token, ai.api_key and ai.db_password are absent by name.
  5. Nit. The render fixture has no secret key.

    • Where: tests/k8s/test_k8s_configmap.py:314 (_SANDBOX_TEMPLATE).
    • Problem: The spec scenario "Credential keys at the top level and nested" names github_token, api_key, db_password and a secret key. The fixture holds only the first three. The unit test of drop_credential_keys covers secret, but the rendered ConfigMap test does not.
    • Fix: Add a nested secret: example-value key to _SANDBOX_TEMPLATE.
  6. Nit. "Because it is a count" is not true for a boolean.

    • Where: k8s/README.md:1242; spec requirement "The sandbox ConfigMap keeps a number under a credential-like name".
    • Problem: The text says that a number or a boolean stays "because it is a count". A boolean is not a count. The docstring of drop_credential_keys gives the correct reason: every credential of the settings is text.
    • Fix: Write "because a number or a boolean is no credential: every credential of the settings is text".

What is correct

  • The PR delivers the three acceptance criteria of feat(k8s): render a credential-free ConfigMap for the planner run Job #4147, and "Closes feat(k8s): render a credential-free ConfigMap for the planner run Job #4147" is correct. deploy-stack renders devops-cli-config-sandbox before it touches the cluster, on the native path and on the Argo CD path. Teardown deletes it with --ignore-not-found. The dry run names it and shows no value of it.
  • k8s/devops/roadmap-service/cronjob-planner-run.yaml:113 already mounts the ConfigMap. No manifest change is necessary.
  • A failed sandbox apply exits 1. The PR swallows no error.
  • The change folder is archived as a pure rename plus ticked boxes. The base spec matches the delta word for word.
  • No test is removed, skipped, loosened or marked xfail. The removed helper _Cluster.stdin_of has no remaining caller.

Checks that ran

  • uv sync --locked in the review worktree: up to date.
  • uv run devops ci test tests/security/test_secret_redaction.py tests/k8s/test_k8s_configmap.py tests/commands/k8s/test_k8s.py: 408 passed (three runs).
  • uv run devops ci fail-to-pass --base origin/main: 10 failed on base, 398 passed, 0 errored. Each new or changed test fails on base and passes at head.
  • uv run devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures: all rows pass, 1m 58s.
  • uv run ruff check and uv run ruff format --check on the changed files: pass. uv run mypy on the 4 changed src files: no issues.
  • openspec validate k8s-planner-run-job --type spec: valid.
  • A render of the real template through render_active_devops_sandbox_configmap (scratch script, isolated HOME): data key devops-cli.yaml, budgets 64000 16000000 32000000 80000000, no credential key path.
  • PR title: Conventional Commit, scope k8s is valid. PR body above the Change: line: 561 characters (limit 1000). The PR is a draft.
  • GitHub check runs at the head: all success or skipped (Tests & Coverage shards 1-5, Static Analysis, CodeQL, Semantic PR title, Changed-Test Independence 1-3, Trivy, zizmor, Image Pins, images).
  • Added lines hold no private address, .lan host, e-mail address or device path.

@dan-petty
dan-petty force-pushed the feat/4147-render-a-credential-free-configmap-for branch from 8598243 to cc465b3 Compare November 22, 2026 03:00
@dan-petty

Copy link
Copy Markdown
Owner

Follow-up to the advisory review: commit cc465b3 (rebased on main) fixes the three minor findings and one nit.

  • Archived task 2.1 and the proposal now name the two tests that exist, and say that each test renders a template that the test builds. The spec scenario is now "Token budgets of a template", in the base spec and in the archived delta. No test reads k8s/devops/configmap.example.yaml and asserts its values, because a test of the project checks code, not a config value.
  • ADR 0018 has a dated "Fact out of date" line: devops k8s deploy-stack renders devops-cli-config-sandbox from the active config (feat(k8s): render a credential-free ConfigMap for the planner run Job #4147).
  • The helper credential_key_paths is now one module, tests/support/credential_keys.py, and both test files import it.
  • k8s/README.md, the spec and the docstring of drop_credential_keys now say: a number or a boolean is no credential, because each credential of the settings is text.

Checks: the tests of tests/k8s/test_k8s_configmap.py, tests/commands/k8s/test_k8s.py and tests/security/test_secret_redaction.py pass (408), and the scoped devops ci --check rows pass. The two nits on the test oracle and on the fixture key stay as they are.

devops-cli-service Bot and others added 3 commits November 22, 2026 03:08
Task 2.1 of the archived change names the two tests that exist. Each
test renders a template that the test builds.

The scenario of the token budgets is a behavior of the render. It does
not name the real template file.

A number or a boolean is no credential, because each credential of the
settings is text. The spec, k8s/README.md and the docstring of
drop_credential_keys give this reason.

ADR 0018 gets a dated Status History line: deploy-stack renders the
sandbox ConfigMap, and a person does not make it.

The helper credential_key_paths moves to tests/support/credential_keys.py.
Both test modules import it from there.
@dan-petty
dan-petty force-pushed the feat/4147-render-a-credential-free-configmap-for branch from cc465b3 to ff4c3d5 Compare November 22, 2026 03:10
@dan-petty

Copy link
Copy Markdown
Owner

Rebased on main after #6713 (ff4c3d5). The conflict in deploy-stack was mechanical: _deploy_native_manifests now takes both the path builds of #6713 and the sandbox ConfigMap of #4147, and it applies the two ConfigMaps first, then the manifests and the builds. The tests of tests/commands/k8s, tests/k8s and tests/security/test_secret_redaction.py pass (1,585), and mypy finds no issue in stack_lifecycle.py.

@dan-petty
dan-petty merged commit 745108e into main Nov 22, 2026
30 checks passed
@dan-petty
dan-petty deleted the feat/4147-render-a-credential-free-configmap-for branch November 22, 2026 03:16
dan-petty pushed a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.192.0](v0.191.1...v0.192.0)
(2026-11-22)


### Features

* **k8s:** apply the Application path builds in deploy-stack
([#6713](#6713))
([d905dbd](d905dbd))
* **k8s:** render a credential-free planner ConfigMap
([#6723](#6723))
([745108e](745108e))


### Bug Fixes

* **k8s:** split the network policies whose egress skips their ingress
([#6721](#6721))
([235fea0](235fea0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/k8s Kubernetes commands, Helm charts, pods, services, and policies type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(k8s): render a credential-free ConfigMap for the planner run Job

1 participant