Skip to content

feat(argo): retire the Helm release records of the charts that Argo CD renders - #2568

Merged
dan-petty merged 2 commits into
mainfrom
chore/1644-retire-adopted-helm-records
Oct 29, 2026
Merged

dan-petty merged 2 commits into
mainfrom
chore/1644-retire-adopted-helm-records

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A chart that helm upgrade --install deployed before Argo CD adopted it kept its Helm release records: Secrets labelled owner=helm in the release namespace. Argo CD only renders a chart with helm template, so helm list still showed those releases as deployed, and helm rollback or helm uninstall would act on objects that Argo CD owns, a chart's PersistentVolumeClaim included. AppProject homelab ignored the records as orphans, so Argo CD never reported them.

  • New command devops argo cd apps retire-helm-records (src/devops_cli/argo/helm_records.py).
    • A release is planned when an Application renders it: a chart source's helm.releaseName, or else the Application's name, in the Application's destination namespace.
    • It qualifies when Argo CD applied each top-level object that carries the release's Helm annotations: the object carries the Application's tracking id, or names the field manager argocd-controller. Argo CD writes no tracking id on a CustomResourceDefinition.
    • A record with an owner reference, such as those of the Alloy operator, stays.
    • Without --confirm it only reads and prints the plan. --confirm deletes the planned records by name. --dry-run makes no request.
    • It reads the records and the objects through a metadata jsonpath, so no Secret data reaches the process. The command is not an MCP tool.
  • AppProject homelab no longer ignores sh.helm.release.v1.* Secrets, so Argo CD shows a left-over record.
  • k8s/README.md runs the step at the end of Bootstrap & Adoption and of Recovery, whose helm upgrade --install argocd writes a new record.
  • The Helm knowledge base page uses a release that no Application renders in its examples, and sends an adopted release to git and Argo CD. A test fails when a knowledge base page runs helm rollback, helm uninstall or helm upgrade against a release that an Application in k8s/argocd/apps/ renders.

Closes #1644

Change: openspec/changes/archive/2026-10-28-1644-retire-adopted-helm-records/

@dan-petty

Copy link
Copy Markdown
Owner Author

Test and check evidence:

  • uv run pytest tests/test_argo_helm_records.py tests/test_mcp.py tests/test_k8s_argocd_apps.py tests/test_argo.py: 243 passed after the rebase onto origin/main dbfbb65. Before the change, the new AppProject assertion and the knowledge base check failed (sh.helm.release.v1.* still ignored; helm.md ran helm rollback prometheus and helm uninstall prometheus), and the command tests could not import devops_cli.argo.helm_records.
  • tests/invariants, tests/test_architectural_invariants.py: pass. mypy on the two changed source modules: no issues. devops docs check: up to date.

Dry run on the homelab cluster (no request made):

Dry run: no request was made. Retiring the Helm release records would make these requests, in order:
  1. kubectl --context <context> get applications.argoproj.io -n argocd -o json
  2. kubectl --context <context> get secrets --all-namespaces -l owner=helm -o 'jsonpath={range .items[*]}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.metadata.labels.name}{"\t"}{.metadata.ownerReferences[*].kind}{"\n"}{end}'
  3. kubectl --context <context> api-resources --verbs=list,create -o name  [only if an Application renders a release that has a record]
  4. kubectl --context <context> get '<kinds>' --all-namespaces --show-managed-fields -o 'jsonpath={range .items[*]}{.kind}{"\t"}{.metadata.namespace}{"\t"}{.metadata.name}{"\t"}{.metadata.annotations.meta\.helm\.sh/release-name}{"\t"}{.metadata.annotations.meta\.helm\.sh/release-namespace}{"\t"}{.metadata.annotations.argocd\.argoproj\.io/tracking-id}{"\t"}{.metadata.ownerReferences[*].kind}{"\t"}{.metadata.managedFields[*].manager}{"\n"}{end}'  [only if an Application renders a release that has a record]
  5. kubectl --context <context> delete secret -n '<namespace>' --ignore-not-found '<records>'  [only if --confirm]  [repeated for each release that qualifies]
Values in <angle brackets> are placeholders for what the run would read or make; no value is shown.

The plan on the homelab cluster, 2026-10-28 (reads only; nothing was deleted):

              Helm release records of charts that Argo CD renders               
 Release               Namespace    Application           Result                
 argocd                argocd       argocd                retire 10 record(s)   
 traefik               kube-system  traefik               retire 2 record(s)    
 open-webui            llm          open-webui            retire 10 record(s)   
 qdrant                llm          qdrant                retire 10 record(s)   
 loki                  logging      loki                  retire 10 record(s)   
 dcgm-exporter         monitoring   dcgm-exporter         retire 10 record(s)   
 grafana               monitoring   grafana               retire 10 record(s)   
 k8s-monitoring        monitoring   k8s-monitoring        retire 10 record(s)   
 prometheus            monitoring   prometheus            retire 10 record(s)   
 prometheus-operator…  monitoring   prometheus-operator…  keep: Argo CD did not 
                                                          apply 10 object(s)    
 pyroscope             monitoring   pyroscope             retire 10 record(s)   
 otel-collector        otel         otel-collector        retire 10 record(s)   
Release prometheus-operator-crds in monitoring: Argo CD did not apply CustomResourceDefinition/alertmanagerconfigs.monitoring.coreos.com. Sync Application prometheus-operator-crds, then run this command again.
Kept, because no Application renders the release or an operator owns the record: monitoring/k8s-monitoring-alloy-logs, monitoring/k8s-monitoring-alloy-metrics, monitoring/k8s-monitoring-alloy-profiles, monitoring/k8s-monitoring-alloy-singleton
Nothing was deleted. Run the command again with --confirm to delete the 102 record(s) of the 11 release(s) that qualify.

(The plan names all 10 CustomResourceDefinitions of prometheus-operator-crds; nine lines are left out here.)

Pending a person:

  1. Sync Application prometheus-operator-crds once (devops argo cd apps sync prometheus-operator-crds). Its history is empty: Argo CD never applied its 10 CustomResourceDefinitions. Server-side apply keeps their helm.sh/resource-policy: keep.
  2. Run devops argo cd apps retire-helm-records, check the plan, then run it with --confirm. After the merge, Argo CD shows the 10 prometheus-operator-crds records as orphans until step 2 deletes them.
  3. Review the diff in tuicr (tuicr -r origin/main..HEAD).

…D renders

A chart that `helm upgrade --install` deployed before Argo CD adopted it
kept its Helm release records, so `helm rollback` or `helm uninstall`
still acted on objects that Argo CD owns. `devops argo cd apps
retire-helm-records` deletes the records of a release when an
Application renders it and Argo CD applied each of its top-level
objects: the object carries the Application's tracking id, or names the
field manager `argocd-controller`. Every object stays. Without
`--confirm` it only reads, and `--dry-run` makes no request.

AppProject `homelab` no longer hides the left-over records, `k8s/README.md`
runs the step after Bootstrap & Adoption and after Recovery, and the
Helm knowledge base page runs no Helm command against a release that an
Application renders.
@dan-petty
dan-petty force-pushed the chore/1644-retire-adopted-helm-records branch from d5bc36b to 3b8fdd1 Compare October 29, 2026 00:09
@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 00:16
@dan-petty
dan-petty merged commit cabfcd4 into main Oct 29, 2026
17 checks passed
@dan-petty
dan-petty deleted the chore/1644-retire-adopted-helm-records branch October 29, 2026 00:16
dan-petty pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.12.0](v0.11.3...v0.12.0)
(2026-10-29)


### Features

* **ai:** constrain structured replies on the openai and claude
providers ([#2550](#2550))
([4f7390a](4f7390a))
* **argo:** retire the Helm release records of the charts that Argo CD
renders ([#2568](#2568))
([cabfcd4](cabfcd4))
* **k8s:** devops k8s tunnel keeps the cloudflared forward to
k8s.&lt;domain&gt; running
([#2567](#2567))
([f9493fa](f9493fa)),
closes [#1641](#1641)
* **monitoring:** alert when the otel collector fails to export spans,
metric points or log records
([#2565](#2565))
([4fc8ff7](4fc8ff7))
* **telemetry:** the roadmap Service counts its GitHub writes, budget
holds, Firecrawl searches and own deliveries, and caps refine's comments
on one item
([#2556](#2556))
([9819877](9819877)),
closes [#2475](#2475)


### Bug Fixes

* **git:** report a worktree that a run in parallel removed as removed,
not a failed reclaim
([#2557](#2557))
([a556984](a556984)),
closes [#2408](#2408)
* **k8s:** the devops perimeter opens only the collector's OTLP/HTTP
port, 4318
([#2549](#2549))
([d156ce7](d156ce7))
* **sandbox:** devops sandbox logs reads each line with its stream from
a real engine
([#2546](#2546))
([e7216d5](e7216d5)),
closes [#2520](#2520)
* **service:** the webhook route refuses an unsigned or oversized
delivery before it reads the body, and a rate limit guards it
([#2553](#2553))
([40efcd4](40efcd4)),
closes [#2476](#2476)


### Performance Improvements

* **ai:** price a request with one load of the settings
([#2555](#2555))
([5d86538](5d86538)),
closes [#1420](#1420)


### Code Refactoring

* **config:** a default that backs a settings field is read only through
the settings
([#2561](#2561))
([0702d13](0702d13))
* **exceptions:** each exception class declares its error_code and
exit_code ([#2558](#2558))
([410dece](410dece))
* **review:** render the review report from one input, outside the
orchestrator
([#2563](#2563))
([9e73e6d](9e73e6d)),
closes [#1008](#1008)
* **security:** src has no unreviewed Bandit findings, and the gate
scans src at low severity
([#2560](#2560))
([45261dd](45261dd)),
closes [#1538](#1538)
* **security:** the scanners stop looking for mocks, and their tests run
on the scanner fake
([#2551](#2551))
([2b7f37a](2b7f37a))

---
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(k8s): bootstrap-gitops retires the helm release records of charts argo cd adopted, and no runbook runs helm against them

1 participant