Repository navigation
Description
Problem or Motivation
The live ConfigMap devops-cli-config changed 21 times in the 7 days to 2026-11-12 (kube-state-metrics). No record gives what changed, who changed it or why. The ConfigMap holds the models, the mode of each Service row, the budgets and the timeouts, so a change can change the job grades. The project review (#5219) flags a config change in a before-and-after compare. It can count the changes, but it cannot name them.
How the ConfigMap reaches the cluster today:
devops k8s deploy-stack --stack devopsrenders it from the templatek8s/devops/configmap.example.yaml(in git) and from values of the localconfig.yaml(not in git, because the repository is public), and applies it withkubectl apply(k8s/README.md, "Go-live check" and the table of values). The live object has one field manager,kubectl-client-side-apply.- Argo CD does not own it:
k8s/argocd/apps/projects.yamllists it underorphanedResources.ignore. - The only trace on the object is the annotation
kubectl.kubernetes.io/last-applied-configuration. It holds the last state and no history. - 20 commits changed the template in the same 7 days, but no record joins a live change to a commit, to an issue or to a value of
config.yaml.
Proposed Solution & Architectural Design
Use the standard record. Measure the cost of each option and record the choice in the proposal ## Feasibility section:
- Option A: the public part of the ConfigMap comes from git through Argo CD, as
llm-gateway-configdoes (a KustomizeconfigMapGeneratorwith a hash name, k8s/README.md and fix(k8s): a changed gateway ConfigMap rolls the gateway deployment, so deploy-stack never leaves a stale pod #1929). The private values ofconfig.yaml(the repositories and the App identifiers) stay out of git, in a second object that deploy-stack writes. Each change of the public part is then a commit with its pull request and issue, and the hash name rolls the pods, so the hand restart of the Go-live check and the order problem of refactor(roadmap): remove the dead plan and review step classes #4036 go. - Option B: deploy-stack writes annotations on the ConfigMap: the git commit of the template, the SHA-256 of the rendered data, the names (not the values) of the settings that changed, and an optional reason (an issue number). It logs the same fields as one record
configmap_changed, so Loki keeps the history. - A change by
kubectl editorkubectl patchdoes not go through either option. The Kubernetes audit log is the standard record of each writer. It is a change of the control plane, so it is an owner step if the item needs it.
Cost to build (estimate): option A about 0.6 M tokens and 3 hours elapsed; option B about 0.4 M tokens and 2 hours elapsed. Keep: no cost at run time beyond one annotation or one log record for each apply.
Target Subsystem
k8s/devops/, k8s/argocd/, src/devops_cli/commands/k8s/stack_lifecycle.py, k8s/README.md.
Existing Tool Considered
Argo CD with a Kustomize configMapGenerator (in use for the gateway), Kubernetes annotations, the Kubernetes audit log, and Loki for the change records. No new tool.
Acceptance Criteria
- The proposal
## Feasibilitysection shows how each value of the ConfigMap reaches the cluster today, and names the option with its evidence. - Each change of the live ConfigMap gives one record that names the changed settings (no values), the git commit of the template and the time. A test of the renderer pins the record.
- One query (Loki, the Kubernetes API or git) lists the changes of the last 7 days with the setting names.
- No private value of
config.yamlgoes into git or into the record. - k8s/README.md describes the new path, and the Go-live check stays true.
Dependencies
None.
Related
- feat(roadmap): report job grades and fix effects in the project review #5219 (the review section that found this problem; its
configsignal line names a setting), refactor(roadmap): remove the dead plan and review step classes #4036 (its release crash-looped the Service, because the live ConfigMap still held a removed setting), fix(k8s): a changed gateway ConfigMap rolls the gateway deployment, so deploy-stack never leaves a stale pod #1929 (the hash name of the gateway ConfigMap).
Source: #5219
Alternatives check of 2026-11-19: in-use.
The repository already uses this tool.
Tool: argoproj/argo-cd (https://github.com/argoproj/argo-cd), Apache-2.0, last activity 2026-11-19, maintained.
Reason: Searches found no single tool for the whole need; Argo CD covers only the public, Git-tracked ConfigMap path and leaves private values, direct edits, field-level change records and a seven-day query uncovered.
Covers:
- Git history for the public ConfigMap template
- A commit and pull request for each public change
- Hash-suffixed ConfigMap name rolls the pods
Lacks:
- No record of private config.yaml values
- No field-level names of changed settings
- No record of direct kubectl edit or patch
- No built-in seven-day history query
Proposed design
Problem statement
The live ConfigMap devops-cli-config changed 21 times in the 7 days to 2026-11-12. No record names the changed settings, the template commit or the time. devops k8s deploy-stack --stack devops renders the object from k8s/devops/configmap.example.yaml and the private config.yaml, and applies it with kubectl apply from the caller's checkout. The object keeps only its last state. This item makes each successful apply that changes the data write annotations: changed setting names (no values), template commit, data SHA-256 and time. It also writes one configmap_changed WARNING log record and one key of a 30-day history ConfigMap. One query then lists the changes of the last 7 days. A direct kubectl edit or kubectl patch is deferred to #6428. The Argo CD AppProject ignore entry is deferred to a dan-petty/homelab issue, because k8s/argocd/apps/projects.yaml is an environment path frozen in this repository.
Acceptance criteria
Requirement: OpenSpec records the path and the choice
The OpenSpec change SHALL state how each value of the ConfigMap reaches the cluster today and SHALL name the chosen option with its sources.
Scenario: OpenSpec validator
- WHEN The validator
uv run devops ci --check --only openspecruns on the change. - THEN It passes with a
## Feasibilitysection that names the render, the apply path, the deferred audit log and the option's sources.
Requirement: Change record names settings
The comparer SHALL name each changed setting by its dotted path and SHALL NOT hold its value.
Scenario: One changed setting
- WHEN A test gives the comparer two rendered data maps whose
devops-cli.yamldiffers only atai.model. - THEN The record lists
ai.modeland holds no value ofai.model.
Requirement: Annotations on the ConfigMap
deploy-stack SHALL put roadmap.devops-cli/config-template-commit, roadmap.devops-cli/data-sha256, roadmap.devops-cli/changed-settings, roadmap.devops-cli/changed-at and, when given, roadmap.devops-cli/change-reason in the manifest that it applies when the rendered data differs from the live data.
Scenario: Rendered annotations with a reason
- WHEN A test renders the manifest that deploy-stack applies for changed data with an issue number as the reason.
- THEN The rendered object holds all five annotations, and
roadmap.devops-cli/changed-settingsnames the changed setting and no value.
Requirement: History object is created when absent
deploy-stack SHALL create ConfigMap devops-cli-config-changes in namespace devops when the read finds none, before it adds a record key.
Scenario: No history object
- WHEN A test runs the history write against a kubectl stub that answers NotFound to the read.
- THEN The command applies the empty history object before it patches the record key.
Requirement: History object holds one key for each change
deploy-stack SHALL add one data key <epoch seconds>-<first 8 characters of the data SHA-256> with one JSON line and SHALL delete each key older than 30 days in the same merge patch of ConfigMap devops-cli-config-changes.
Scenario: Add a key and prune
- WHEN A test builds the merge patch for one record against a history data map that holds a key older than 30 days.
- THEN The patch adds the new key and deletes the old key, and the new key holds only letters, digits,
-,_and..
Requirement: No record when the data does not change
deploy-stack SHALL write no annotation, no history key and no log record when the rendered data has the same SHA-256 as the live data.
Scenario: An unchanged deploy
- WHEN A test gives the comparison the same data twice and runs the apply path.
- THEN It builds no record, and the command sends no history patch and logs no
configmap_changedrecord.
Requirement: No record for a failed apply
deploy-stack SHALL patch the history object and emit the log record only after kubectl apply exits 0.
Scenario: Failed apply
- WHEN A test runs the apply path with a kubectl stub that exits non-zero for the apply.
- THEN The command sends no patch and the log holds no
configmap_changedrecord.
Requirement: WARNING log record
deploy-stack SHALL emit one configmap_changed record at WARNING on logger devops_cli.k8s.configmap for each successful apply that changes the data.
Scenario: One record through the OTel bridge
- WHEN A test attaches
OTelLoggingHandlerwith a fake exporter and runs the apply path with one changed setting. - THEN The exporter receives one record named
configmap_changedwith the changed setting names, the template commit and the time.
Requirement: Private values stay out
The annotations, the history line and the log record SHALL NOT hold a value of config.yaml or of the rendered data.
Scenario: Private value sentinel
- WHEN A test renders the record with a sentinel value under
service.reposand a change of another setting. - THEN The three records name
service.reposand hold no sentinel value.
Requirement: Seven-day history query
The history object SHALL answer one query that lists the changes of the last 7 days with the setting names, from lines whose time is an ISO-8601 UTC string.
Scenario: Live query
- WHEN The live check runs
kubectl -n devops get configmap devops-cli-config-changes -o json | jq -r '.data[] | fromjson | select((.time | fromdateiso8601) >= (now - 604800)) | [.time, (.changed_settings | join(","))] | @tsv'. - THEN It prints one line per apply of the last 7 days, each with the time and the changed setting names and no value.
Requirement: Docs describe the record
k8s/README.md SHALL describe the annotation keys, the history object, the configmap_changed record and the seven-day query, and the Go-live check of docs/CLUSTER.md SHALL keep its commands.
Scenario: Docs validator
- WHEN The validator
uv run devops ci --check --only docsruns. - THEN It passes with the new
k8s/README.mdsection and the unchanged Go-live check commands ofdocs/CLUSTER.md.
Existing Tool Considered
Argo CD (https://github.com/argoproj/argo-cd), Apache-2.0, last activity 2026-11-19, maintained: the alternatives check of 2026-11-19 holds the verdict in-use, and its block in the issue body states what the tool covers and what it lacks. This item keeps the deploy-stack apply path that Argo CD does not own and builds only the comparison and the record text. It covers the lacks in the block by keeping private values in the apply path, naming changed settings without values, deferring direct kubectl edit and kubectl patch writers to #6428, and answering the seven-day query from the history ConfigMap. Cost to build that code: about 0.4 M tokens and 2 hours elapsed. Cost to keep: one kubectl get, one kubectl apply, one merge kubectl patch and one log record for each deploy. Cost to fix: none while the ConfigMap shape and the OTel handler stay as they are.
Key questions
- How does the live ConfigMap reach the cluster today?:
devops k8s deploy-stack --stack devopsrendersk8s/devops/configmap.example.yamlwith the activeconfig.yamlin memory and sends the result tokubectl apply -f -from the caller's checkout, on both_deploy_native_manifestsand_handle_argo_managed_deployment. Argo CD does not own the object: AppProjecthomelablists ConfigMapdevops-cli-configunderorphanedResources.ignore, and the Go-live check runs the command from a checkout ofmain. The object therefore keeps only the last state, in its data and inkubectl.kubernetes.io/last-applied-configuration, and k8s/README.md tells a person not to change it withkubectl editorkubectl apply, because no record of such a change stays. [sources: src/devops_cli/k8s/configmap.py:135, src/devops_cli/commands/k8s/stack_lifecycle.py:944, src/devops_cli/commands/k8s/stack_lifecycle.py:953, src/devops_cli/commands/k8s/stack_lifecycle.py:1294, src/devops_cli/commands/k8s/stack_lifecycle.py:1317, k8s/argocd/apps/projects.yaml:95, docs/CLUSTER.md:176, k8s/README.md:1093] - Which option records a ConfigMap change of the Service?: Option B, extended: deploy-stack compares the live data with the new render, writes the five annotations on the object it applies, adds one key to history ConfigMap
devops-cli-config-changeswith one merge patch and emits one WARNINGconfigmap_changedrecord. Option A moves only the public part to git and needs a split of the object. The audit log is a k3s server setting of the infra repository and is deferred to feat(k8s): Record kubectl writers of the ConfigMap #6428. (best practice) [sources: docs/CLUSTER.md:176, k8s/README.md:113, k8s/README.md:1092, k8s/README.md:1093, src/devops_cli/telemetry/logging_bridge.py:182, k8s/argocd/apps/projects.yaml:95]- Chosen: Option B, extended: comparison, five annotations, a history ConfigMap and one WARNING record from deploy-stack. It records each deploy-stack apply, names the changed settings and the template commit, keeps private values out of git and out of the record, and answers the seven-day query with one kubectl command.
- Rejected: Option A: move the public part to Argo CD with a Kustomize
configMapGenerator. It gives git history for the public part only, and it needs a second object and a split of the private values, so it does not record a private change in one pull request. - Rejected: Option C: the Kubernetes audit log only. The policy and the log path are k3s server settings of the infra repository, and the
Requestlevel holds the private data.
- Where does the seven-day history of the changes live?: In ConfigMap
devops-cli-config-changesof namespacedevops, one data key for each change, pruned to 30 days. k8s/README.md already says thatdevops config setkeeps a copy ofconfig.yamland a record of the changed keys with no value, so this object is the same record for the deploy path. The object sits besidedevops-cli-config, and onekubectlquery reads it. (best practice) [sources: k8s/README.md:1092, docs/CLUSTER.md:179, src/devops_cli/telemetry/logging_bridge.py:182, k8s/argocd/apps/projects.yaml:95]- Chosen: A history ConfigMap written by deploy-stack. It is in the cluster, one kubectl command reads it, it needs no telemetry, and it holds setting names only.
- Rejected: Loki only, from the
configmap_changedrecord. The record reaches Loki only while telemetry is enabled and pointed at the collector, so a run with telemetry off leaves no history. - Rejected: The Kubernetes audit log. The policy is a host setting of the infra repository, so the item would wait on an owner step.
- Which annotation keys hold the change record?: Use the project's recorded annotation prefix
roadmap.devops-cli/:roadmap.devops-cli/config-template-commit,roadmap.devops-cli/data-sha256,roadmap.devops-cli/changed-settings,roadmap.devops-cli/changed-atand the optionalroadmap.devops-cli/change-reason. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md:37, docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md:77, docs/CLUSTER.md:74]- Chosen:
roadmap.devops-cli/prefix. It is the prefix the project records for its object annotations, it is a DNS subdomain, and it does not claim theapp.kubernetes.io/keys that the template uses for the application name and its part. - Rejected:
devops-cli/prefix. It is a single label and not the prefix the project records, so it risks a collision with another owner's keys. - Rejected:
app.kubernetes.io/prefix. The template already uses those keys for the application name and its part, not for a change record.
- Chosen:
- At which log level does the record reach the collector?: WARNING, on logger
devops_cli.k8s.configmap, which is the module that builds the record.OTelLoggingHandlerexports WARNING and above by default and special-cases onlydevops_cli.roadmap.job_resultat INFO, so the record passes with no change to the handler. (best practice) [sources: src/devops_cli/telemetry/logging_bridge.py:182, src/devops_cli/telemetry/logging_bridge.py:205, src/devops_cli/telemetry/logging_bridge.py:213]- Chosen: WARNING on
devops_cli.k8s.configmap. It passes the default threshold of the handler with no change to the handler. - Rejected: INFO on the new logger. The handler drops it unless every process lowers the handler's minimum level.
- Rejected: Add the logger to the INFO allowlist. It adds a second exception to the handler for no need.
- Chosen: WARNING on
- Where in the apply path is the record written?: A new
_apply_devops_configmapinsrc/devops_cli/commands/k8s/stack_lifecycle.pyreads the live data, calls the pure comparison and annotation builders ofsrc/devops_cli/k8s/configmap.py, and applies the annotated manifest through_apply_rendered; the history patch and the log record run only after that call returns. Both apply paths (_deploy_native_manifestsand_handle_argo_managed_deployment) call it in place of_apply_rendered. (best practice) [sources: src/devops_cli/commands/k8s/stack_lifecycle.py:944, src/devops_cli/commands/k8s/stack_lifecycle.py:953, src/devops_cli/commands/k8s/stack_lifecycle.py:1294, src/devops_cli/commands/k8s/stack_lifecycle.py:1317, src/devops_cli/k8s/configmap.py:58, src/devops_cli/k8s/configmap.py:135]- Chosen: After a successful apply, from pure builders in the command layer. The record is true only when the apply succeeds, the live read stays at the kubectl seam, and the pure builders let a test pin the record offline.
- Rejected: Before the apply. A failed apply would leave a record of a change that did not happen.
- Rejected: A cluster read inside the pure renderer. The renderer is pure and tested with no cluster, so a kubectl call there would break that seam.
- How does deploy-stack add a history line without losing a concurrent one?: Use one data key for each record, named
<epoch seconds>-<first 8 characters of the data SHA-256>, added by onekubectl patch --type merge. An ISO-8601 time holds:, which a ConfigMap key forbids, so the key holds the epoch seconds and the JSON line holds the ISO time. The same patch deletes the keys older than 30 days, and a merge patch adds or replaces only the keys it names, so two deploys at the same time keep both records. (best practice) [sources: docs/adr/0022-one-repository-reference-names-the-objects-labels-and-keys-of-each-repository.md:37, src/devops_cli/k8s/argocd_overrides.py:138, src/devops_cli/commands/k8s/stack_lifecycle.py:1044, k8s/README.md:1092]- Chosen: One data key for each record, added by one merge patch. A merge patch adds or replaces only the named keys, so two deploys at the same time keep both records, and the same patch prunes the old keys. The epoch-second key is a valid ConfigMap key.
- Rejected: One
changes.jsonlkey that the command reads, appends and writes back. Two deploys that run together read the same text, and the second write drops the record of the first. - Rejected: One Secret that holds the history. No need: the record holds setting names and no value.
- Should this item change the Argo CD orphan ignore list?: No. The edit belongs to
dan-petty/homelab, becausek8s/argocd/apps/projects.yamlis an environment path that thek8senvironment-freeze gate refuses indevops-cli(tests/gate/k8s_checks/environment_freeze.py:38-45;docs/HOMELAB_REPO_SWITCH.mdStep 11). The new issue adds ConfigMapdevops-cli-config-changestoorphanedResources.ignoreof AppProjecthomelabbesidedevops-cli-config. This item creates the history object and leaves the warning to that issue. (best practice) [sources: tests/gate/k8s_checks/environment_freeze.py:38-45, docs/HOMELAB_REPO_SWITCH.md, k8s/argocd/apps/projects.yaml:95]- Chosen: Defer the AppProject edit to a
dan-petty/homelabissue.k8s/argocd/apps/projects.yamlis an environment path, and thek8senvironment-freeze gate refuses a change to it indevops-cli. - Rejected: Edit
k8s/argocd/apps/projects.yamlin this item. Thek8senvironment-freeze gate fails the pull request, as the stage return states. - Rejected: Leave the ignore list unchanged with no new issue. Argo CD reports the untracked history ConfigMap as orphaned, so the homelab issue must record the edit.
- Chosen: Defer the AppProject edit to a
- Does the item enable Kubernetes audit logging?: No. It defers the audit log to feat(k8s): Record kubectl writers of the ConfigMap #6428. A cluster logs no audit event without a policy file and a log path, and both are kube-apiserver flags of the k3s server in the infra repository. The deferred issue uses the
Metadatalevel, becauseRequestholds the request body, which is the private data. (best practice) [sources: k8s/README.md:556]- Chosen: Defer the audit log to feat(k8s): Record kubectl writers of the ConfigMap #6428. The policy is a host setting outside this repository and an owner step, and the main item can record the deploy-stack path in one pull request.
- Rejected: Enable the audit log in this item. It makes the item wait on a k3s server change in the infra repository, and the
Requestlevel would write the private values into the audit log.
- How does deploy-stack name the git commit of the template?: From the checkout, with
git log -1 --format=%H -- k8s/devops/configmap.example.yaml, run with an argument array andshell=Falseas every external program is. When the product folder is not a git checkout the commit is empty and the annotation is left off, and the data SHA-256 still names the state. (best practice) [sources: CONTRIBUTING.md:70, ARCHITECTURE.md:144, src/devops_cli/k8s/configmap.py:145, src/devops_cli/commands/k8s/stack_lifecycle.py:944]- Chosen: The last commit that touched the template. It names the template that the render reads, and the data SHA-256 covers a change that comes from
config.yamlalone. - Rejected:
git rev-parse HEADof the checkout. It changes on each unrelated commit, so two applies of one template would name two commits.
- Chosen: The last commit that touched the template. It names the template that the render reads, and the data SHA-256 covers a change that comes from
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Both concern the live ConfigMap and its relation to the template, but #4375 delivers a one-time PR comment listing current differences while the candidate delivers a persistent audit record of every change over time.devops-cli-service commentedon Nov 17, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 19, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 19, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
dan-petty commentedon Nov 25, 2026
Returning #5221 for re-scoping because one acceptance criterion modifies a path frozen for
dan-petty/homelabwhile another product path now owns it:Requirement: Argo CD ignores the history objectrequires editingk8s/argocd/apps/projects.yaml(AppProjecthomelaborphanedResources.ignore) and passinguv run devops ci --check --only k8s.tests/gate/k8s_checks/environment_freeze.py:38-45:is_environment_path("k8s/argocd/apps/projects.yaml") == True, so any pull request changingk8s/argocd/apps/projects.yamlindevops-clifails thek8s(environment-freeze) gate (docs/HOMELAB_REPO_SWITCH.mdStep 11).Please split the
k8s/argocd/apps/projects.yamlorphanedResources.ignoreedit into adan-petty/homelabissue and keep thedevops k8s deploy-stackConfigMap change-tracking implementation in#5221.devops-cli-service commentedon Nov 25, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
feat(k8s): record live devops ConfigMap changes (#5221)
feat(k8s): record live devops ConfigMap changes (#5221)
devops-cli-service commentedon Nov 25, 2026
Released in v0.219.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.219.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 17:09 UTC