<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list; pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Add the label `kind/backport` if it's a bugfix that needs to be backported to a previous version. --> ## What this PR does Adds Blockstor as a second control plane the `linstor` package can deploy, chosen at install time with `storage.backend` on the platform. LINSTOR stays the default, and a cluster that does not select blockstor renders exactly what it renders on `main`. Blockstor serves the LINSTOR REST API, so linstor-csi, piraeus-operator and the StorageClasses are the same for both. This PR is for new clusters only. Moving a cluster that already holds LINSTOR volumes to blockstor (the `storage.blockstorMigration` steps, the hook Jobs that relax piraeus's webhooks while the operator is stopped, and the README order) is split out into #5466, stacked on this one. Blockstor is experimental. The package pins blockstor 0.4.0, all three images by digest, and the chart refuses to render if the controller, apiserver and satellite tags name different releases. 0.4.0 advertises REST API 1.29, which the linstor-csi v1.13 on `main` requires. A LUKS volume formatted by blockstor 0.2.x is neither opened nor re-formatted by 0.3.0 and later, since 0.3.0 wraps a per-volume password under a master key. This only matters for clusters that ran an earlier revision of this branch; nothing on `main` ever shipped blockstor. Default path: - `helm template packages/system/linstor` is byte-identical to `main` (defaults, `talos.enabled=false`, `drbd.enabled=false`, explicit `backend=linstor`). - The platform renders the `cozystack.linstor` Package without components, as on `main`, so an upgrade rolls no new revision of the release. Selecting the backend: `storage.backend` falls back to `linstor` only when the key is absent. Any other present value fails the render, `""`, `false` and `0` included. `null` is the one case the chart can't see, Helm drops a null key before rendering. The `linstor` chart checks the value on its own too. Changing the backend of a running cluster fails the render, the same way the networking variant guard works: the platform looks up the live `cozystack.linstor` Package, and `storage.acknowledgeBackendChange: <target>` confirms the switch on a cluster that has no volumes yet. Under blockstor the package renders blockstor's controller, apiserver and satellite, plus its CRDs with `helm.sh/resource-policy: keep`, since those objects are the whole blockstor database. piraeus-operator runs in external mode against the apiserver's mTLS port and uses a client cert from the same CA for its own version probe (#4016). linstor-scheduler and linstor-gui are told only the backend by the platform and read the endpoint and client Secret from that same `LinstorCluster` (`spec.externalController.url`, `spec.apiTLS.clientSecretName`), the object that points linstor-csi there, so the names of blockstor's Service and Secret live only in the linstor package and nothing renders objects under piraeus's names. Under linstor they get no values and keep their defaults; the scheduler chart takes this through one more vendored patch. Under blockstor a `LinstorCluster` that names no external controller yet fails their render instead of falling back to linstor-controller: on a backend switch they can upgrade before the linstor release has rewritten that object, and the fallback left them on a Service the operator then deletes, with nothing to render them again. The platform's HelmReleases retry a failed render every retry interval without counting it as a failure, so they follow once the linstor release is through. Every blockstor component finds the Secret that opens its master key through `ControllerConfig/default`. A post-install/post-upgrade hook Job server-side applies `spec.passphraseSecretRef` there, pointing at piraeus's `linstor-passphrase` (key `MASTER_PASSPHRASE`, the name is the `blockstorPassphraseSecret` value), and leaves the rest of the object to blockstor. It is a Job and not a release object because the CRD comes with the same release. The controller opens nothing and creates no keyring until the reference is there, so starting before the Job is harmless. Because the passphrase Secret is always named, `linstor encryption create-passphrase` is refused under this chart: the operator creates `linstor-passphrase` by hand before the first encrypted volume. piraeus still runs a `linstor-satellite` pod on every node it picks for `linstor-csi-node`, and `LinstorCluster` has no setting that stops one without the other. So cozystack's satellite configuration, its internal CA and the satellite scrape stay under both backends: the pod is pinned to our image, with TLS, limits and host networking, and the address the operator registers a node with is the node's own. The plunger and the opt-in Talos graceful-shutdown hook stay LINSTOR-only (the hook is refused under blockstor), because they act on DRBD resources that under blockstor belong to blockstor-satellite. blockstor-satellite runs the plunger's DRBD workarounds itself, and the chart lets it act on a stalled resync (LINBIT/drbd#149) instead of only reporting it: `blockstorSatellite.stalledResyncAct`, on by default. There is one `LinstorCluster` document for both backends, only the keys that differ are gated, so the CSI part (strict topology and main's group-snapshot gate included) can't drift. RBAC and exposure: - `cozy-linstor` is shared with piraeus, so no blockstor component can read an arbitrary Secret there. Each has a namespaced Role naming only `blockstor-master-key`, `blockstor-unlock` and the passphrase Secret: the satellite gets `get`, the controller and the apiserver get `get` and `update`, plus `create`, which RBAC cannot limit by name. The named rules also allow `list` and `watch`, which newer blockstor releases use with a `metadata.name` field selector; - because that `create` is unnamed, a ValidatingAdmissionPolicy admits a Secret create by a blockstor ServiceAccount in the release namespace only for the keyring and the generated `blockstor-unlock` Secret, with the types blockstor gives them; - no component has cluster-wide Secret access; - the apiserver's plain HTTP listener is bound to `127.0.0.1`, port-forward still works; - the controller has no leader election, so its Deployment uses `Recreate`, and neither it nor the satellite gets leases; - the satellite deletes nothing but the PhysicalDevices it discovers, and the roles name every blockstor kind they grant; - the satellite's host ports (3372, 9101, 8080) are closed to the world, same as drbd-reactor's; - the controller and the apiserver get 21s to stop, so a SIGTERM does not cut a detached rollback short. The snapshot stream between satellites runs on port 3372 over mutual TLS, with a CA of its own from `ca-bootstrapper`, kept apart from the API CA. The `blockstor-satellite` DaemonSet rolls one node at a time and holds each node for `blockstorSatellite.minReadySeconds` (180 by default) after Ready, because the satellite is Ready seconds after start while its first pass over the node's DRBD resources ended 1.5 to 2.7 minutes later on a test cluster with about 110 resources per node. `maxUnavailable` is fixed at 1 and `maxSurge` at 0, and `OnDelete` is there for an upgrade checked node by node; the README describes that procedure. The trade-off to review: the HelmRelease waits for the whole rollout, about 3.5 minutes per node at the default, so on more than two or three nodes the first upgrade attempt times out and the retry finishes it, and `HelmReleaseNotReady` fires meanwhile. None of the three components sets a CPU limit, as the LINSTOR controller and satellite don't: under a 500m limit every reconcile pass got throttled and each volume create took tens of seconds. Memory stays limited. The e2e scripts prepare and check whatever `COZY_STORAGE_BACKEND` says, and refuse an unset or unknown value. Under blockstor the prep waits until every satellite reports its pool before applying StorageClasses. `make update-blockstor-crds` refreshes `definitions/` from the blockstor tag the images are pinned to. For 0.4.0 it reproduces the release's CRDs byte for byte. Every `DrbdOptions/*` key the chart sets on the controller and the e2e StorageClasses set passes the whitelist 0.4.0 enforces. ### Testing - `make test` in `packages/system/linstor`: helm-unittest 133/133 in 20 suites, Python 20/20. - `helm unittest` in `packages/core/platform`: 394/394; `packages/system/linstor-scheduler`: 31/31; `packages/system/linstor-gui`: 28/28. - `bats`: `hack/linstor-storage-mode_test.bats` 33/33, `hack/post-install-prep.bats` 25/25, `hack/platform-packages_test.bats` 16/16. - Every guard was checked by reverting it and watching its test fail: empty backend, shared strict topology, loopback bind, `Recreate`, the satellite role, the pool report wait, the pool guard retrying a read that exits 2, the graceful-shutdown refusal, the stream port and its TLS, no cluster-wide Secret access, the named Secret grants, the admission policy, the stop grace, the one-release image check, the rollout strategy and pause. - `hack/check-commit-trailers.sh origin/main..HEAD`: OK. ### Not tested - A live run on 0.4.0 passed on a three-node stand installed with `storage.backend: blockstor` and upgraded to this PR's pin, see https://github.com/cozystack/cozystack/pull/2942#issuecomment-7225299079: Filesystem and Block PVCs, LUKS, snapshot and restore, group snapshots across nodes, online resize, `vmdisk-clone`, and the `vminstance` chainsaw suite including the VM backup roundtrips. That run predates the scheduler and GUI render guard above, which is unit-tested only. No CI lane can run blockstor: every e2e lane runs Talos in containers without DRBD. - The passphrase hook Job and the admission policy are rendered and unit-tested here; this PR has no run of them on a fresh install. - The satellite rollout strategy has not rolled on a live cluster; the timing figures come from a manual node-by-node `OnDelete` upgrade. ### Screenshots N/A, no UI change. ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. --> - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/pull/667 documents the backend, `storage.acknowledgeBackendChange` and this chart. It still describes blockstor 0.2.0 and has to follow this PR to 0.4.0 and to the master key opened from `linstor-passphrase`. Its LINSTOR to Blockstor migration guide belongs with #5466. It stays unticked and merges after this PR. - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: I walked the trigger map against the diff. Only the website is affected: the new `storage.backend` key in `packages/core/platform/values.yaml` and the backend docs, both in website#667. No app package, installer values, variant, bundle, `hack/package.mk` or `hack/update-crd.sh` is touched. ### Release note ```release-note feat(linstor): Blockstor can be selected as the storage control plane for new clusters with `storage.backend: blockstor` on the platform. LINSTOR stays the default and existing clusters are unchanged. Blockstor is experimental, and moving a cluster that already has LINSTOR volumes to it is not part of this change. ```
Cozystack
Cozystack is a free and open-source platform and framework for building clouds.
Cozystack is a CNCF Sandbox project that was originally built and sponsored by Ænix.
With Cozystack, you can transform a bunch of servers into an intelligent system with a simple REST API for spawning Kubernetes clusters, Database-as-a-Service, virtual machines, load balancers, HTTP caching services, and other services with ease.
Use Cozystack to build your own cloud or provide a cost-effective development environment.
Use-Cases
-
Using Cozystack to build a public cloud
You can use Cozystack as a backend for a public cloud -
Using Cozystack to build a private cloud
You can use Cozystack as a platform to build a private cloud powered by Infrastructure-as-Code approach -
Using Cozystack to build your own platform
You can install only the Cozystack components you need on an existing Kubernetes cluster
Documentation
The documentation is located on the cozystack.io website.
Read the Getting Started section for a quick start.
If you encounter any difficulties, start with the troubleshooting guide and work your way through the process that we've outlined.
Versioning
Versioning adheres to the Semantic Versioning principles.
A full list of the available releases is available in the GitHub repository's Release section.
Contributions
Contributions are highly appreciated and very welcomed!
In case of bugs, please check if the issue has already been opened by checking the GitHub Issues section. If it isn't, you can open a new one. A detailed report will help us replicate it, assess it, and work on a fix.
You are welcome to take on the fix yourself. Commits are used to generate the changelog, and their author will be referenced in it.
If you have a concrete feature request, open an issue. For a cross-cutting or architectural change, open a design proposal in the community repo. For questions or early ideas, use GitHub Discussions. See CONTRIBUTING.md for the full routing.
Community
You are welcome to join us in #cozystack, on either CNCF Slack (get an invite) or Kubernetes Slack (get an invite), in our Telegram group, and at our community meetings. Add them to your Google Calendar or iCal for convenience.
Project documents
| Document | What it covers |
|---|---|
| Governance | How decisions are made and who makes them |
| Contributor Ladder | How to grow from contributor to maintainer |
| Maintainers | Who maintains the project |
| Code of Conduct | What we expect of each other |
| Security Policy | Reporting a vulnerability, and which releases get fixes |
| Adopters | Who runs Cozystack in production |
| Roadmap | Where the project is going |
License
Cozystack is licensed under Apache 2.0.
The code is provided as-is with no warranties.
Commercial Support
A list of companies providing commercial support for this project can be found on official site.
