Setup script cleanup.
This commit is contained in:
@@ -75,12 +75,7 @@ else
|
|||||||
init_wild_env
|
init_wild_env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check required configuration
|
prompt_if_unset_config "cluster.name" "Cluster name" "local.example.com"
|
||||||
if [ -z "$(get_current_config "cluster.name")" ]; then
|
|
||||||
print_error "Basic cluster configuration is missing"
|
|
||||||
print_info "Run 'wild-setup' to configure your cluster"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Function to ensure required directories exist in WC_HOME
|
# Function to ensure required directories exist in WC_HOME
|
||||||
ensure_required_directories() {
|
ensure_required_directories() {
|
||||||
@@ -161,13 +156,6 @@ fi
|
|||||||
PATCH_FILE="${NODE_SETUP_DIR}/patch/${NODE_IP}.yaml"
|
PATCH_FILE="${NODE_SETUP_DIR}/patch/${NODE_IP}.yaml"
|
||||||
OUTPUT_CONFIG="${NODE_SETUP_DIR}/final/${NODE_IP}.yaml"
|
OUTPUT_CONFIG="${NODE_SETUP_DIR}/final/${NODE_IP}.yaml"
|
||||||
|
|
||||||
# Check if the patch template exists
|
|
||||||
if [ ! -f "$TEMPLATE_FILE" ]; then
|
|
||||||
print_error "Patch template not found: $TEMPLATE_FILE"
|
|
||||||
print_info "Make sure the wild-cloud repository is properly set up"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a temporary template with the node IP for gomplate processing
|
# Create a temporary template with the node IP for gomplate processing
|
||||||
TEMP_TEMPLATE="/tmp/${NODE_IP//\//_}-$(date +%s).yaml"
|
TEMP_TEMPLATE="/tmp/${NODE_IP//\//_}-$(date +%s).yaml"
|
||||||
sed "s/{{NODE_IP}}/${NODE_IP}/g" "$TEMPLATE_FILE" > "$TEMP_TEMPLATE"
|
sed "s/{{NODE_IP}}/${NODE_IP}/g" "$TEMPLATE_FILE" > "$TEMP_TEMPLATE"
|
||||||
|
@@ -64,8 +64,8 @@ fi
|
|||||||
|
|
||||||
print_header "Cluster Services Setup Generation"
|
print_header "Cluster Services Setup Generation"
|
||||||
|
|
||||||
SOURCE_DIR="${WC_ROOT}/setup/cluster"
|
SOURCE_DIR="${WC_ROOT}/setup/cluster-services"
|
||||||
DEST_DIR="${WC_HOME}/setup/cluster"
|
DEST_DIR="${WC_HOME}/setup/cluster-services"
|
||||||
|
|
||||||
# Check if source directory exists
|
# Check if source directory exists
|
||||||
if [ ! -d "$SOURCE_DIR" ]; then
|
if [ ! -d "$SOURCE_DIR" ]; then
|
||||||
|
@@ -72,11 +72,11 @@ else
|
|||||||
init_wild_env
|
init_wild_env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster"
|
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster-services"
|
||||||
|
|
||||||
# Check if cluster setup directory exists
|
# Check if cluster setup directory exists
|
||||||
if [ ! -d "$CLUSTER_SETUP_DIR" ]; then
|
if [ ! -d "$CLUSTER_SETUP_DIR" ]; then
|
||||||
print_error "Cluster setup directory not found: $CLUSTER_SETUP_DIR"
|
print_error "Cluster services setup directory not found: $CLUSTER_SETUP_DIR"
|
||||||
print_info "Run 'wild-cluster-services-generate' first to generate setup files"
|
print_info "Run 'wild-cluster-services-generate' first to generate setup files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@@ -68,89 +68,54 @@ if [ -z "$(get_current_config "cluster.name")" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_header "Wild-Cloud Services Setup"
|
print_header "Wild Cloud Services Setup"
|
||||||
print_info "Installing Kubernetes cluster services (Phase 4)"
|
print_info "Installing Kubernetes cluster services"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# =============================================================================
|
if ! command -v kubectl >/dev/null 2>&1; then
|
||||||
# Cluster Services Installation
|
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
|
||||||
|
|
||||||
print_header "Cluster Services Installation"
|
if ! kubectl cluster-info >/dev/null 2>&1; then
|
||||||
|
print_error "kubectl is not configured to connect to your cluster"
|
||||||
print_info "This phase installs core cluster services (MetalLB, Traefik, cert-manager, etc.)"
|
print_info "Please configure kubectl to connect to your Kubernetes cluster"
|
||||||
print_info "Each service will prompt for any required configuration during installation"
|
exit 1
|
||||||
print_warning "Make sure your cluster is running and kubectl is configured!"
|
fi
|
||||||
|
|
||||||
# Generate cluster services setup files
|
# Generate cluster services setup files
|
||||||
print_info "Generating cluster services setup files..."
|
|
||||||
wild-cluster-services-generate --force
|
wild-cluster-services-generate --force
|
||||||
|
|
||||||
if [ "${SKIP_INSTALL}" = false ]; then
|
# Apply cluster services to cluster
|
||||||
read -p "Do you want to install cluster services now? (y/N): " -r install_services
|
|
||||||
|
|
||||||
if [[ $install_services =~ ^[Yy]$ ]]; then
|
if [ "${SKIP_INSTALL}" = false ]; then
|
||||||
print_info "Installing cluster services..."
|
|
||||||
wild-cluster-services-up
|
wild-cluster-services-up
|
||||||
SERVICES_INSTALLED=true
|
SERVICES_INSTALLED=true
|
||||||
else
|
|
||||||
print_info "Skipping cluster services installation"
|
|
||||||
print_info "You can install them later with: wild-cluster-services-up"
|
|
||||||
SKIP_INSTALL=true
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
print_info "Skipping cluster services installation (--skip-install specified)"
|
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: wild-cluster-services-up"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${SKIP_INSTALL}" = false ] && [ "${SERVICES_INSTALLED:-false}" = true ]; then
|
# Summary output
|
||||||
print_success "Completed: Cluster services installation"
|
|
||||||
else
|
print_header "Wild Cloud Services Setup Complete!"
|
||||||
print_success "Completed: Cluster services configuration generated"
|
|
||||||
fi
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# =============================================================================
|
if [ "${SERVICES_INSTALLED:-false}" = true ]; then
|
||||||
# COMPLETION
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
print_header "Wild-Cloud Services Setup Complete!"
|
|
||||||
|
|
||||||
print_success "Cluster services setup completed!"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
print_info "Configuration files:"
|
|
||||||
echo " - ${WC_HOME}/config.yaml"
|
|
||||||
echo " - ${WC_HOME}/secrets.yaml"
|
|
||||||
|
|
||||||
if [ -d "${WC_HOME}/setup/cluster" ]; then
|
|
||||||
echo ""
|
|
||||||
print_info "Generated service configurations:"
|
|
||||||
echo " - ${WC_HOME}/setup/cluster/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
if [ "${SKIP_INSTALL}" = false ] && [ "${SERVICES_INSTALLED:-false}" = true ]; then
|
|
||||||
print_info "Cluster services have been installed!"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
if command -v kubectl >/dev/null 2>&1; then
|
|
||||||
INTERNAL_DOMAIN=$(wild-config cloud.internalDomain 2>/dev/null || echo "your-internal-domain")
|
INTERNAL_DOMAIN=$(wild-config cloud.internalDomain 2>/dev/null || echo "your-internal-domain")
|
||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo " 1. Access the dashboard at: https://dashboard.${INTERNAL_DOMAIN}"
|
echo " 1. Access the dashboard at: https://dashboard.${INTERNAL_DOMAIN}"
|
||||||
echo " 2. Get the dashboard token with: ./bin/dashboard-token"
|
echo " 2. Get the dashboard token with: wild-dashboard-token"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To verify components, run:"
|
echo "To verify components, run:"
|
||||||
echo " - kubectl get pods -n cert-manager"
|
echo " - kubectl get pods -n cert-manager"
|
||||||
echo " - kubectl get pods -n externaldns"
|
echo " - kubectl get pods -n externaldns"
|
||||||
echo " - kubectl get pods -n kubernetes-dashboard"
|
echo " - kubectl get pods -n kubernetes-dashboard"
|
||||||
echo " - kubectl get clusterissuers"
|
echo " - kubectl get clusterissuers"
|
||||||
else
|
|
||||||
echo "Next steps:"
|
|
||||||
echo " 1. Verify your cluster services are running"
|
|
||||||
echo " 2. Configure kubectl if not already done"
|
|
||||||
echo " 3. Access your services via the configured ingress"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo " 1. Ensure your cluster is running and kubectl is configured"
|
echo " 1. Ensure your cluster is running and kubectl is configured"
|
||||||
|
Reference in New Issue
Block a user