Skip to content

Commit

Permalink
Merge pull request #318 from dysnix/gcp-local-ssd-raid-fix-restart
Browse files Browse the repository at this point in the history
[gcp-local-ssd-raid] fix init script crash on subsequent restarts
  • Loading branch information
voron authored Aug 29, 2024
2 parents 8cee5c3 + a26123f commit a5c1858
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dysnix/gcp-local-ssd-raid/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: gcp-local-ssd-raid
description: A Helm chart for Kubernetes
version: 0.1.5
version: 0.1.6
appVersion: "0.1.0"

keywords:
Expand Down
12 changes: 9 additions & 3 deletions dysnix/gcp-local-ssd-raid/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ spec:
if ! test -e $raid_dev ; then
echo "$devs" | xargs /sbin/mdadm --create $raid_dev --level=0 --raid-devices=$(echo "$devs" | wc -l)
sudo mkfs.ext4 {{ .Values.localSsd.mkfsOpts }} -F $raid_dev
new_dev=$raid_dev
fi
new_dev=$raid_dev
else
if ! echo "$pvs" | grep volume_all_ssds ; then
echo "$devs" | xargs /sbin/pvcreate
Expand All @@ -153,7 +153,9 @@ spec:
new_dev=/dev/volume_all_ssds/logical_all_ssds
fi
if ! uuid=$(blkid -s UUID -o value $new_dev) ; then
uuid=$(blkid -s UUID -o value $new_dev)
if test -z "$uuid" ; then
mkfs.ext4 {{ .Values.localSsd.mkfsOpts }} $new_dev
uuid=$(blkid -s UUID -o value $new_dev)
fi
Expand All @@ -168,7 +170,11 @@ spec:
if ! grep "$uuid" /etc/fstab ; then
echo "UUID=$uuid $mnt_dir ext4 $mnt_opts" >> /etc/fstab
fi
mount -U "$uuid" -t ext4 --target "$mnt_dir" --options "$mnt_opts"
if ! findmnt -n -a -l --nofsroot | grep "$mnt_dir" ; then
mount -U "$uuid" -t ext4 --target "$mnt_dir" --options "$mnt_opts"
fi
chmod a+w "$mnt_dir"
containers:
- image: "quay.io/external_storage/local-volume-provisioner:v2.3.2"
Expand Down

0 comments on commit a5c1858

Please sign in to comment.