Skip to content

Commit 0f8c8f5

Browse files
committed
[test] Use dual store in deployment
1 parent 8691581 commit 0f8c8f5

17 files changed

+373
-8
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ RUN cargo build ${build_flag:+"$build_flag"} \
6969
--bin linera \
7070
--bin linera-proxy \
7171
--bin linera-server \
72-
--features scylladb,metrics
72+
--features scylladb,rocksdb,metrics
7373

7474
RUN mv \
7575
target/"$target"/"$build_folder"/linera \

docker/server-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ storage_replication_factor=$1
66
ORDINAL="${HOSTNAME##*-}"
77

88
exec ./linera-server run \
9-
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
9+
--storage dualrocksdbscylladb:/rocksdb/linera.db:spawn_blocking:tcp:scylla-client.scylla.svc.cluster.local:9042 \
1010
--server /config/server.json \
1111
--shard $ORDINAL \
1212
--genesis /config/genesis.json \

docker/server-init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
storage_replication_factor=$1
44
while true; do
5-
./linera storage check-existence --storage "scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042"
5+
./linera storage check-existence --storage "dualrocksdbscylladb:/rocksdb/linera.db:spawn_blocking:tcp:scylla-client.scylla.svc.cluster.local:9042"
66
status=$?
77

88
if [ $status -eq 0 ]; then
@@ -11,7 +11,7 @@ while true; do
1111
elif [ $status -eq 1 ]; then
1212
echo "Database does not exist, attempting to initialize..."
1313
if ./linera-server initialize \
14-
--storage scylladb:tcp:scylla-client.scylla.svc.cluster.local:9042 \
14+
--storage dualrocksdbscylladb:/rocksdb/linera.db:spawn_blocking:tcp:scylla-client.scylla.svc.cluster.local:9042 \
1515
--genesis /config/genesis.json \
1616
--storage-replication-factor $storage_replication_factor; then
1717
echo "Initialization successful."

kubernetes/linera-validator/helmfile.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@ environments:
33
values:
44
- writeToGrafanaCloud: {{ env "LINERA_WRITE_TO_GRAFANA_CLOUD" | default "false" }}
55
validatorLabel: {{ env "LINERA_VALIDATOR_LABEL" | default (printf "local-%s" (env "USER")) }}
6+
runLocalCsiSetup: {{ env "LINERA_RUN_LOCAL_CSI_SETUP" | default "false" }}
7+
8+
helmDefaults:
9+
wait: true
10+
recreatePods: false
11+
12+
{{- if .Values.runLocalCsiSetup }}
13+
hooks:
14+
- events: ["prepare"]
15+
showlogs: true
16+
command: bash
17+
args:
18+
- -c
19+
- |
20+
echo "Ensuring RAID0 and Local‑CSI driver are setup..."
21+
22+
kubectl create -f ./scylla-setup/gke-daemonset-raid-disks.yaml
23+
kubectl -n default rollout status daemonset/gke-raid-disks
24+
25+
kubectl apply -f ./scylla-setup/local-csi-driver
26+
kubectl -n local-csi-driver rollout status daemonset.apps/local-csi-driver
27+
28+
kubectl apply -f ./scylla-setup/local-ssd-sc.yaml
29+
{{- end }}
630

731
---
832

@@ -69,4 +93,3 @@ releases:
6993
set:
7094
- name: crds.enabled
7195
value: "true"
72-

kubernetes/linera-validator/scylla-manager.values.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ controllerResources:
99
memory: 200Mi
1010

1111
scylla:
12-
developerMode: true
1312
scyllaImage:
1413
tag: 5.4.3
1514
agentImage:
1615
tag: 3.2.8
17-
datacenter: manager-dc
16+
datacenter: validator
1817
racks:
1918
- name: manager-rack
2019
members: 1
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: gke-raid-disks
5+
namespace: default
6+
labels:
7+
k8s-app: gke-raid-disks
8+
spec:
9+
selector:
10+
matchLabels:
11+
name: gke-raid-disks
12+
template:
13+
metadata:
14+
labels:
15+
name: gke-raid-disks
16+
spec:
17+
nodeSelector:
18+
cloud.google.com/gke-local-nvme-ssd: "true"
19+
hostPID: true
20+
containers:
21+
- name: startup-script
22+
image: registry.k8s.io/startup-script:v1
23+
securityContext:
24+
privileged: true
25+
env:
26+
- name: STARTUP_SCRIPT
27+
value: |
28+
set -o errexit
29+
set -o nounset
30+
set -o pipefail
31+
32+
# Ensure we have the XFS tools
33+
if ! command -v mkfs.xfs >/dev/null; then
34+
echo "mkfs.xfs not found! Installing xfsprogs..."
35+
apt-get update
36+
DEBIAN_FRONTEND=noninteractive \
37+
apt-get install -y --no-install-recommends xfsprogs
38+
fi
39+
40+
devices=()
41+
for ssd in /dev/disk/by-id/google-local-ssd-block*; do
42+
if [ -e "${ssd}" ]; then
43+
devices+=("${ssd}")
44+
fi
45+
done
46+
if [ "${#devices[@]}" -eq 0 ]; then
47+
echo "No Local NVMe SSD disks found."
48+
exit 1
49+
fi
50+
51+
seen_arrays=(/dev/md/*)
52+
device=${seen_arrays[0]}
53+
echo "Setting RAID array with Local SSDs on device ${device}"
54+
if [ ! -e "$device" ]; then
55+
device="/dev/md/0"
56+
echo "y" | mdadm --create "${device}" --level=0 --force --raid-devices=${#devices[@]} "${devices[@]}"
57+
fi
58+
59+
if ! blkid "${device}" >/dev/null 2>&1 ; then
60+
echo "Formatting '${device}'"
61+
mkfs.xfs -f "${device}"
62+
fi
63+
64+
mountpoint=/mnt/disks/raid
65+
mkdir -p "${mountpoint}"
66+
echo "Mounting '${device}' at '${mountpoint}'"
67+
mount -o discard,prjquota,noatime,nodiratime "${device}" "${mountpoint}"
68+
chmod a+w "${mountpoint}"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: local-csi-driver
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: CSIDriver
3+
metadata:
4+
name: local.csi.scylladb.com
5+
spec:
6+
attachRequired: false
7+
storageCapacity: true
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: local-csi-driver
5+
namespace: local-csi-driver
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
kind: ClusterRole
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
metadata:
4+
name: scylladb:csi-external-provisioner
5+
rules:
6+
- apiGroups:
7+
- ""
8+
resources:
9+
- "persistentvolumes"
10+
verbs:
11+
- "get"
12+
- "list"
13+
- "watch"
14+
- "create"
15+
- "delete"
16+
- apiGroups:
17+
- ""
18+
resources:
19+
- "persistentvolumeclaims"
20+
verbs:
21+
- "get"
22+
- "list"
23+
- "watch"
24+
- "update"
25+
- apiGroups:
26+
- "storage.k8s.io"
27+
resources:
28+
- "storageclasses"
29+
verbs:
30+
- "get"
31+
- "list"
32+
- "watch"
33+
- apiGroups:
34+
- ""
35+
resources:
36+
- "events"
37+
verbs:
38+
- "list"
39+
- "watch"
40+
- "create"
41+
- "update"
42+
- "patch"
43+
- apiGroups:
44+
- "snapshot.storage.k8s.io"
45+
resources:
46+
- "volumesnapshots"
47+
verbs:
48+
- "get"
49+
- "list"
50+
- apiGroups:
51+
- "snapshot.storage.k8s.io"
52+
resources:
53+
- "volumesnapshotcontents"
54+
verbs:
55+
- "get"
56+
- "list"
57+
- apiGroups:
58+
- "storage.k8s.io"
59+
resources:
60+
- "csinodes"
61+
verbs:
62+
- "get"
63+
- "list"
64+
- "watch"
65+
- apiGroups:
66+
- ""
67+
resources:
68+
- "nodes"
69+
verbs:
70+
- "get"
71+
- "list"
72+
- "watch"
73+
- apiGroups:
74+
- "storage.k8s.io"
75+
resources:
76+
- "csistoragecapacities"
77+
verbs:
78+
- "get"
79+
- "list"
80+
- "watch"
81+
- "create"
82+
- "update"
83+
- "patch"
84+
- "delete"
85+
# The GET permissions below are needed for walking up the ownership chain
86+
# for CSIStorageCapacity. They are sufficient for deployment via
87+
# StatefulSet (only needs to get Pod) and Deployment (needs to get
88+
# Pod and then ReplicaSet to find the Deployment).
89+
- apiGroups:
90+
- ""
91+
resources:
92+
- "pods"
93+
verbs:
94+
- "get"
95+
- apiGroups:
96+
- "apps"
97+
resources:
98+
- "replicasets"
99+
verbs:
100+
- "get"

0 commit comments

Comments
 (0)