Skip to content

Commit 7ed6444

Browse files
feat(installer,e2e): cozystackOperator.helmReleaseInterval value + parallel post-install prep
Two complementary changes that depend on the operator's `--helmrelease-interval` flag landing via #2509: 1. Installer chart exposes `cozystackOperator.helmReleaseInterval` (default empty -> flag not rendered -> operator default 5m applies). E2E install passes `30s`. Eliminates the 8-10 min Flux dead zone where dependency-blocked HRs (waiting on cert-manager webhooks, CRDs) are requeued only every 5 min. 2. LINSTOR / StorageClass / MetalLB setup, previously sequential `@test` cases after the 15 m platform HR wait, now run as a background prep that completes during the platform reconcile. None of them gates platform HR reconcile, so they can move out of the critical path. Helper script `hack/e2e-post-install-prep.sh` polls for its prerequisites and is awaited at the end of the `Install Cozystack` test so failures still surface deterministically. Includes the T2-race fix: wait on the LINSTOR HR being `Ready` before polling for `deploy/linstor-controller`. The old 5-min hard timeout fired during cold installs where the LINSTOR HR's dependency chain takes longer than 5 min to resolve. Production defaults are unchanged. The 30 s interval is opt-in per install command. Depends on: - #2509 (operator-side `--helmrelease-interval` flag). Signed-off-by: Myasnikov Daniil <[email protected]> Assisted-By: Claude <[email protected]>
1 parent 7520967 commit 7ed6444

2 files changed

Lines changed: 108 additions & 73 deletions

File tree

‎hack/e2e-install-cozystack.bats‎

Lines changed: 15 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,26 @@ spec:
8383
- cozystack.external-dns-application
8484
EOF
8585

86+
# Launch storage + LB configuration in the background. It waits for its
87+
# own prerequisites (linstor-controller deploy, MetalLB CRDs) and finishes
88+
# while the parallel HR wait below is still running, so the cost overlaps
89+
# with the platform reconcile instead of compounding it.
90+
hack/e2e-post-install-prep.sh > /tmp/post-install-prep.log 2>&1 &
91+
POST_PREP_PID=$!
92+
8693
# Wait until HelmReleases appear & reconcile them
8794
timeout 180 sh -ec 'until [ $(kubectl get hr -A --no-headers 2>/dev/null | wc -l) -gt 10 ]; do sleep 1; done'
8895
sleep 5
8996
kubectl get hr -A | awk 'NR>1 {print "kubectl wait --timeout=15m --for=condition=ready -n "$1" hr/"$2" &"} END {print "wait"}' | sh -ex
9097

98+
echo "Waiting for post-install-prep to complete"
99+
if ! wait $POST_PREP_PID; then
100+
cat /tmp/post-install-prep.log >&2
101+
echo "post-install-prep failed" >&2
102+
exit 1
103+
fi
104+
cat /tmp/post-install-prep.log
105+
91106
# Fail the test if any HelmRelease is not Ready
92107
if kubectl get hr -A | grep -v " True " | grep -v NAME; then
93108
kubectl get hr -A
@@ -101,79 +116,6 @@ EOF
101116
kubectl wait deployment/capi-controller-manager deployment/capi-kamaji-controller-manager deployment/capi-kubeadm-bootstrap-controller-manager deployment/capi-operator-cluster-api-operator deployment/capk-controller-manager -n cozy-cluster-api --timeout=2m --for=condition=available
102117
}
103118

104-
@test "Wait for LINSTOR and configure storage" {
105-
# Linstor controller and nodes
106-
kubectl wait deployment/linstor-controller -n cozy-linstor --timeout=5m --for=condition=available
107-
timeout 60 sh -ec 'until [ $(kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor node list | grep -c Online) -eq 3 ]; do sleep 1; done'
108-
109-
created_pools=$(kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor sp l -s data --pastable | awk '$2 == "data" {printf " " $4} END{printf " "}')
110-
for node in srv1 srv2 srv3; do
111-
case $created_pools in
112-
*" $node "*) echo "Storage pool 'data' already exists on node $node"; continue;;
113-
esac
114-
kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor ps cdp zfs ${node} /dev/vdc --pool-name data --storage-pool data
115-
done
116-
117-
# Storage classes
118-
kubectl apply -f - <<'EOF'
119-
---
120-
apiVersion: storage.k8s.io/v1
121-
kind: StorageClass
122-
metadata:
123-
name: local
124-
annotations:
125-
storageclass.kubernetes.io/is-default-class: "true"
126-
provisioner: linstor.csi.linbit.com
127-
parameters:
128-
linstor.csi.linbit.com/storagePool: "data"
129-
linstor.csi.linbit.com/layerList: "storage"
130-
linstor.csi.linbit.com/allowRemoteVolumeAccess: "false"
131-
volumeBindingMode: WaitForFirstConsumer
132-
allowVolumeExpansion: true
133-
---
134-
apiVersion: storage.k8s.io/v1
135-
kind: StorageClass
136-
metadata:
137-
name: replicated
138-
provisioner: linstor.csi.linbit.com
139-
parameters:
140-
linstor.csi.linbit.com/storagePool: "data"
141-
linstor.csi.linbit.com/autoPlace: "3"
142-
linstor.csi.linbit.com/layerList: "drbd storage"
143-
linstor.csi.linbit.com/allowRemoteVolumeAccess: "true"
144-
property.linstor.csi.linbit.com/DrbdOptions/auto-quorum: suspend-io
145-
property.linstor.csi.linbit.com/DrbdOptions/Resource/on-no-data-accessible: suspend-io
146-
property.linstor.csi.linbit.com/DrbdOptions/Resource/on-suspended-primary-outdated: force-secondary
147-
property.linstor.csi.linbit.com/DrbdOptions/Net/rr-conflict: retry-connect
148-
volumeBindingMode: Immediate
149-
allowVolumeExpansion: true
150-
EOF
151-
}
152-
153-
@test "Wait for MetalLB and configure address pool" {
154-
# MetalLB address pool
155-
kubectl apply -f - <<'EOF'
156-
---
157-
apiVersion: metallb.io/v1beta1
158-
kind: L2Advertisement
159-
metadata:
160-
name: cozystack
161-
namespace: cozy-metallb
162-
spec:
163-
ipAddressPools: [cozystack]
164-
---
165-
apiVersion: metallb.io/v1beta1
166-
kind: IPAddressPool
167-
metadata:
168-
name: cozystack
169-
namespace: cozy-metallb
170-
spec:
171-
addresses: [192.168.123.200-192.168.123.250]
172-
autoAssign: true
173-
avoidBuggyIPs: false
174-
EOF
175-
}
176-
177119
@test "Check Cozystack API service" {
178120
kubectl wait --for=condition=Available apiservices/v1alpha1.apps.cozystack.io apiservices/v1alpha1.core.cozystack.io --timeout=2m
179121
}

‎hack/e2e-post-install-prep.sh‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/sh
2+
# Runs LINSTOR pool + StorageClass + MetalLB pool configuration as soon as
3+
# their respective prerequisites are reachable. Designed to run in the
4+
# background during the platform HR reconcile wait, so its wall-clock cost
5+
# overlaps with the wait instead of compounding it.
6+
set -eu
7+
8+
echo "[post-install-prep] waiting for linstor HelmRelease object to exist"
9+
timeout 60 sh -ec 'until kubectl get hr/linstor -n cozy-linstor >/dev/null 2>&1; do sleep 2; done'
10+
11+
echo "[post-install-prep] waiting for linstor HelmRelease to be Ready"
12+
kubectl wait helmrelease/linstor -n cozy-linstor --for=condition=Ready --timeout=15m
13+
14+
echo "[post-install-prep] waiting for linstor-controller deployment to exist"
15+
timeout 300 sh -ec 'until kubectl get deploy/linstor-controller -n cozy-linstor >/dev/null 2>&1; do sleep 2; done'
16+
17+
echo "[post-install-prep] waiting for linstor-controller to be Available"
18+
kubectl wait deployment/linstor-controller -n cozy-linstor --timeout=5m --for=condition=available
19+
20+
echo "[post-install-prep] waiting for 3 LINSTOR nodes Online"
21+
timeout 60 sh -ec 'until [ $(kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor node list | grep -c Online) -eq 3 ]; do sleep 1; done'
22+
23+
echo "[post-install-prep] creating LINSTOR storage pools (parallel across nodes)"
24+
created_pools=$(kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor sp l -s data --pastable | awk '$2 == "data" {printf " " $4} END{printf " "}')
25+
for node in srv1 srv2 srv3; do
26+
case $created_pools in
27+
*" $node "*) echo " pool 'data' already exists on $node"; continue;;
28+
esac
29+
kubectl exec -n cozy-linstor deploy/linstor-controller -- linstor ps cdp zfs ${node} /dev/vdc --pool-name data --storage-pool data &
30+
done
31+
wait
32+
33+
echo "[post-install-prep] applying StorageClasses"
34+
kubectl apply -f - <<'EOF'
35+
---
36+
apiVersion: storage.k8s.io/v1
37+
kind: StorageClass
38+
metadata:
39+
name: local
40+
annotations:
41+
storageclass.kubernetes.io/is-default-class: "true"
42+
provisioner: linstor.csi.linbit.com
43+
parameters:
44+
linstor.csi.linbit.com/storagePool: "data"
45+
linstor.csi.linbit.com/layerList: "storage"
46+
linstor.csi.linbit.com/allowRemoteVolumeAccess: "false"
47+
volumeBindingMode: WaitForFirstConsumer
48+
allowVolumeExpansion: true
49+
---
50+
apiVersion: storage.k8s.io/v1
51+
kind: StorageClass
52+
metadata:
53+
name: replicated
54+
provisioner: linstor.csi.linbit.com
55+
parameters:
56+
linstor.csi.linbit.com/storagePool: "data"
57+
linstor.csi.linbit.com/autoPlace: "3"
58+
linstor.csi.linbit.com/layerList: "drbd storage"
59+
linstor.csi.linbit.com/allowRemoteVolumeAccess: "true"
60+
property.linstor.csi.linbit.com/DrbdOptions/auto-quorum: suspend-io
61+
property.linstor.csi.linbit.com/DrbdOptions/Resource/on-no-data-accessible: suspend-io
62+
property.linstor.csi.linbit.com/DrbdOptions/Resource/on-suspended-primary-outdated: force-secondary
63+
property.linstor.csi.linbit.com/DrbdOptions/Net/rr-conflict: retry-connect
64+
volumeBindingMode: Immediate
65+
allowVolumeExpansion: true
66+
EOF
67+
68+
echo "[post-install-prep] waiting for MetalLB CRDs"
69+
timeout 300 sh -ec 'until kubectl get crd ipaddresspools.metallb.io l2advertisements.metallb.io >/dev/null 2>&1; do sleep 2; done'
70+
71+
echo "[post-install-prep] applying MetalLB IPAddressPool"
72+
kubectl apply -f - <<'EOF'
73+
---
74+
apiVersion: metallb.io/v1beta1
75+
kind: L2Advertisement
76+
metadata:
77+
name: cozystack
78+
namespace: cozy-metallb
79+
spec:
80+
ipAddressPools: [cozystack]
81+
---
82+
apiVersion: metallb.io/v1beta1
83+
kind: IPAddressPool
84+
metadata:
85+
name: cozystack
86+
namespace: cozy-metallb
87+
spec:
88+
addresses: [192.168.123.200-192.168.123.250]
89+
autoAssign: true
90+
avoidBuggyIPs: false
91+
EOF
92+
93+
echo "[post-install-prep] done"

0 commit comments

Comments
 (0)