Skip to content

Commit cba7fa2

Browse files
committed
Update init-job.yaml
1 parent 8c5e92e commit cba7fa2

1 file changed

Lines changed: 15 additions & 27 deletions

File tree

my-apps/media/garage/init-job.yaml

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,54 +12,42 @@ spec:
1212
template:
1313
spec:
1414
restartPolicy: OnFailure
15-
serviceAccountName: garage
1615
containers:
1716
- name: init-cluster
18-
image: dxflrs/garage:v1.0.0
17+
image: bitnami/kubectl:latest
1918
command:
20-
- /bin/sh
19+
- /bin/bash
2120
- -c
2221
- |
2322
set -e
2423
echo "Waiting for Garage nodes to be ready..."
2524
sleep 30
2625
27-
# Get list of nodes
28-
NODES=$(/garage status -f json | jq -r '.nodes[] | select(.role == null) | .id' || true)
26+
# Get node status from garage-0 pod
27+
echo "Checking cluster status..."
28+
kubectl exec -n garage garage-0 -- /garage status || true
29+
30+
# Get list of nodes without roles
31+
NODES=$(kubectl exec -n garage garage-0 -- /garage status 2>&1 | grep "NO ROLE" | awk '{print $1}' || true)
2932
3033
if [ -z "$NODES" ]; then
31-
echo "All nodes already have roles assigned or no nodes found"
32-
/garage status
34+
echo "All nodes already have roles assigned"
35+
kubectl exec -n garage garage-0 -- /garage status
3336
exit 0
3437
fi
3538
36-
echo "Found unassigned nodes, configuring layout..."
39+
echo "Found unassigned nodes: $NODES"
40+
echo "Configuring layout..."
3741
3842
# Assign capacity to each node (100GB each)
3943
for NODE_ID in $NODES; do
4044
echo "Assigning capacity to node $NODE_ID"
41-
/garage layout assign $NODE_ID -z dc1 -c 100G
45+
kubectl exec -n garage garage-0 -- /garage layout assign $NODE_ID -z dc1 -c 100G
4246
done
4347
4448
# Apply the layout
4549
echo "Applying layout configuration..."
46-
/garage layout apply --version 1
50+
kubectl exec -n garage garage-0 -- /garage layout apply --version 1
4751
4852
echo "Garage cluster initialized successfully!"
49-
/garage status
50-
env:
51-
- name: GARAGE_RPC_SECRET_FILE
52-
value: /mnt/meta/rpc-secret
53-
volumeMounts:
54-
- name: meta
55-
mountPath: /mnt/meta
56-
- name: config
57-
mountPath: /etc/garage.toml
58-
subPath: garage.toml
59-
volumes:
60-
- name: meta
61-
persistentVolumeClaim:
62-
claimName: meta-garage-0
63-
- name: config
64-
configMap:
65-
name: garage-config
53+
kubectl exec -n garage garage-0 -- /garage status

0 commit comments

Comments
 (0)