Repository navigation
Description
Problem
devops secrets push restarts the workloads that read a Secret only when the push changes an existing Secret. SecretPlan.changed() returns False when no live Secret exists (src/devops_cli/k8s/secret_push.py:149-155), and _needs_restart (secret_push.py:629-631) requires changed().
A workload that reads the Secret through optional: true starts before the first push, with empty values. The first push creates the Secret and restarts nothing, so the workload keeps the empty values until a person restarts it. Examples: the Grafana GitHub App of dan-petty/homelab#278 (plan PR dan-petty/homelab#511): the data source health check keeps the answer error parsing app id. The runner App step of homelab k8s/README.md:926 has the same gap.
Done when
- A push that creates a Secret restarts each workload that reads it, as a push that changes it does.
--planand the dry run name that restart.- A test proves the restart for a created Secret and for a changed Secret, and proves no restart for an unchanged Secret.
Alternatives check of 2026-11-27: partly.
Tool: stakater/Reloader (https://github.com/stakater/Reloader), Apache-2.0, last activity 2026-11-24, maintained.
Reason: Searches found stakater/Reloader, an open, maintained controller that rolls annotated workloads when a Secret changes, but it works cluster-side and gives no plan output or tests for the push command.
Covers:
- Rolling restart of annotated Deployments, StatefulSets, DaemonSets and CronJobs on change
- Cluster-side watch of Secret and ConfigMap changes, outside the push command
- Restart through the Kubernetes API with no code in the CLI
Lacks:
- No plan or dry-run output that names the restart
- Each workload needs an opt-in annotation or label
- No tests for created, changed and unchanged Secret cases
Proposed design
Problem statement
devops k8s push-secrets restarts the workloads that read a Secret only when the push changes an existing Secret. A workload that reads an optional Secret starts with empty values, and the first push creates the Secret and restarts nothing, so the workload keeps the empty values until a person restarts it. The change treats a created Secret as a restart case, names the restart in --plan and in the dry run, and fixes the guide, the cluster document and the help text that state the changed-only rule.
Acceptance criteria
Requirement: Created Secret restarts its readers
devops k8s push-secrets SHALL restart each existing workload that reads a Secret when the push creates that Secret.
Scenario: First push creates a Secret
- WHEN The plan holds a Secret with no live object and at least one key to write, a workload in the Secret's
restartsexists, and the push applies the Secret. - THEN The push runs
kubectl rollout restartonce for each existing workload in the Secret'srestarts, and no workload twice.
Requirement: Changed Secret still restarts its readers
devops k8s push-secrets SHALL restart each existing workload that reads a Secret when the push changes that Secret's data.
Scenario: Push adds a key to a Secret
- WHEN A live Secret exists, a workload reads it, and the push writes a key that the live Secret does not hold.
- THEN The push runs
kubectl rollout restartonce for that workload.
Requirement: Unchanged Secret restarts no reader
devops k8s push-secrets MUST NOT restart a workload when the push writes the same data to an existing Secret.
Scenario: Push leaves a Secret unchanged
- WHEN A live Secret holds the same values as the keyring, a workload reads it, and the push writes the same data again.
- THEN The push runs no
kubectl rollout restart.
Requirement: Plan names a created Secret restart
devops k8s push-secrets --plan SHALL name each workload that the push would restart for a created Secret.
Scenario: Plan for a created Secret
- WHEN
devops k8s push-secrets --only <ref> --planruns with no live Secret, a key to write and an existing workload in the Secret'srestarts. - THEN The line for the Secret says
would createandwould restart: <workload>, and the run makes onlykubectl getcalls.
Requirement: Dry run names a created Secret restart
The dry run SHALL list the restart of a created Secret as a request under the condition that creates the Secret.
Scenario: Dry run for a created Secret
- WHEN
devops k8s push-secrets --dry-runruns with restarts on for a Secret with no live object and a workload in itsrestarts. - THEN The request plan holds
kubectl rollout restart <workload>under the conditionthe push creates or changes live <ref>'s data.
Requirement: Help and generated command page name the created restart
The --plan help and the generated page docs/commands/k8s.md SHALL name the workloads that a created or changed Secret restarts.
Scenario: Generated command page is current
- WHEN The help text of
--plannames a created Secret's restart anduv run devops docs checkruns. - THEN The check passes, because
docs/commands/k8s.mdis regenerated from the new help text.
Existing Tool Considered
stakater/Reloader (https://github.com/stakater/Reloader), verdict: partly. The alternatives block of the issue body gives what the tool lacks, and the project rejected Reloader for a cluster-side restart before (openspec/changes/archive/2026-10-28-821-gpu-dcgm-panels/design.md:34). The restart stays in devops k8s push-secrets, which already holds the restart targets, the --plan line and the tests. Cost of the CLI change: about 3,000 tokens and under 1 hour; no new controller.
Key questions
- Which function decides that a Secret push restarts a workload?:
_needs_restartatsrc/devops_cli/k8s/secret_push.py:629decides it: it returnsbool(plan.data()) and plan.changed()at line 631.preview_restartscalls it for--planat line 637, and_writecalls it for the push at line 652.SecretPlan.changed()returns False when no live Secret exists (secret_push.py:149-155), which is the gap. [sources: src/devops_cli/k8s/secret_push.py:149, src/devops_cli/k8s/secret_push.py:629, src/devops_cli/k8s/secret_push.py:631, src/devops_cli/k8s/secret_push.py:637, src/devops_cli/k8s/secret_push.py:652] - How should the push treat a Secret that does not exist yet?: Count a plan with no live Secret and at least one key to write as a restart case. Change
_needs_restarttobool(plan.data()) and (plan.live is None or plan.changed()), and say in its docstring that the push creates or changes a Secret it writes.plan_pushputs only the Secrets of a present namespace inplan.secrets(secret_push.py:472-497), solive is Nonemeans the Secret does not exist. Keepchanged()as it is: it means a change to an existing Secret's data, and the--planchange note reads it (src/devops_cli/commands/k8s/cluster_secret_push.py:108). (best practice) [sources: src/devops_cli/k8s/secret_push.py:149, src/devops_cli/k8s/secret_push.py:472, src/devops_cli/k8s/secret_push.py:497, src/devops_cli/k8s/secret_push.py:629, src/devops_cli/k8s/secret_push.py:631, src/devops_cli/commands/k8s/cluster_secret_push.py:108]- Chosen: Extend
_needs_restart. It fixes the push and the--planpath at one place, keepschanged()for an existing Secret and adds no plan-only decision. - Rejected: Make
changed()true when no live Secret exists.changed()means a change to an existing Secret's data, and the--planchange note reads it, so a create would print a note about a change. - Rejected: Restart every workload on every push. It breaks the unchanged Secret case and rolls workloads that already read the same data.
- Chosen: Extend
- Should the plan adopt stakater/Reloader for this restart?: No. Reloader is a cluster-side controller, and the alternatives block of the issue body gives what it lacks. The project rejected it for a cluster-side restart before (
openspec/changes/archive/2026-10-28-821-gpu-dcgm-panels/design.md:34), andCONTRIBUTING.md:26asks a design question to be decided with the best practice or the open tool. The restart stays indevops k8s push-secrets, so--planand the dry run name it and offline tests prove the created, changed and unchanged cases. (best practice) [sources: openspec/changes/archive/2026-10-28-821-gpu-dcgm-panels/design.md:34, CONTRIBUTING.md:26]- Rejected: Adopt stakater/Reloader. It restarts on a cluster-side watch, so the push cannot name the restart in
--planor the dry run, and the three offline cases have no test. - Chosen: Keep the restart in
devops k8s push-secrets. The command already holds the restart targets and the tests, and the project rejected Reloader before.
- Rejected: Adopt stakater/Reloader. It restarts on a cluster-side watch, so the push cannot name the restart in
- How should
--planand the dry run name a restart of a created Secret?:--planalready goes through_needs_restartinpreview_restarts(secret_push.py:634-638),_restart(preview=True)(secret_push.py:613-626) andsecret_line(secret_push.py:680-689), so the fix to_needs_restartmakes it printwould restart: <workload>. The dry run reads no plan:_plan_writesbuilds the workload read and thekubectl rollout restartrequest under the conditionthe push changes live <ref>'s data(secret_push.py:797-805). Change that condition tothe push creates or changes live <ref>'s data, so the dry run lists the restart of a created Secret too. Change the docstrings of_restartandpreview_restartsthat saychanged. (best practice) [sources: src/devops_cli/k8s/secret_push.py:613, src/devops_cli/k8s/secret_push.py:634, src/devops_cli/k8s/secret_push.py:680, src/devops_cli/k8s/secret_push.py:797, src/devops_cli/k8s/secret_push.py:805]- Chosen: Extend the existing restart path and the dry-run condition.
--planprintswould restartfrom_needs_restart, and the dry run lists the rollout request from the same rule, so both agree with the push. - Rejected: Add a plan-only restart message. It duplicates the decision and can disagree with the restart that the push runs.
- Rejected: Leave the dry-run condition as a change only. The dry run would list no restart for a created Secret, which contradicts the push and the done-when.
- Chosen: Extend the existing restart path and the dry-run condition.
- Which documents and help text state the changed-only rule?:
k8s/README.md:221heads its restart columnRestarted when it changes,k8s/README.md:265anddocs/CLUSTER.md:263say a push that creates the SearXNG metrics Secret restarts nothing and a person then runskubectl rollout restart, andk8s/README.md:274-275and the help atsrc/devops_cli/lang/en/help.py:394say--plannames the workloads a change would restart. The generated pagedocs/commands/k8s.md:298copies that help.AGENTS.md:14rule 8 requires the same pull request to fix a document that the change makes wrong, anduv run devops docs checkchecks the generated page (CONTRIBUTING.md:196). [sources: k8s/README.md:221, k8s/README.md:265, k8s/README.md:274, k8s/README.md:275, docs/CLUSTER.md:263, src/devops_cli/lang/en/help.py:394, docs/commands/k8s.md:298, AGENTS.md:14, CONTRIBUTING.md:196] - Which tests hold the created, changed and unchanged cases now?:
tests/k8s/test_cluster_secret_push.py:326(test_keyring_values_without_live_secrets_are_created_and_restart_nothing) pins the old behavior: it creates Secrets while workloads exist and asserts nokubectl rollout, so it changes to expect the restarts. The changed case is at line 367 (test_a_key_added_to_an_existing_secret_restarts_its_workloads_once), the unchanged case at line 352 (test_an_equal_live_value_is_unchanged_and_restarts_nothing), and the plan case attests/k8s/test_cluster_secret_plan.py:1273(test_plan_lists_the_workloads_a_changed_secret_would_restart). [sources: tests/k8s/test_cluster_secret_push.py:326, tests/k8s/test_cluster_secret_push.py:335, tests/k8s/test_cluster_secret_push.py:352, tests/k8s/test_cluster_secret_push.py:367, tests/k8s/test_cluster_secret_plan.py:1273]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 27, 2026
Both deal with restarting a workload, but #809 adds a manual CLI restart command while the candidate fixes the automatic restart logic on Secret creation.devops-cli-service commentedon Nov 27, 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 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 28, 2026
Released in v0.241.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.241.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 00:41 UTC