Update and remove deployments
Use this page to change an installed stack: rebuild a local image, upgrade or roll back, rotate credentials, restore a database, deliver workflow scripts, preview changes or remove releases.
A release is one named chart installation, such as remediation-orchestrator or
nro-db. The nro-bootstrap release runs Jobs that migrate NRO’s database and prepare
Temporal before Helmfile installs or upgrades the application.
Before you change a deployment
On every command here, use the environment, ordered state files, cluster context and namespace the deployment was installed with:
-
Environment and state files. The shared examples use
-e devwith--state-values-file "$HOME/.config/remediation-orchestrator/dev.yaml". Substitute your own environment name and state files, in the same order. The local examples use-e local, plus any state file or--state-values-setoverride you installed with, such as a changedpublicUrl. -
Cluster. Select the context and clear overrides as in Select the cluster, and confirm
kubectl config current-contextbefore eachsyncordestroy. For-e localon any cluster other thankind-remediation-orchestrator, including a kind cluster with another name, repeat its--kube-contextoverride (Use another local cluster). -
Namespace. Plain
kubectlandhelmcommands for a shared installation use$nro_namespace. Set it to the exactnamespacevalue in your state file:The local stack uses
remediation-orchestratorunless your state overridesnamespace.
Run Helmfile commands from the Helm module root, the directory holding helmfile/.
Rebuild and redeploy
These steps update the local stack after a change to NRO. From the Helm module root, record its location before changing to the application source root. In a public clone, the application source root is its parent. For other layouts, use Build the NRO image.
From the application source root, rebuild:
Then return to the Helm module root. There you give the new image the local tag, load it
onto the kind nodes, sync, and restart NRO. If your change adds database migrations, add
--state-values-set-string bootstrap.runToken=<new value> to the sync command below,
so the migration Job runs again (Rerun the bootstrap Jobs).
With pullPolicy: Never, the node uses whatever image kind load last placed under the
local tag. Loading a new image under the same reference does not change the rendered
pod or Job specs. If their other inputs are unchanged, sync leaves running pods and
completed bootstrap Jobs in place. The restart picks up the new image.
For a kind cluster with another name, pass --name <cluster> to kind load. On another
local cluster tool, use its image import in place of kind load. In both cases, add your
context override to the sync.
Upgrade
To upgrade, first publish a new image tag or digest
(Build and publish your image).
Then update your state file and run the same sync command you installed with. Changed
bootstrap Job specifications create new Jobs, and unchanged completed Jobs do not run
again.
With the default Recreate strategy, every rollout stops all NRO pods before new ones
start. NRO is therefore unavailable during each upgrade, configuration change or restart,
whatever replicaCount is.
Bootstrap finishes before Helmfile upgrades the remediation-orchestrator release, so the
old NRO can still be running during migrations. Recreate does not stop the old pods
before bootstrap.
Render the upgraded state first. The render must succeed before you change anything in the cluster:
For an incompatible schema change, take a database backup and stop the old NRO pods
before you sync. Managed clusters have no backups by default. Configure them first through
postgresql.values.backups
(Tune the charts through passthroughs),
and read Restore a database for what a restore involves. Other
upgrades skip this step. With
remediation-orchestrator.workload.kind: StatefulSet, use
statefulset/remediation-orchestrator in place of deploy/remediation-orchestrator
throughout this procedure:
Then apply the upgrade:
If you stopped NRO, it stays stopped while the bootstrap Jobs migrate the database. The
upgrade of the remediation-orchestrator release then restores the chart’s
replicaCount. Confirm that NRO is back with
kubectl -n "$nro_namespace" rollout status deploy/remediation-orchestrator. State values
cannot stop NRO for you, because the chart requires a replicaCount of at least 1.
After sync succeeds, repeat the checks for your installation type, keeping this
installation’s namespace and context:
Check and open NRO for a local
installation, or
Render, deploy and verify for a
shared one. For an authenticated installation, also check browser sign-in and intended
administrator access. The Helm health test does not exercise them.
The migration Job must finish within bootstrap.jobs.activeDeadlineSeconds (default 600
seconds), which also covers its wait-postgres wait. For a long migration, raise that
key. Keep the top-level readiness.timeoutSeconds greater than it, so Helm waits for the
Job. The state check enforces this.
Under Helmfile, a failed bootstrap pod is retried once
(bootstrap.jobs.backoffLimit: 1), and the failed Job is kept for inspection. You can
retry without changing the Job specification, for example after you fix a credential or
other external condition. Pass a new token, as
Rerun the bootstrap Jobs shows.
A Temporal upgrade reruns the
schema hook before the servers
roll, and a rollback does not revert the schema. The schema hook runs in the admin-tools
image, so keep upstreamImages.temporalAdminTools on the same Temporal release as the
server (Images).
The value of temporal.historyShards is fixed after Temporal initializes its database, so
do not change it against retained Temporal data. Choose it before the first install
(Known limits).
Roll back the NRO image
NRO starts against a newer database schema: at startup it rejects only a schema that is behind the binary. Whether the older code works with the newer schema depends on the migrations in between.
Do not roll back by setting the older image in state and running sync. The image is
part of the migration Job’s name hash, so the change reruns the Job with the older binary.
If the newer release added migrations, maestro migrate then fails because the database
is ahead of the binary’s migrations, with
current version N is outside the valid versions of 0 to M. Bootstrap fails, and
Helmfile does not upgrade NRO.
To run an older image, roll back only the NRO release with Helm. This does not run bootstrap and does not reverse database migrations:
Do not run sync until your state names an image at least as new as the database
schema. To return to the older schema, restore the database backup taken before the
upgrade (Restore a database), then sync the older image.
Rerun the bootstrap Jobs
Completed bootstrap Jobs do not run again while their specification is unchanged. To run
them again, for new database migrations or after you fix an external condition, pass a new
bootstrap.runToken to sync. A different token changes the Job names and reruns the
enabled bootstrap Jobs:
For the local stack, add the same flag to the local sync command. Use a different value
each time. The -string form keeps a number such as 2 a string, which the state schema
requires.
Helmfile does not remember a token given on the command line. A later sync without it
uses the token from your state files, or the empty default if none is set. Keep passing
your latest token, or save it as bootstrap.runToken in an optional local state file
passed with --state-values-file.
Rotate credentials
Update the Secret, then apply the step for the credential. With
remediation-orchestrator.workload.kind: StatefulSet, use
statefulset/remediation-orchestrator in place of deploy/remediation-orchestrator:
Restore a database
The stack has no way to bootstrap a managed database from a CNPG backup.
postgresql.values rejects the CNPG chart’s mode and recovery keys, because that
passthrough reaches both database clusters. To use restored NRO data, run the restored
database outside the stack and switch to database.mode: external
(Use existing backing services).
For Temporal’s data, run the restored database and a Temporal server on it outside the
stack, and switch to temporal.mode: external. The switch leaves the old managed release
and its data in place.
Deploy workflow scripts
The charts do not load scripts. For an interactive first workflow, follow
Your First Script.
For ongoing delivery, deploy scripts through the script bundle API, normally
with maestroctl scripts deploy from a script repository’s CI, as the
script deployment guide
describes. Map the deploying identity to the script-uploader role in each tenant it
deploys to.
Optional diff and apply
diff compares releases against a cluster, and apply performs that comparison
before syncing changes. Both need helm-diff
in addition to Helmfile. This checkout does not pin helm-diff or install it for
automated tests. Install a plugin version compatible with your selected Helm version and
verify it before using these commands. Helm 4 requires a Helm-4-compatible plugin.
apply is supported for a healthy stack. After any failed release, recover with sync
instead. The helm-diff plugin compares against the latest stored revision, including a failed one.
So apply with unchanged values can skip a release whose pre-upgrade hook failed, such
as nro-temporal after a failed
schema hook.
After you install and verify the plugin, use the same environment, ordered state files
and context as for sync. For example, from the Helm module root:
For the local stack, helmfile -f ./helmfile -e local status lists the installed
releases without the plugin.
Remove the local deployment
To remove the remediation-orchestrator release and the bootstrap Jobs while keeping the supporting services and data:
component=bootstrap selects nro-bootstrap only (Components).
The following commands remove every release while keeping the cluster. First confirm
that kubectl config current-context prints your local cluster’s context
(kind-remediation-orchestrator for the supplied kind setup).
A full destroy removes the CNPG operator and the managed databases, and with them all
NRO and Temporal data. Each CNPG Cluster owns its PersistentVolumeClaims, so
Kubernetes deletes the claims when destroy removes the nro-db and nro-temporal-db
releases. On kind, the default StorageClass then deletes the volumes as well:
The claims can still be listed when destroy returns. Kubernetes removes them shortly
afterward, so repeat the second command until it reports no resources.
The remediation-orchestrator and cnpg-system namespaces and the CNPG
CustomResourceDefinitions remain. A Temporal ServiceAccount created through
temporal.values.serviceAccount.create, or a failed nro-temporal-schema Job, also
remains (Clean up what destroy leaves).
To discard the whole disposable cluster instead, follow Remove the local cluster.
Uninstall
These commands remove a shared installation. Confirm the context and set
nro_namespace as in Before you change a deployment.
To keep the databases and services, remove the remediation-orchestrator release and bootstrap:
component=bootstrap selects nro-bootstrap only (Components).
To remove every release this Helmfile manages, run the command below. That includes the managed database clusters and, if this Helmfile installed it, the CloudNativePG operator.
The command deletes both managed databases and their data. Each CNPG Cluster owns its
PersistentVolumeClaims, so removing the nro-db and nro-temporal-db releases deletes
the claims, whether or not the operator stays installed. If you need the data, back up
the databases first, or destroy only selected releases as above to keep it:
Clean up what destroy leaves
Some resources outlive destroy, and a shared CloudNativePG operator must stay while
other installations use it. Review each item below before you delete anything.
The CloudNativePG operator. The operator serves the whole cluster, so other
installations can use the one this Helmfile installed. Keep it while any of them still
needs it. To do so, destroy with cnpg.install: false and no cnpg.values in the state.
That omits the cnpg release and leaves the operator in place. Alternatively, destroy
only selected releases. After nothing uses the operator, uninstall it with
helm -n cnpg-system uninstall cnpg, substituting your cnpg.operatorNamespace.
The Temporal ServiceAccount. A ServiceAccount created with
temporal.values.serviceAccount.create is a Helm hook, so it also stays after a full
destroy
(The Temporal ServiceAccount).
Before you delete it, remove every workload that runs as it and review the RoleBindings
and other references to it:
A failed schema Job. A failed schema Job, nro-temporal-schema, can also stay after a
full destroy or a helm uninstall removes the nro-temporal release itself
(Temporal schema migration). If you destroyed
only the NRO or bootstrap releases, nro-temporal is still installed, so keep the Job.
Collect the failed Job’s diagnostics before you delete anything:
External services and switched releases. External backing services are untouched. So
is a release left in place by a
mode switch.
Remove such a release with helm uninstall.
Retained volumes. Whether the data outlives its claims depends on the StorageClass
reclaim policy. With Delete, the usual default, the volumes are deleted with the claims.
With Retain, each volume stays Released and keeps its data until you delete it:
Delete a retained volume with kubectl delete pv <name> only when you intend to discard
its data.
Next steps
- A sync, upgrade or removal fails: Troubleshooting.
- Change the state before the next sync: Environments and state.
- Install again from scratch: Shared K8s or Local K8s.