mount dev sources directly from workspace PVC

This commit is contained in:
2026-07-21 21:31:09 +00:00
parent 872529b3d9
commit 3c32319603
4 changed files with 16 additions and 116 deletions

View File

@@ -12,44 +12,12 @@ if [[ ${#instance} -gt 42 || ! $instance =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ ]];
fi
namespace=${DEV_NAMESPACE:-vibes}
shared_root=${DEV_SHARED_ROOT:-/data/live}
destination="$shared_root/$instance"
state_dir="$shared_root/.hello-dev-state"
pid_file="$state_dir/$instance.pid"
log_file="$state_dir/$instance.log"
label="dev.mancave.link/instance=$instance"
if [[ $shared_root != /* || $shared_root == / ]]; then
echo "DEV_SHARED_ROOT must be an absolute directory below /: $shared_root" >&2
exit 2
fi
if [[ -f $pid_file ]]; then
sync_pid=$(<"$pid_file")
process_command=""
if [[ $sync_pid =~ ^[0-9]+$ && -r /proc/$sync_pid/cmdline ]]; then
process_command=$(tr '\0' ' ' <"/proc/$sync_pid/cmdline")
fi
if [[ $process_command == *"start.sh __sync $instance "* ]]; then
kill "$sync_pid"
for _ in {1..20}; do
kill -0 "$sync_pid" 2>/dev/null || break
sleep 0.1
done
kill -9 "$sync_pid" 2>/dev/null || true
fi
fi
kubectl delete all,ingress,configmap,secret,pvc \
kubectl delete deployment,service,ingress \
--namespace "$namespace" \
--selector "$label" \
--ignore-not-found=true \
--wait=true
if [[ -d $destination ]]; then
find "$destination" -depth -delete
fi
rm -f -- "$pid_file" "$log_file"
rmdir -- "$state_dir" 2>/dev/null || true
echo "Development instance '$instance' was permanently removed"