Simplifies cluster service setup.
This commit is contained in:
@@ -28,7 +28,6 @@ while [[ $# -gt 0 ]]; do
|
||||
echo " - Each service will prompt for its required configuration"
|
||||
echo ""
|
||||
echo "Prerequisites:"
|
||||
echo " - Run 'wild-setup-scaffold' to initialize the cloud"
|
||||
echo " - Run 'wild-setup-cluster' to set up cluster infrastructure"
|
||||
echo " - Kubernetes cluster must be running and kubectl configured"
|
||||
exit 0
|
||||
@@ -67,34 +66,57 @@ fi
|
||||
|
||||
print_header "Wild Cloud services setup"
|
||||
|
||||
if ! command -v kubectl >/dev/null 2>&1; then
|
||||
print_error "kubectl is not installed or not in PATH"
|
||||
print_info "Please install kubectl and configure it to connect to your cluster"
|
||||
exit 1
|
||||
fi
|
||||
# Define services in dependency order
|
||||
SERVICES_TO_INSTALL=(
|
||||
"metallb"
|
||||
"longhorn"
|
||||
"traefik"
|
||||
"coredns"
|
||||
"cert-manager"
|
||||
"externaldns"
|
||||
"kubernetes-dashboard"
|
||||
"nfs"
|
||||
"docker-registry"
|
||||
)
|
||||
|
||||
if ! kubectl cluster-info >/dev/null 2>&1; then
|
||||
print_error "kubectl is not configured to connect to your cluster"
|
||||
print_info "Please configure kubectl to connect to your Kubernetes cluster"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate cluster services setup files
|
||||
wild-cluster-services-fetch
|
||||
wild-cluster-services-generate
|
||||
|
||||
# Apply cluster services to cluster
|
||||
# Set up services one by one
|
||||
INSTALLED_COUNT=0
|
||||
FAILED_COUNT=0
|
||||
|
||||
if [ "${SKIP_INSTALL}" = false ]; then
|
||||
wild-cluster-services-up
|
||||
SERVICES_INSTALLED=true
|
||||
for service in "${SERVICES_TO_INSTALL[@]}"; do
|
||||
echo ""
|
||||
print_header "Setting up service: $service"
|
||||
|
||||
if wild-service-setup "$service" --fetch; then
|
||||
print_success "$service setup completed"
|
||||
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
|
||||
else
|
||||
print_error "$service setup failed"
|
||||
FAILED_COUNT=$((FAILED_COUNT + 1))
|
||||
# Stop on first failure for easier debugging
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $FAILED_COUNT -eq 0 ]; then
|
||||
SERVICES_INSTALLED=true
|
||||
print_success "All $INSTALLED_COUNT services set up successfully!"
|
||||
else
|
||||
print_error "Service setup stopped after $service failure"
|
||||
print_info "Fix the issue and resume with: wild-service-setup $service --fetch"
|
||||
print_info "Then continue with remaining services or re-run wild-setup-services"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_info "Skipping cluster services installation (--skip-install specified)"
|
||||
print_info "You can install them later with: wild-cluster-services-up"
|
||||
print_info "You can install them later with:"
|
||||
for service in "${SERVICES_TO_INSTALL[@]}"; do
|
||||
print_info " wild-service-setup $service --fetch"
|
||||
done
|
||||
fi
|
||||
|
||||
# Summary output
|
||||
|
||||
print_header "Wild Cloud Services Setup Complete!"
|
||||
echo ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user