diff --git a/packages/system/linstor/README.md b/packages/system/linstor/README.md index cd16fb45b..6385b82d6 100644 --- a/packages/system/linstor/README.md +++ b/packages/system/linstor/README.md @@ -30,6 +30,8 @@ Run `make test` in this directory with Helm, helm-unittest and Python 3.11 or la ## Moving a LINSTOR cluster to blockstor +**Experimental.** blockstor is experimental, and this procedure has been run on test clusters only. Run it in a maintenance window, after the runbook's pre-flight checks. + blockstor adopts the volumes of a LINSTOR cluster in place with `linstor-migrate`, following [blockstor's migration runbook](https://github.com/cozystack/blockstor/blob/main/docs/linstor-migration.md). The runbook freezes CSI and stops LINSTOR first, deploys blockstor, applies the converted manifests, waits for adoption, and repoints CSI last. Setting `storage.backend: blockstor` alone does all of that in one step: piraeus-operator goes to external mode, deletes linstor-controller and repoints linstor-csi before a single volume is adopted, and the blockstor controller starts before its manifests are in. `storage.blockstorMigration` on the `cozystack.cozystack-platform` Package, passed to this chart as `blockstorMigration`, splits the switch into the runbook's steps. With `hold` or `adopt` every piraeus object renders exactly as under backend `linstor`. `hold` keeps the blockstor controller at zero replicas, and the release owns that count, so a retried upgrade does not start it. linstor-scheduler and linstor-gui stay on LINSTOR through both steps and move to blockstor-apiserver with linstor-csi, when the value is removed: until then blockstor serves no Resources, or Resources it has not adopted, and the scheduler extender cannot place a pod on those. @@ -38,14 +40,14 @@ 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. -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`. -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. -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 `. `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. -4. Set `blockstorMigration: adopt`. The controller starts; wait for adoption to converge as the runbook describes. -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. -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. +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`. -Up to step 5 the way back touches the control plane only: set `storage: {backend: linstor, acknowledgeBackendChange: linstor}` without `blockstorMigration` in the same change, wait for the release, 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`. +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. +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 `. `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. +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