Skip to content

Commit d83787d

Browse files
kvapsclaude
andcommitted
fix(stand): register Node CRDs + use LOOPFILE so DRBD has block dev
Two issues blocked multi-replica DRBD scenarios on the dev stand: 1) blockstor Node CRDs were never created. The satellite's c-r ResourceReconciler lists Node CRDs to resolve peer addresses for the .res file's `on <node> { address ... }` blocks — with an empty Node list, peer addresses fell through to 0.0.0.0 and drbdadm could never establish the replication connection. install-blockstor.sh now iterates k8s worker nodes and creates one blockstor Node CRD per worker with NetInterfaces.Address taken from the k8s InternalIP. 2) The "stand" pool used providerKind: FILE_THIN which hands back a raw file path (`/var/lib/blockstor-pool/<rd>_<vol>.img`). drbdmeta rejects that with `not a block device`. Switch to LOOPFILE — same backing files, same dir, but the provider wraps each one with `losetup --find --show` so the .res file gets a /dev/loopN that DRBD can attach. losetup --find uses /dev/loop-control under the hood, so this scales to ~hundreds of loops without hardcoding numbers. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
1 parent 4755934 commit d83787d

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

stand/blockstor-storagepools.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ metadata:
2828
spec:
2929
nodeName: __WORKER_1__
3030
poolName: stand
31-
providerKind: FILE_THIN
31+
providerKind: LOOPFILE
3232
props:
3333
StorDriver/FileDir: /var/lib/blockstor-pool
3434
---
@@ -39,7 +39,7 @@ metadata:
3939
spec:
4040
nodeName: __WORKER_2__
4141
poolName: stand
42-
providerKind: FILE_THIN
42+
providerKind: LOOPFILE
4343
props:
4444
StorDriver/FileDir: /var/lib/blockstor-pool
4545
---
@@ -50,7 +50,7 @@ metadata:
5050
spec:
5151
nodeName: __WORKER_3__
5252
poolName: stand
53-
providerKind: FILE_THIN
53+
providerKind: LOOPFILE
5454
props:
5555
StorDriver/FileDir: /var/lib/blockstor-pool
5656
---

stand/install-blockstor.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,23 @@ if [[ "$ready" != "3" ]]; then
6363
exit 1
6464
fi
6565

66+
# Bootstrap blockstor Node CRDs from k8s worker nodes so the
67+
# satellite reconciler's peer-resolution path has an address per
68+
# node — otherwise multi-replica .res files render a 0.0.0.0
69+
# placeholder for any peer this satellite hasn't directly seen.
70+
# Cluster-scoped CRD; metadata.name == k8s node name.
71+
echo ">> register blockstor Node CRDs from k8s workers"
72+
for node in $(kubectl get nodes -l '!node-role.kubernetes.io/control-plane' -o jsonpath='{.items[*].metadata.name}'); do
73+
ip=$(kubectl get node "$node" -o jsonpath='{.status.addresses[?(@.type=="InternalIP")].address}')
74+
cat <<EOF | kubectl apply -f -
75+
apiVersion: blockstor.io.blockstor.io/v1alpha1
76+
kind: Node
77+
metadata: {name: $node}
78+
spec:
79+
type: SATELLITE
80+
netInterfaces:
81+
- {name: default, address: $ip}
82+
EOF
83+
done
84+
6685
echo ">> blockstor stack ready on $(basename "$WORK_DIR")"

0 commit comments

Comments
 (0)