mirror of
https://github.com/sailor-sh/CK-X.git
synced 2026-02-14 17:39:51 +00:00
50 lines
1.6 KiB
Bash
50 lines
1.6 KiB
Bash
#!/bin/sh
|
|
|
|
# ===============================================================================
|
|
# KIND Cluster Setup Entrypoint Script
|
|
# Purpose: Initialize Docker and create Kind cluster
|
|
# ===============================================================================
|
|
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | ===== INITIALIZATION STARTED ====="
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | Executing container startup script..."
|
|
|
|
# Execute current entrypoint script
|
|
if [ -f /usr/local/bin/startup.sh ]; then
|
|
sh /usr/local/bin/startup.sh &
|
|
else
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | [INFO] Default startup script not found at /usr/local/bin/startup.sh"
|
|
fi
|
|
|
|
# ===============================================================================
|
|
# Docker Readiness Check
|
|
# ===============================================================================
|
|
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | Checking Docker service status..."
|
|
DOCKER_CHECK_COUNT=0
|
|
|
|
# Wait for docker to be ready
|
|
while ! docker ps; do
|
|
DOCKER_CHECK_COUNT=$((DOCKER_CHECK_COUNT+1))
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | [WAITING] Docker service not ready yet... (attempt $DOCKER_CHECK_COUNT)"
|
|
sleep 5
|
|
done
|
|
|
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | [SUCCESS] Docker service is ready and operational"
|
|
|
|
#pull kindest/node image
|
|
# docker pull kindest/node:$KIND_DEFAULT_VERSION
|
|
|
|
#add user for ssh access
|
|
adduser -S -D -H -s /sbin/nologin -G sshd sshd
|
|
|
|
#start ssh service
|
|
/usr/sbin/sshd -D &
|
|
|
|
#install k3d
|
|
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.8.3 bash
|
|
|
|
sleep 10
|
|
touch /ready
|
|
|
|
# Keep container running
|
|
tail -f /dev/null |