docs(linstor): cover the locked controller and retries after a way back

The live run of the ways back found the restarted linstor-controller
with its master key locked: the LinstorCluster sets no
linstorPassphraseSecret, so new LUKS volumes fail until the passphrase
is entered. Every way back restarts the controller, so each one now
says to unlock it.

Starting again after a way back from step 3 or 4 finds the converted
objects still there. A plain delete of a Resource or Snapshot is not
safe: the satellite's finalizer is released only after it has deleted
the replica's storage, so the next hold would destroy the volume.
Say what a retry overwrites, what it leaves, and how to clear the
rest and keep the LUKS passwords under one keyring.

Also warn that the scheduler and GUI show one UpgradeFailed when the
migration completes, which clears on its own.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil committed 2026-11-29 23:04:37 +01:00
1 parent 8d0e577afe
commit ee5d2adceb
1 file changed
+5 -3
+5 -3
View File
@@ -40,13 +40,15 @@ piraeus-operator keeps running throughout, as in the runbook. Given LINSTOR's sh
Run each step below as its own change, never together with a Cozystack upgrade. A platform upgrade can bring a new piraeus-operator or linstor-csi, and the running operator would roll their pods out in the middle of the migration.
Each step says how to go back from it. Every way back up to step 4 ends the same way, called "back to LINSTOR" below: set `storage: {backend: linstor, acknowledgeBackendChange: linstor}` without `blockstorMigration` in one change and wait for the `linstor` release, which removes blockstor's controller, apiserver and satellites, then scale `linstor-controller` to 1 and `linstor-csi-controller` back to its count from step 1. The blockstor CRDs and their objects stay behind; nothing reads them under `linstor`.
Each step says how to go back from it. Every way back up to step 4 ends the same way, called "back to LINSTOR" below: set `storage: {backend: linstor, acknowledgeBackendChange: linstor}` without `blockstorMigration` in one change and wait for the `linstor` release, which removes blockstor's controller, apiserver and satellites, then scale `linstor-controller` to 1, unlock it, and scale `linstor-csi-controller` back to its count from step 1. The restarted controller starts with its master key locked, because the `LinstorCluster` this chart renders sets no `linstorPassphraseSecret`: existing LUKS volumes keep running and moving, but a new LUKS volume fails with `Unable to create encrypt key without having a master key` until `linstor encryption enter-passphrase` is given the value of `MASTER_PASSPHRASE` in the `linstor-passphrase` Secret. Any restart of linstor-controller under this chart behaves the same; setting `linstorPassphraseSecret: linstor-passphrase` on the `LinstorCluster` would unlock it on start instead. The blockstor CRDs and their objects stay behind; nothing reads them under `linstor`.
1. Do the runbook's pre-flight checks and write down the replica count of `deploy/linstor-csi-controller`. Freeze: scale `deploy/linstor-csi-controller` and then `deploy/linstor-controller` to 0. Take the dump and convert it now, with nothing left to write to the LINSTOR database, and apply the converted keyring Secret into `cozy-linstor`. Back: scale `linstor-controller` to 1 and `linstor-csi-controller` back; the keyring Secret is not read under `linstor` and can be deleted.
Starting the migration again after a way back begins at step 1 with a fresh dump and conversion; the old manifests describe a LINSTOR state that has moved on. A way back from step 1 or 2 leaves no converted objects, and applying the new keyring Secret replaces the old one. A way back from step 3 or 4 leaves every converted `Node`, `StoragePool`, `ResourceGroup`, `ResourceDefinition`, `Resource` and `Snapshot` in place. The new server-side apply overwrites the objects that come back under the same names, but not the others: one for a volume deleted under LINSTOR meanwhile stays and is brought back by the next adoption. Do not remove those objects with a plain `kubectl delete`. A blockstor satellite holds a finalizer on each `Resource` and `Snapshot` and releases it only after it has deleted that replica's storage, so the delete waits while no satellite runs and destroys the volume, LINSTOR's included, as soon as the next `hold` starts one. If such objects are left, clear their finalizers while the backend is `linstor`, with no blockstor satellite running, and only then delete them; this path has not been tested. A retry after step 3 or 4 also finds the old `Resource`s' LUKS passwords wrapped under the keyring already in the cluster, so convert into that keyring with `-keyring-in` (the `keyring.json` key of the `blockstor-master-key` Secret in `cozy-linstor`) and `-blockstor-passphrase-file` (the LINSTOR passphrase, which opens it), as the runbook describes, rather than writing a new one with `-keyring-out`.
1. Do the runbook's pre-flight checks and write down the replica count of `deploy/linstor-csi-controller`. Freeze: scale `deploy/linstor-csi-controller` and then `deploy/linstor-controller` to 0. Take the dump and convert it now, with nothing left to write to the LINSTOR database, and apply the converted keyring Secret into `cozy-linstor`. Back: scale `linstor-controller` to 1, unlock it as above, and scale `linstor-csi-controller` back; the keyring Secret is not read under `linstor` and can be deleted.
2. Set `storage: {backend: blockstor, acknowledgeBackendChange: blockstor, blockstorMigration: hold}` and wait for the `linstor` HelmRelease to become Ready. blockstor-apiserver and the satellites run, the controller is 0/0, and `ControllerConfig/default` names the passphrase Secret. Nothing of piraeus's own objects changes, and linstor-scheduler still points at linstor-controller. Back: back to LINSTOR.
3. Confirm that the `keyID` in the keyring Secret's `keyring.json` matches `luksKey.keyID` in the manifests; `blockstor encryption list-passphrases` cannot tell here, it prints `encryption: unset` while the controller is at zero. Then apply the converted manifests server-side, `kubectl apply --server-side --field-manager=linstor-migrate -f <manifests>`. `ControllerConfig/default` among them carries LINSTOR's cluster-wide DRBD options, and a client-side apply leaves them owned by `kubectl-client-side-apply`, which any later `kubectl apply --server-side` of that object, by whoever runs it, takes over and removes along with every field it does not name; the satellites then adjust every resource to the defaults on live connections. The release's own hook only merge-patches `passphraseSecretRef` and cannot do that, but a hand-run apply still could. Back: back to LINSTOR. With the controller never started, the applied objects have acted on nothing.
4. Set `blockstorMigration: adopt`. The controller starts; wait for adoption to converge as the runbook describes. Back: back to LINSTOR, which is the runbook's rollback (scale blockstor to 0, `linstor-controller` back to 1, CSI still on LINSTOR); the runbook calls it a control-plane-only revert for most replicas, and its rollback section lists the cases where it is not.
5. Remove `blockstorMigration`. `LinstorCluster` goes to external mode; the operator deletes linstor-controller, repoints linstor-csi at blockstor-apiserver and rolls its satellite pods. linstor-scheduler and linstor-gui are repointed at blockstor-apiserver in the same change, and may fail their render and retry until the `linstor` release has written the external controller. Back: none is documented or tested from here on. The linstor-controller Deployment is gone and CSI already talks to blockstor, so treat this step as the point of no return and do it only once step 4 has converged.
5. Remove `blockstorMigration`. `LinstorCluster` goes to external mode; the operator deletes linstor-controller, repoints linstor-csi at blockstor-apiserver and rolls its satellite pods. linstor-scheduler and linstor-gui are repointed at blockstor-apiserver in the same change, and each shows one `UpgradeFailed` (`the LinstorCluster has no spec.externalController.url yet`) before the `linstor` release has written the external controller. That is expected: they retry on their own and are Ready about 30 seconds later. Back: none is documented or tested from here on. The linstor-controller Deployment is gone and CSI already talks to blockstor, so treat this step as the point of no return and do it only once step 4 has converged.
6. Scale `linstor-csi-controller` back by hand to the count from step 1: the operator repoints it in step 5 but keeps the 0 it found, and nothing in the release sets it. Then run the runbook's verification. Back: none. From here new volumes exist in blockstor only, and LINSTOR knows nothing of them.
## Upgrading the blockstor satellites