From 87e6f99c722ec27e214abf66faefca7935505ccf Mon Sep 17 00:00:00 2001 From: Andrei Kvapil Date: Thu, 12 Nov 2026 10:23:28 -0500 Subject: [PATCH] feat(linstor): run blockstor v0.3.0 Bump the three blockstor images to 0.3.0 and take its CRDs from the release. v0.3.0 activates an LVM thin pool a reboot left inactive; before it, a rebooted node reported no capacity on such a pool and volume creation failed across the cluster. It gives every LUKS volume its own password, wrapped under a master key that several passphrases can open, so changing a passphrase no longer touches a volume and losing one is no longer losing the data. It also keeps each replica's own DRBD port when converting a LINSTOR cluster. Assisted-by: LLM Signed-off-by: Andrei Kvapil --- .../blockstor.org_controllerconfigs.yaml | 18 ++-- .../definitions/blockstor.org_nodes.yaml | 15 +++- .../blockstor.org_resourcedefinitions.yaml | 84 ++++++++++++++++++- .../blockstor.org_resourcegroups.yaml | 15 +++- .../definitions/blockstor.org_resources.yaml | 65 +++++++++++++- .../definitions/blockstor.org_snapshots.yaml | 68 ++++++++++++++- .../blockstor.org_storagepools.yaml | 23 ++++- packages/system/linstor/values.yaml | 6 +- 8 files changed, 276 insertions(+), 18 deletions(-) diff --git a/packages/system/linstor/definitions/blockstor.org_controllerconfigs.yaml b/packages/system/linstor/definitions/blockstor.org_controllerconfigs.yaml index f296c08a6..c5dae2102 100644 --- a/packages/system/linstor/definitions/blockstor.org_controllerconfigs.yaml +++ b/packages/system/linstor/definitions/blockstor.org_controllerconfigs.yaml @@ -248,13 +248,19 @@ spec: type: object passphraseSecretRef: description: |- - passphraseSecretRef points at the Secret carrying the - cluster-wide LUKS passphrase under the key `passphrase`. The - satellite reads it via the apiserver during reconcile; - passphrase never lands on Spec in plaintext. Replaces - `Props["DrbdOptions/Encryption/passphrase"]` on the legacy - ControllerProps instance. + passphraseSecretRef points at the Secret, in blockstor's own + namespace, whose value unlocks the cluster master key: the shape + piraeus gives LINSTOR (`MASTER_PASSPHRASE`). blockstor only reads + it; every component reads it through the API server, so a changed + Secret takes effect without a restart. Unset, blockstor unlocks + from a passphrase Secret it generates and owns. properties: + key: + default: MASTER_PASSPHRASE + description: |- + key is the data key holding the passphrase. Its bytes are the + passphrase verbatim, a trailing newline included. + type: string name: description: name is the Secret name. Required. type: string diff --git a/packages/system/linstor/definitions/blockstor.org_nodes.yaml b/packages/system/linstor/definitions/blockstor.org_nodes.yaml index 9f8730129..839c05931 100644 --- a/packages/system/linstor/definitions/blockstor.org_nodes.yaml +++ b/packages/system/linstor/definitions/blockstor.org_nodes.yaml @@ -14,7 +14,20 @@ spec: singular: node scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.type + name: Type + type: string + - jsonPath: .spec.netInterfaces[0].address + name: Address + type: string + - jsonPath: .status.connectionStatus + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 schema: openAPIV3Schema: description: Node is the Schema for the nodes API diff --git a/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml b/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml index 641df9589..b301767f7 100644 --- a/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml +++ b/packages/system/linstor/definitions/blockstor.org_resourcedefinitions.yaml @@ -14,7 +14,20 @@ spec: singular: resourcedefinition scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.resourceGroupName + name: Group + type: string + - jsonPath: .spec.drbdPort + name: Port + type: integer + - jsonPath: .spec.layerStack + name: Layers + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 schema: openAPIV3Schema: description: ResourceDefinition is the Schema for the resourcedefinitions @@ -330,8 +343,10 @@ spec: Order is top-down: the first layer's device is what the consumer Pod mounts, the last is the raw block device the storage provider creates. - Empty = inherits from the parent ResourceGroup; both empty = - `["DRBD","STORAGE"]`. + Empty means not decided yet: the controller fixes it once, from + the parent ResourceGroup's stack for a definition that holds no + data, and the satellite builds nothing until it is set. Once set it + is never emptied. See docs/layer-stack.md. items: type: string type: array @@ -346,7 +361,22 @@ spec: spawned from (or empty if directly created). type: string volumeDefinitions: - description: volumeDefinitions are the volume slots inside this RD. + description: |- + volumeDefinitions are the volume slots inside this RD. + + Keyed on volumeNumber rather than atomic, because that is what makes + the size bound below enforceable. Kubernetes ratcheting correlates + per field, and an atomic list is compared whole: any update touching + it re-validates every element, so one volume written before the bound + existed would reject every later write to this definition — the + controller's own included, since it rewrites this list to stamp + drbdMinor. With the list keyed, an untouched element is not + re-validated and the bound applies to what is actually being written. + + The change was accepted by a running apiserver on the existing CRD, so + it needs no new API version. One shape does become unwritable: an + object carrying two entries with the same volumeNumber, which the + atomic list allowed. Neither writer produces it. items: description: ResourceDefinitionVolume is one volume slot inside an RD. @@ -392,7 +422,45 @@ spec: type: string type: object sizeKib: + description: |- + sizeKib is the volume size. The bounds are enforced HERE, by the API + server, as well as in pkg/validate: the CLI writes these CRDs + directly and REST has its own path, so a check living in one client + is not a check the data is subject to. The writers give an operator a + readable message; the schema is what holds for kubectl apply, a + GitOps controller, and blockstor's own controller rewriting this + list. + + The floor is DRBD's own per-device minimum once metadata is + reserved. Below it the satellite does not fail — it loops on + `drbdadm create-md` forever, which is why zero is the one value that + must never reach it, and why an overflowing size parse that lands on + zero has to be refused before it is stored. + + The ceiling is DRBD 9's documented per-device limit. It was 16 TiB, + which is below what DRBD 9 and upstream LINSTOR handle: linstormigrate + copies sizes verbatim, so a cluster holding a larger volume failed + part-way through its own migration. + + A bound on an existing field validates on UPDATE as well as on + create, which on an atomic list makes an out-of-range element poison + every later write to the whole object — including writes that never + touch the size, and including the controller's own, since it rewrites + this list to stamp drbdMinor. That is reachable on an in-place + upgrade: the REST spawn handler accepted any positive size until the + gate was added, so a cluster upgrading into this can hold a definition + sized 1..4095 KiB. + + The answer is the list-type marker on VolumeDefinitions rather than + dropping the bound. Keyed on volumeNumber, the API server correlates + elements across an update and ratcheting applies per element: a + grandfathered volume stays writable, and the bound holds for what is + actually being written. Verified against a running apiserver — an + update appending a second, in-range volume is accepted while volume 0 + stays at 1024 KiB, and a fresh definition at 1024 KiB is refused. format: int64 + maximum: 1099511627776 + minimum: 4096 type: integer volumeNumber: format: int32 @@ -402,7 +470,15 @@ spec: - volumeNumber type: object type: array + x-kubernetes-list-map-keys: + - volumeNumber + x-kubernetes-list-type: map type: object + x-kubernetes-validations: + - message: 'layerStack is decided once: it may be set or replaced, never + emptied' + rule: '!has(oldSelf.layerStack) || size(oldSelf.layerStack) == 0 || + (has(self.layerStack) && size(self.layerStack) > 0)' status: description: status defines the observed state of ResourceDefinition properties: diff --git a/packages/system/linstor/definitions/blockstor.org_resourcegroups.yaml b/packages/system/linstor/definitions/blockstor.org_resourcegroups.yaml index 141079b35..cfb9ac6f9 100644 --- a/packages/system/linstor/definitions/blockstor.org_resourcegroups.yaml +++ b/packages/system/linstor/definitions/blockstor.org_resourcegroups.yaml @@ -14,7 +14,20 @@ spec: singular: resourcegroup scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.selectFilter.placeCount + name: Place-Count + type: integer + - jsonPath: .spec.selectFilter.storagePool + name: Storage-Pool + type: string + - jsonPath: .spec.selectFilter.layerStack + name: Layers + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 schema: openAPIV3Schema: description: ResourceGroup is the Schema for the resourcegroups API diff --git a/packages/system/linstor/definitions/blockstor.org_resources.yaml b/packages/system/linstor/definitions/blockstor.org_resources.yaml index 96e0e94db..8cb1a6737 100644 --- a/packages/system/linstor/definitions/blockstor.org_resources.yaml +++ b/packages/system/linstor/definitions/blockstor.org_resources.yaml @@ -14,7 +14,32 @@ spec: singular: resource scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.resourceDefinitionName + name: Definition + type: string + - jsonPath: .spec.nodeName + name: Node + type: string + - jsonPath: .spec.storagePool + name: Pool + type: string + - jsonPath: .spec.drbdNodeID + name: Node-ID + type: integer + - jsonPath: .spec.drbdPort + name: Port + type: integer + - jsonPath: .status.drbdState + name: State + type: string + - jsonPath: .status.inUse + name: In-Use + type: boolean + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -386,6 +411,35 @@ spec: hints the satellite consumes during first activation, the Status counterpart carries observed runtime state. properties: + luksKey: + description: |- + luksKey is this replica's LUKS password, wrapped under the cluster + master key. It is the only key in the volume's LUKS header, so it + lives in spec, where backups restore it, and it is set once. + properties: + keyID: + description: |- + keyID is the public ID of the master key the password is wrapped + under. + pattern: ^[0-9a-f]{16}$ + type: string + origin: + description: origin says where the password came from. + enum: + - Generated + - LinstorImport + type: string + wrapped: + description: wrapped is nonce || AES-256-GCM ciphertext + || tag. + minLength: 1 + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + required: + - keyID + - origin + - wrapped + type: object seedFromGI: description: |- seedFromGI pre-seeds the DRBD-9 generation identifier of this @@ -408,6 +462,12 @@ spec: required: - volumeNumber type: object + x-kubernetes-validations: + - message: 'luksKey is set once: it may go from unset to a value + but not be changed or removed, the replica''s data is readable + only with it' + rule: '!has(oldSelf.luksKey) || (has(self.luksKey) && self.luksKey + == oldSelf.luksKey)' type: array x-kubernetes-list-map-keys: - volumeNumber @@ -756,6 +816,9 @@ spec: optionalOldSelf: true rule: oldSelf.hasValue() || self.metadata.name.lowerAscii() == (self.spec.resourceDefinitionName + '.' + self.spec.nodeName).lowerAscii() + selectableFields: + - jsonPath: .spec.nodeName + - jsonPath: .spec.resourceDefinitionName served: true storage: true subresources: diff --git a/packages/system/linstor/definitions/blockstor.org_snapshots.yaml b/packages/system/linstor/definitions/blockstor.org_snapshots.yaml index f041385c7..f7f1f0cbd 100644 --- a/packages/system/linstor/definitions/blockstor.org_snapshots.yaml +++ b/packages/system/linstor/definitions/blockstor.org_snapshots.yaml @@ -14,7 +14,20 @@ spec: singular: snapshot scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.resourceDefinitionName + name: Definition + type: string + - jsonPath: .spec.snapshotName + name: Snapshot + type: string + - jsonPath: .spec.nodes + name: Nodes + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -109,6 +122,53 @@ spec: makes progress instead of hanging on a missing denominator. format: int32 type: integer + luksKeys: + description: |- + luksKeys are the wrapped LUKS passwords of the source replicas, + copied when the snapshot is created: a snapshot's bytes are + encrypted under the password of the replica they were taken from, + and that replica may be gone by the time the snapshot is restored. + items: + description: SnapshotLUKSKey is the wrapped password of one source + replica's volume. + properties: + keyID: + description: |- + keyID is the public ID of the master key the password is wrapped + under. + pattern: ^[0-9a-f]{16}$ + type: string + nodeName: + description: nodeName is the CR name of the node the replica + is on. + type: string + origin: + description: origin says where the password came from. + enum: + - Generated + - LinstorImport + type: string + volumeNumber: + description: volumeNumber is the volume within the replica. + format: int32 + type: integer + wrapped: + description: wrapped is nonce || AES-256-GCM ciphertext || tag. + minLength: 1 + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + required: + - keyID + - nodeName + - origin + - volumeNumber + - wrapped + type: object + type: array + x-kubernetes-list-map-keys: + - nodeName + - volumeNumber + x-kubernetes-list-type: map nodes: description: |- nodes are the satellites the snapshot should live on. Empty means @@ -189,6 +249,10 @@ spec: - resourceDefinitionName - snapshotName type: object + x-kubernetes-validations: + - message: luksKeys is set once, when the snapshot is created + rule: '!has(oldSelf.luksKeys) || (has(self.luksKeys) && self.luksKeys + == oldSelf.luksKeys)' status: description: status defines the observed state of Snapshot properties: @@ -309,6 +373,8 @@ spec: optionalOldSelf: true rule: oldSelf.hasValue() || self.metadata.name.lowerAscii() == (self.spec.resourceDefinitionName + '.' + self.spec.snapshotName).lowerAscii() + selectableFields: + - jsonPath: .spec.resourceDefinitionName served: true storage: true subresources: diff --git a/packages/system/linstor/definitions/blockstor.org_storagepools.yaml b/packages/system/linstor/definitions/blockstor.org_storagepools.yaml index 8afe147c6..195295ab2 100644 --- a/packages/system/linstor/definitions/blockstor.org_storagepools.yaml +++ b/packages/system/linstor/definitions/blockstor.org_storagepools.yaml @@ -14,7 +14,26 @@ spec: singular: storagepool scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .spec.nodeName + name: Node + type: string + - jsonPath: .spec.poolName + name: Pool + type: string + - jsonPath: .spec.providerKind + name: Provider + type: string + - jsonPath: .status.freeCapacity + name: Free-KiB + type: integer + - jsonPath: .status.totalCapacity + name: Total-KiB + type: integer + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 schema: openAPIV3Schema: description: |- @@ -204,6 +223,8 @@ spec: optionalOldSelf: true rule: oldSelf.hasValue() || self.metadata.name.lowerAscii() == (self.spec.poolName + '.' + self.spec.nodeName).lowerAscii() + selectableFields: + - jsonPath: .spec.nodeName served: true storage: true subresources: diff --git a/packages/system/linstor/values.yaml b/packages/system/linstor/values.yaml index a14daaa6c..d004abce5 100644 --- a/packages/system/linstor/values.yaml +++ b/packages/system/linstor/values.yaml @@ -27,15 +27,15 @@ piraeusServer: blockstorController: image: repository: ghcr.io/cozystack/blockstor-controller - tag: 0.1.17@sha256:19b5733565e4bbe9510eecae8d47a181e72e07009b3d565848e8ccf1cd9393e8 + tag: 0.3.0@sha256:ca5fc964265a1fd9e1153077f0565a9f07532c593bea1182d3b97a38430822ea blockstorApiserver: image: repository: ghcr.io/cozystack/blockstor-apiserver - tag: 0.1.17@sha256:102cf8c8d431f3b6714bca53752327ae8bb793b2d5ebed3aae47d51a85805f26 + tag: 0.3.0@sha256:20cf599f8d0ae85a44b237b9d8ad2ca631a1feff3fd387194ef84636b538dd0b blockstorSatellite: image: repository: ghcr.io/cozystack/blockstor-satellite - tag: 0.1.17@sha256:8bd15bca47f33464eaf489884c33fd50ef2574a0ad856ab5ab9b921186a98bea + tag: 0.3.0@sha256:abff381da5425fdf7a6abc0d52006727cf7fe13c438acc79aaea192fc8681cb4 # Talos-specific workarounds (disable for generic Linux like Ubuntu/Debian) talos: enabled: true