refactor(linstor): follow blockstor's API group to blockstor.org

blockstor moves its API group from blockstor.cozystack.io to
blockstor.org before anything is deployed on it. The chart's CRD
copies, the RBAC rules of the apiserver, controller and satellite, the
chart tests and the e2e helpers that read the storage pools now use
the new group.

This needs the blockstor release that carries the rename, which the
backend is pinned to before this PR merges.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil committed 2026-11-29 13:45:11 +01:00
1 parent cf7bd11eeb
commit d617d52bfd
18 files changed
+55 -55

No files matched your search

+3 -3
View File
@@ -518,7 +518,7 @@ _cozy_pool_free_rows() {
if [ "$_backend" = blockstor ]; then
# Read first and filter second: piped, the read's status is jq's, and jq
# on empty input succeeds.
_pools_json=$(kubectl get storagepools.blockstor.cozystack.io --request-timeout=20s -o json) || return 1
_pools_json=$(kubectl get storagepools.blockstor.org --request-timeout=20s -o json) || return 1
printf '%s\n' "$_pools_json" |
jq -r '.items[] | select((.spec.providerKind | test("^ZFS")) and .status.freeCapacity != null) | "\(.status.freeCapacity):\(.spec.nodeName)"'
return
@@ -533,7 +533,7 @@ _cozy_pool_free_rows() {
_cozy_pool_diagnostics() {
if [ "$(_cozy_storage_backend 2>/dev/null)" = blockstor ]; then
kubectl get storagepools.blockstor.cozystack.io -o wide --request-timeout=20s 2>&1
kubectl get storagepools.blockstor.org -o wide --request-timeout=20s 2>&1
return
fi
kubectl -n cozy-linstor exec deploy/linstor-controller -- linstor --no-color sp l 2>&1
@@ -633,7 +633,7 @@ _cozy_linstor_pool_baseline_file() {
_cozy_linstor_pool_datasets() {
_backend=$(_cozy_storage_backend) || return 1
if [ "$_backend" = blockstor ]; then
_pools_json=$(timeout -k 5 30 kubectl get storagepools.blockstor.cozystack.io --request-timeout=20s -o json 2>/dev/null) || return 1
_pools_json=$(timeout -k 5 30 kubectl get storagepools.blockstor.org --request-timeout=20s -o json 2>/dev/null) || return 1
_pools=$(printf '%s\n' "$_pools_json" |
jq -r '.items[] | select(.spec.providerKind | test("^ZFS")) | "\(.spec.nodeName) \(.spec.props["StorDriver/StorPoolName"] // .spec.props["StorDriver/ZPoolThin"] // .spec.props["StorDriver/ZPool"] // "")"') || return 1
_satellite_selector=app=blockstor-satellite
+4 -4
View File
@@ -164,7 +164,7 @@ count_lines() {
render_blockstor_node() {
cat <<EOF
apiVersion: blockstor.cozystack.io/v1alpha1
apiVersion: blockstor.org/v1alpha1
kind: Node
metadata:
name: $1
@@ -178,7 +178,7 @@ EOF
# The CRD's CEL rule pins metadata.name to <poolName>.<nodeName>.
render_blockstor_storage_pool() {
cat <<EOF
apiVersion: blockstor.cozystack.io/v1alpha1
apiVersion: blockstor.org/v1alpha1
kind: StoragePool
metadata:
name: data.$1
@@ -547,14 +547,14 @@ echo "[post-install-prep] waiting for every satellite to report its 'data' pool"
pool_deadline=$(( $(date +%s) + 300 ))
while :; do
pools_rc=0
reported=$(timeout -k 5 30 kubectl get storagepools.blockstor.cozystack.io --request-timeout=20s \
reported=$(timeout -k 5 30 kubectl get storagepools.blockstor.org --request-timeout=20s \
-o jsonpath='{range .items[?(@.spec.poolName=="data")]}{.spec.nodeName} {.status.freeCapacity}{"\n"}{end}') || pools_rc=$?
if [ "$pools_rc" -eq 0 ] && [ "$(printf '%s\n' "$reported" | awk 'NF == 2' | grep -c .)" -eq "$node_count" ]; then
break
fi
if [ "$(date +%s)" -ge "$pool_deadline" ]; then
echo "[post-install-prep] timed out after 300s waiting for $node_count reported 'data' pools (read exited $pools_rc): $reported" >&2
timeout -k 5 30 kubectl get storagepools.blockstor.cozystack.io -o yaml --request-timeout=20s 2>&1 | tail -n 80 >&2
timeout -k 5 30 kubectl get storagepools.blockstor.org -o yaml --request-timeout=20s 2>&1 | tail -n 80 >&2
exit 1
fi
sleep 5
+4 -4
View File
@@ -727,7 +727,7 @@ blockstor_storage_pools_json() {
kubectl() {
printf '%s\n' "$*" >>"$calls"
case "$*" in
'get storagepools.blockstor.cozystack.io '*-o\ json*) blockstor_storage_pools_json ;;
'get storagepools.blockstor.org '*-o\ json*) blockstor_storage_pools_json ;;
*) return 1 ;;
esac
}
@@ -755,7 +755,7 @@ blockstor_storage_pools_json() {
COZY_STORAGE_BACKEND=blockstor
kubectl() {
case "$*" in
'get storagepools.blockstor.cozystack.io '*-o\ json*) blockstor_storage_pools_json 87127923 ;;
'get storagepools.blockstor.org '*-o\ json*) blockstor_storage_pools_json 87127923 ;;
*) printf 'STUB-POOL-TABLE\n' ;;
esac
}
@@ -782,7 +782,7 @@ blockstor_storage_pools_json() {
COZY_STORAGE_BACKEND=blockstor
kubectl() {
case "$*" in
'get storagepools.blockstor.cozystack.io '*-o\ json*)
'get storagepools.blockstor.org '*-o\ json*)
echo 'Error from server (Forbidden): storagepools is forbidden' >&2
return 1 ;;
esac
@@ -814,7 +814,7 @@ blockstor_storage_pools_json() {
kubectl() {
printf '%s\n' "$*" >>"$calls"
case "$*" in
'get storagepools.blockstor.cozystack.io '*) blockstor_storage_pools_json ;;
'get storagepools.blockstor.org '*) blockstor_storage_pools_json ;;
*'-l app=blockstor-satellite'*)
printf 'srv1 blockstor-satellite-a\nsrv2 blockstor-satellite-b\nsrv3 blockstor-satellite-c\n' ;;
*'--container=satellite -- zfs list'*) printf 'data\n' ;;
+2 -2
View File
@@ -147,7 +147,7 @@ case "$*" in
exit 1
fi
for n in ${STUB_NODES:-srv1 srv2 srv3}; do echo "$n"; done ;;
'get storagepools.blockstor.cozystack.io '*freeCapacity*)
'get storagepools.blockstor.org '*freeCapacity*)
# STUB_POOLS_UNREPORTED names nodes whose satellite has not reported its
# pool yet: the object exists, its free capacity does not.
for n in ${STUB_NODES:-srv1 srv2 srv3}; do
@@ -688,7 +688,7 @@ run_prep_blockstor() {
[ "$(cat "$tmp/rc")" -eq 0 ]
grep -q "waiting for every satellite to report its 'data' pool" "$tmp/out"
grep -q '^get storagepools.blockstor.cozystack.io .*freeCapacity' "$tmp/calls"
grep -q '^get storagepools.blockstor.org .*freeCapacity' "$tmp/calls"
rm -rf "$tmp"
}
+3 -3
View File
@@ -20,9 +20,9 @@ update-blockstor-crds:
{ curl --fail --silent --show-error --location -o "$$tmpdir/source.tar.gz" \
"https://github.com/cozystack/blockstor/archive/refs/tags/v$(BLOCKSTOR_VERSION).tar.gz" && \
mkdir "$$tmpdir/src" && tar -xzf "$$tmpdir/source.tar.gz" --strip-components=1 -C "$$tmpdir/src" && \
ls "$$tmpdir"/src/config/crd/bases/blockstor.cozystack.io_*.yaml >/dev/null || { rm -rf "$$tmpdir"; exit 1; }; } && \
rm -f definitions/blockstor.cozystack.io_*.yaml && \
cp "$$tmpdir"/src/config/crd/bases/blockstor.cozystack.io_*.yaml definitions/ && \
ls "$$tmpdir"/src/config/crd/bases/blockstor.org_*.yaml >/dev/null || { rm -rf "$$tmpdir"; exit 1; }; } && \
rm -f definitions/blockstor.org_*.yaml && \
cp "$$tmpdir"/src/config/crd/bases/blockstor.org_*.yaml definitions/ && \
rm -rf "$$tmpdir"
test:
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: controllerconfigs.blockstor.cozystack.io
name: controllerconfigs.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: ControllerConfig
listKind: ControllerConfigList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: nodes.blockstor.cozystack.io
name: nodes.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: Node
listKind: NodeList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: physicaldevices.blockstor.cozystack.io
name: physicaldevices.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: PhysicalDevice
listKind: PhysicalDeviceList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: resourcedefinitions.blockstor.cozystack.io
name: resourcedefinitions.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: ResourceDefinition
listKind: ResourceDefinitionList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: resourcegroups.blockstor.cozystack.io
name: resourcegroups.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: ResourceGroup
listKind: ResourceGroupList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: resources.blockstor.cozystack.io
name: resources.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: Resource
listKind: ResourceList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: snapshots.blockstor.cozystack.io
name: snapshots.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: Snapshot
listKind: SnapshotList
@@ -4,9 +4,9 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.1
name: storagepools.blockstor.cozystack.io
name: storagepools.blockstor.org
spec:
group: blockstor.cozystack.io
group: blockstor.org
names:
kind: StoragePool
listKind: StoragePoolList
@@ -11,7 +11,7 @@ metadata:
namespace: {{ .Release.Namespace }}
---
{{- /*
CRUD on the blockstor.cozystack.io CRDs, named rather than wildcarded so a kind
CRUD on the blockstor.org CRDs, named rather than wildcarded so a kind
added to the group later is not granted by omission. No finalizers,
events or leases: the REST handlers do not write those. */}}
apiVersion: rbac.authorization.k8s.io/v1
@@ -19,7 +19,7 @@ kind: ClusterRole
metadata:
name: blockstor-apiserver
rules:
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources:
- controllerconfigs
- controllerconfigs/status
@@ -1,7 +1,7 @@
{{- if eq .Values.backend "blockstor" }}
---
{{- /*
blockstor controller — runs the reconcilers for the blockstor.cozystack.io
blockstor controller — runs the reconcilers for the blockstor.org
CRDs (ResourceDefinitions / Resources / Snapshots / StoragePools /
Nodes). The REST API is split out into the separate apiserver
Deployment; the controller runs with --enable-rest-api=false. */}}
@@ -12,7 +12,7 @@ metadata:
namespace: {{ .Release.Namespace }}
---
{{- /*
Cluster-wide read on Kubernetes Nodes and the blockstor.cozystack.io kinds
Cluster-wide read on Kubernetes Nodes and the blockstor.org kinds
the reconcilers manage, as blockstor's own config/rbac/role.yaml grants
them, kind by kind so a kind added to the group later is not granted by
omission. No leases: the controller runs without leader election. */}}
@@ -30,13 +30,13 @@ rules:
- apiGroups: [""]
resources: [nodes]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [controllerconfigs]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes, resourcedefinitions, resourcegroups, resources, snapshots, storagepools]
verbs: [get, list, watch, create, update, patch, delete]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources:
- nodes/finalizers
- resourcedefinitions/finalizers
@@ -45,7 +45,7 @@ rules:
- snapshots/finalizers
- storagepools/finalizers
verbs: [update]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources:
- nodes/status
- resourcedefinitions/status
@@ -64,7 +64,7 @@ rules:
- apiGroups: [""]
resources: [nodes]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources:
- controllerconfigs
- nodes
@@ -75,13 +75,13 @@ rules:
- snapshots
- storagepools
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [physicaldevices]
verbs: [create, update, patch, delete]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes, resources, snapshots, storagepools]
verbs: [update, patch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources:
- nodes/status
- physicaldevices/status
@@ -66,6 +66,6 @@ tests:
- notContains:
path: rules
content:
apiGroups: [blockstor.cozystack.io]
apiGroups: [blockstor.org]
resources: ["*"]
verbs: [get, list, watch, create, update, patch, delete]
@@ -45,13 +45,13 @@ tests:
- contains:
path: rules
content:
apiGroups: [blockstor.cozystack.io]
apiGroups: [blockstor.org]
resources: [physicaldevices]
verbs: [create, update, patch, delete]
- contains:
path: rules
content:
apiGroups: [blockstor.cozystack.io]
apiGroups: [blockstor.org]
resources: [nodes, resources, snapshots, storagepools]
verbs: [update, patch]
- lengthEqual:
@@ -155,17 +155,17 @@ tests:
- apiGroups: ['']
resources: [nodes]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [controllerconfigs]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes, resourcedefinitions, resourcegroups, resources, snapshots, storagepools]
verbs: [get, list, watch, create, update, patch, delete]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes/finalizers, resourcedefinitions/finalizers, resourcegroups/finalizers,
resources/finalizers, snapshots/finalizers, storagepools/finalizers]
verbs: [update]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes/status, resourcedefinitions/status, resourcegroups/status, resources/status,
snapshots/status, storagepools/status]
verbs: [get, update, patch]
@@ -185,17 +185,17 @@ tests:
- apiGroups: ['']
resources: [nodes]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [controllerconfigs, nodes, physicaldevices, resourcedefinitions, resourcegroups,
resources, snapshots, storagepools]
verbs: [get, list, watch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [physicaldevices]
verbs: [create, update, patch, delete]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes, resources, snapshots, storagepools]
verbs: [update, patch]
- apiGroups: [blockstor.cozystack.io]
- apiGroups: [blockstor.org]
resources: [nodes/status, physicaldevices/status, resources/status, snapshots/status,
storagepools/status, nodes/finalizers, physicaldevices/finalizers, resources/finalizers,
snapshots/finalizers, storagepools/finalizers]