Separates cluster service config from install.
This commit is contained in:
124
bin/wild-cluster-services-configure
Executable file
124
bin/wild-cluster-services-configure
Executable file
@@ -0,0 +1,124 @@
|
|||||||
|
#\!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# Usage function
|
||||||
|
usage() {
|
||||||
|
echo "Usage: wild-cluster-services-configure [options] [service...]"
|
||||||
|
echo ""
|
||||||
|
echo "Compile service templates with configuration"
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " service Specific service(s) to compile (optional)"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h, --help Show this help message"
|
||||||
|
echo ""
|
||||||
|
echo "Examples:"
|
||||||
|
echo " wild-cluster-services-configure # Compile all services"
|
||||||
|
echo " wild-cluster-services-configure metallb traefik # Compile specific services"
|
||||||
|
echo ""
|
||||||
|
echo "Available services:"
|
||||||
|
echo " metallb, longhorn, traefik, coredns, cert-manager,"
|
||||||
|
echo " externaldns, kubernetes-dashboard, nfs, docker-registry"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
DRY_RUN=false
|
||||||
|
LIST_SERVICES=false
|
||||||
|
SPECIFIC_SERVICES=()
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--dry-run)
|
||||||
|
DRY_RUN=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
echo "Unknown option $1"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
SPECIFIC_SERVICES+=("$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Initialize Wild Cloud environment
|
||||||
|
if [ -z "${WC_ROOT}" ]; then
|
||||||
|
print "WC_ROOT is not set."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
source "${WC_ROOT}/scripts/common.sh"
|
||||||
|
init_wild_env
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster-services"
|
||||||
|
|
||||||
|
# Check if cluster setup directory exists
|
||||||
|
if [ ! -d "$CLUSTER_SETUP_DIR" ]; then
|
||||||
|
print_error "Cluster services setup directory not found: $CLUSTER_SETUP_DIR"
|
||||||
|
print_info "Run 'wild-cluster-services-generate' first to generate setup files"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# CLUSTER SERVICES TEMPLATE COMPILATION
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
print_header "Cluster services template compilation"
|
||||||
|
|
||||||
|
# Get list of services to compile
|
||||||
|
if [ ${#SPECIFIC_SERVICES[@]} -gt 0 ]; then
|
||||||
|
SERVICES_TO_INSTALL=("${SPECIFIC_SERVICES[@]}")
|
||||||
|
print_info "Compiling specific services: ${SERVICES_TO_INSTALL[*]}"
|
||||||
|
else
|
||||||
|
# Compile all available services in a specific order for dependencies
|
||||||
|
SERVICES_TO_INSTALL=(
|
||||||
|
"metallb"
|
||||||
|
"longhorn"
|
||||||
|
"traefik"
|
||||||
|
"coredns"
|
||||||
|
"cert-manager"
|
||||||
|
"externaldns"
|
||||||
|
"kubernetes-dashboard"
|
||||||
|
"nfs"
|
||||||
|
"docker-registry"
|
||||||
|
)
|
||||||
|
print_info "Installing all available services"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_info "Services to compile: ${SERVICES_TO_INSTALL[*]}"
|
||||||
|
|
||||||
|
# Compile services
|
||||||
|
cd "$CLUSTER_SETUP_DIR"
|
||||||
|
INSTALLED_COUNT=0
|
||||||
|
FAILED_COUNT=0
|
||||||
|
|
||||||
|
for service in "${SERVICES_TO_INSTALL[@]}"; do
|
||||||
|
print_info "Compiling $service"
|
||||||
|
|
||||||
|
service_dir="$CLUSTER_SETUP_DIR/$service"
|
||||||
|
source_service_dir="$service_dir/kustomize.template"
|
||||||
|
dest_service_dir="$service_dir/kustomize"
|
||||||
|
|
||||||
|
# Run configuration to make sure we have the template values we need.
|
||||||
|
config_script="$service_dir/configure.sh"
|
||||||
|
if [ -f "$config_script" ]; then
|
||||||
|
source "$config_script"
|
||||||
|
fi
|
||||||
|
|
||||||
|
wild-compile-template-dir --clean "$source_service_dir" "$dest_service_dir"
|
||||||
|
echo ""
|
||||||
|
done
|
||||||
|
|
||||||
|
cd - >/dev/null
|
||||||
|
|
||||||
|
print_success "Successfully compiled: $INSTALLED_COUNT services"
|
148
bin/wild-cluster-services-fetch
Executable file
148
bin/wild-cluster-services-fetch
Executable file
@@ -0,0 +1,148 @@
|
|||||||
|
#\!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# Usage function
|
||||||
|
usage() {
|
||||||
|
echo "Usage: wild-cluster-services-fetch [options]"
|
||||||
|
echo ""
|
||||||
|
echo "Fetch cluster services setup files from the repository."
|
||||||
|
echo ""
|
||||||
|
echo "Arguments:"
|
||||||
|
echo " service Specific service(s) to install (optional)"
|
||||||
|
echo ""
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h, --help Show this help message"
|
||||||
|
echo " --force Force fetching even if files exist"
|
||||||
|
echo ""
|
||||||
|
echo "Examples:"
|
||||||
|
echo " wild-cluster-services-fetch # Fetch all services"
|
||||||
|
echo " wild-cluster-services-fetch metallb traefik # Fetch specific services"
|
||||||
|
echo ""
|
||||||
|
echo "Available services:"
|
||||||
|
echo " metallb, longhorn, traefik, coredns, cert-manager,"
|
||||||
|
echo " externaldns, kubernetes-dashboard, nfs, docker-registry"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse arguments
|
||||||
|
FORCE=false
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--force)
|
||||||
|
FORCE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
echo "Unknown option $1"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unexpected argument: $1"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Initialize Wild Cloud environment
|
||||||
|
if [ -z "${WC_ROOT}" ]; then
|
||||||
|
print "WC_ROOT is not set."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
source "${WC_ROOT}/scripts/common.sh"
|
||||||
|
init_wild_env
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_header "Fetching cluster services templates"
|
||||||
|
|
||||||
|
SOURCE_DIR="${WC_ROOT}/setup/cluster-services"
|
||||||
|
DEST_DIR="${WC_HOME}/setup/cluster-services"
|
||||||
|
|
||||||
|
# Check if source directory exists
|
||||||
|
if [ ! -d "$SOURCE_DIR" ]; then
|
||||||
|
print_error "Cluster setup source directory not found: $SOURCE_DIR"
|
||||||
|
print_info "Make sure the wild-cloud repository is properly set up"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if destination already exists
|
||||||
|
if [ -d "$DEST_DIR" ] && [ "$FORCE" = false ]; then
|
||||||
|
print_warning "Cluster setup directory already exists: $DEST_DIR"
|
||||||
|
read -p "Overwrite existing files? (y/N): " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
FORCE=true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
mkdir -p "$DEST_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy README
|
||||||
|
if [ ! -f "${WC_HOME}/setup/README.md" ]; then
|
||||||
|
cp "${WC_ROOT}/setup/README.md" "${WC_HOME}/setup/README.md"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get list of services to install
|
||||||
|
if [ ${#SPECIFIC_SERVICES[@]} -gt 0 ]; then
|
||||||
|
SERVICES_TO_INSTALL=("${SPECIFIC_SERVICES[@]}")
|
||||||
|
print_info "Fetching specific services: ${SERVICES_TO_INSTALL[*]}"
|
||||||
|
else
|
||||||
|
# Install all available services in a specific order for dependencies
|
||||||
|
SERVICES_TO_INSTALL=(
|
||||||
|
"metallb"
|
||||||
|
"longhorn"
|
||||||
|
"traefik"
|
||||||
|
"coredns"
|
||||||
|
"cert-manager"
|
||||||
|
"externaldns"
|
||||||
|
"kubernetes-dashboard"
|
||||||
|
"nfs"
|
||||||
|
"docker-registry"
|
||||||
|
)
|
||||||
|
print_info "Fetching all available services."
|
||||||
|
fi
|
||||||
|
|
||||||
|
for service in "${SERVICES_TO_INSTALL[@]}"; do
|
||||||
|
|
||||||
|
SERVICE_SOURCE_DIR="$SOURCE_DIR/$service"
|
||||||
|
SERVICE_DEST_DIR="$DEST_DIR/$service"
|
||||||
|
TEMPLATE_SOURCE_DIR="$SERVICE_SOURCE_DIR/kustomize.template"
|
||||||
|
TEMPLATE_DEST_DIR="$SERVICE_DEST_DIR/kustomize.template"
|
||||||
|
|
||||||
|
if [ ! -d "$TEMPLATE_SOURCE_DIR" ]; then
|
||||||
|
print_error "Source directory not found: $TEMPLATE_SOURCE_DIR"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $FORCE && [ -d "$TEMPLATE_DEST_DIR" ]; then
|
||||||
|
print_info "Removing existing $service templates in: $TEMPLATE_DEST_DIR"
|
||||||
|
rm -rf "$TEMPLATE_DEST_DIR"
|
||||||
|
elif [ -d "$TEMPLATE_DEST_DIR" ]; then
|
||||||
|
print_info "Files already exist for $service, skipping (use --force to overwrite)."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$SERVICE_DEST_DIR"
|
||||||
|
mkdir -p "$TEMPLATE_DEST_DIR"
|
||||||
|
cp -f "$SERVICE_SOURCE_DIR/README.md" "$SERVICE_DEST_DIR/"
|
||||||
|
|
||||||
|
if [ -f "$SERVICE_SOURCE_DIR/configure.sh" ]; then
|
||||||
|
cp -f "$SERVICE_SOURCE_DIR/configure.sh" "$SERVICE_DEST_DIR/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$SERVICE_SOURCE_DIR/install.sh" ]; then
|
||||||
|
cp -f "$SERVICE_SOURCE_DIR/install.sh" "$SERVICE_DEST_DIR/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$TEMPLATE_SOURCE_DIR" ]; then
|
||||||
|
cp -r "$TEMPLATE_SOURCE_DIR/"* "$TEMPLATE_DEST_DIR/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_success "Fetched $service templates."
|
||||||
|
done
|
@@ -1,166 +0,0 @@
|
|||||||
#\!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Usage function
|
|
||||||
usage() {
|
|
||||||
echo "Usage: wild-cluster-services-generate [options]"
|
|
||||||
echo ""
|
|
||||||
echo "Generate cluster services setup files by compiling templates."
|
|
||||||
echo ""
|
|
||||||
echo "Options:"
|
|
||||||
echo " -h, --help Show this help message"
|
|
||||||
echo " --force Force regeneration even if files exist"
|
|
||||||
echo ""
|
|
||||||
echo "This script will:"
|
|
||||||
echo " - Copy cluster service templates from WC_ROOT to WC_HOME"
|
|
||||||
echo " - Compile all templates with current configuration"
|
|
||||||
echo " - Prepare services for installation"
|
|
||||||
echo ""
|
|
||||||
echo "Requirements:"
|
|
||||||
echo " - Must be run from a wild-cloud directory"
|
|
||||||
echo " - Basic cluster configuration must be completed"
|
|
||||||
echo " - Service configuration (DNS, storage, etc.) must be completed"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parse arguments
|
|
||||||
FORCE=false
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case $1 in
|
|
||||||
-h|--help)
|
|
||||||
usage
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
--force)
|
|
||||||
FORCE=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-*)
|
|
||||||
echo "Unknown option $1"
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unexpected argument: $1"
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Initialize Wild Cloud environment
|
|
||||||
if [ -z "${WC_ROOT}" ]; then
|
|
||||||
print "WC_ROOT is not set."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
source "${WC_ROOT}/scripts/common.sh"
|
|
||||||
init_wild_env
|
|
||||||
fi
|
|
||||||
|
|
||||||
# =============================================================================
|
|
||||||
# CLUSTER SERVICES SETUP GENERATION
|
|
||||||
# =============================================================================
|
|
||||||
|
|
||||||
print_header "Cluster Services Setup Generation"
|
|
||||||
|
|
||||||
SOURCE_DIR="${WC_ROOT}/setup/cluster-services"
|
|
||||||
DEST_DIR="${WC_HOME}/setup/cluster-services"
|
|
||||||
|
|
||||||
# Check if source directory exists
|
|
||||||
if [ ! -d "$SOURCE_DIR" ]; then
|
|
||||||
print_error "Cluster setup source directory not found: $SOURCE_DIR"
|
|
||||||
print_info "Make sure the wild-cloud repository is properly set up"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if destination already exists
|
|
||||||
if [ -d "$DEST_DIR" ] && [ "$FORCE" = false ]; then
|
|
||||||
print_warning "Cluster setup directory already exists: $DEST_DIR"
|
|
||||||
read -p "Overwrite existing files? (y/N): " -n 1 -r
|
|
||||||
echo
|
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
print_info "Skipping cluster services generation"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
print_info "Regenerating cluster setup files..."
|
|
||||||
rm -rf "$DEST_DIR"
|
|
||||||
elif [ "$FORCE" = true ] && [ -d "$DEST_DIR" ]; then
|
|
||||||
print_info "Force regeneration enabled, removing existing files..."
|
|
||||||
rm -rf "$DEST_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy and compile cluster setup files
|
|
||||||
print_info "Copying and compiling cluster setup files from repository..."
|
|
||||||
mkdir -p "${WC_HOME}/setup"
|
|
||||||
|
|
||||||
# Copy README if it doesn't exist
|
|
||||||
if [ ! -f "${WC_HOME}/setup/README.md" ]; then
|
|
||||||
cp "${WC_ROOT}/setup/README.md" "${WC_HOME}/setup/README.md"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create destination directory
|
|
||||||
mkdir -p "$DEST_DIR"
|
|
||||||
|
|
||||||
# First, copy root-level files from setup/cluster/ (install-all.sh, get_helm.sh, etc.)
|
|
||||||
print_info "Copying root-level cluster setup files..."
|
|
||||||
for item in "$SOURCE_DIR"/*; do
|
|
||||||
if [ -f "$item" ]; then
|
|
||||||
item_name=$(basename "$item")
|
|
||||||
print_info " Copying: ${item_name}"
|
|
||||||
cp "$item" "$DEST_DIR/$item_name"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
print_success "Cluster setup files copied and compiled"
|
|
||||||
|
|
||||||
# Verify required configuration
|
|
||||||
print_info "Verifying service configuration..."
|
|
||||||
|
|
||||||
MISSING_CONFIG=()
|
|
||||||
|
|
||||||
# Check essential configuration values
|
|
||||||
if [ -z "$(wild-config cluster.name 2>/dev/null)" ]; then
|
|
||||||
MISSING_CONFIG+=("cluster.name")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$(wild-config cloud.domain 2>/dev/null)" ]; then
|
|
||||||
MISSING_CONFIG+=("cloud.domain")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$(wild-config cluster.ipAddressPool 2>/dev/null)" ]; then
|
|
||||||
MISSING_CONFIG+=("cluster.ipAddressPool")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$(wild-config operator.email 2>/dev/null)" ]; then
|
|
||||||
MISSING_CONFIG+=("operator.email")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#MISSING_CONFIG[@]} -gt 0 ]; then
|
|
||||||
print_warning "Some required configuration values are missing:"
|
|
||||||
for config in "${MISSING_CONFIG[@]}"; do
|
|
||||||
print_warning " - $config"
|
|
||||||
done
|
|
||||||
print_info "Run 'wild-setup' to complete the configuration"
|
|
||||||
fi
|
|
||||||
|
|
||||||
print_success "Cluster services setup generation completed!"
|
|
||||||
echo ""
|
|
||||||
print_info "Generated setup directory: $DEST_DIR"
|
|
||||||
echo ""
|
|
||||||
print_info "Available services:"
|
|
||||||
for service_dir in "$DEST_DIR"/*; do
|
|
||||||
if [ -d "$service_dir" ] && [ -f "$service_dir/install.sh" ]; then
|
|
||||||
service_name=$(basename "$service_dir")
|
|
||||||
print_info " - $service_name"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
print_info "Next steps:"
|
|
||||||
echo " 1. Review the generated configuration files in $DEST_DIR"
|
|
||||||
echo " 2. Make sure your cluster is running and kubectl is configured"
|
|
||||||
echo " 3. Install services with: wild-cluster-services-up"
|
|
||||||
echo " 4. Or install individual services by running their install.sh scripts"
|
|
||||||
|
|
||||||
print_success "Ready for cluster services installation!"
|
|
@@ -14,21 +14,15 @@ usage() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h, --help Show this help message"
|
echo " -h, --help Show this help message"
|
||||||
echo " --list List available services"
|
|
||||||
echo " --dry-run Show what would be installed without running"
|
echo " --dry-run Show what would be installed without running"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " wild-cluster-services-up # Install all services"
|
echo " wild-cluster-services-up # Install all services"
|
||||||
echo " wild-cluster-services-up metallb traefik # Install specific services"
|
echo " wild-cluster-services-up metallb traefik # Install specific services"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Available services (when setup files exist):"
|
echo "Available services:"
|
||||||
echo " metallb, longhorn, traefik, coredns, cert-manager,"
|
echo " metallb, longhorn, traefik, coredns, cert-manager,"
|
||||||
echo " externaldns, kubernetes-dashboard, nfs, docker-registry"
|
echo " externaldns, kubernetes-dashboard, nfs, docker-registry"
|
||||||
echo ""
|
|
||||||
echo "Requirements:"
|
|
||||||
echo " - Must be run from a wild-cloud directory"
|
|
||||||
echo " - Cluster services must be generated first (wild-cluster-services-generate)"
|
|
||||||
echo " - Kubernetes cluster must be running and kubectl configured"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
@@ -80,7 +74,7 @@ fi
|
|||||||
# CLUSTER SERVICES INSTALLATION
|
# CLUSTER SERVICES INSTALLATION
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
print_header "Cluster Services Installation"
|
print_header "Cluster services installation"
|
||||||
|
|
||||||
# Check kubectl connectivity
|
# Check kubectl connectivity
|
||||||
if [ "$DRY_RUN" = false ]; then
|
if [ "$DRY_RUN" = false ]; then
|
||||||
@@ -133,39 +127,8 @@ SOURCE_DIR="${WC_ROOT}/setup/cluster-services"
|
|||||||
|
|
||||||
for service in "${SERVICES_TO_INSTALL[@]}"; do
|
for service in "${SERVICES_TO_INSTALL[@]}"; do
|
||||||
echo ""
|
echo ""
|
||||||
print_header "Installing $service"
|
print_header "Installing $service"
|
||||||
|
|
||||||
# Copy templates
|
|
||||||
source_service_dir="$SOURCE_DIR/$service"
|
|
||||||
dest_service_dir="$CLUSTER_SETUP_DIR/$service"
|
|
||||||
|
|
||||||
print_info "Processing service: $service"
|
|
||||||
|
|
||||||
mkdir -p "$dest_service_dir"
|
|
||||||
|
|
||||||
# FIXME: Template compilation needs to be AFTER the configuration steps in the install.sh scripts!
|
|
||||||
for item in "$source_service_dir"/*; do
|
|
||||||
item_name=$(basename "$item")
|
|
||||||
if [ "$item_name" = "kustomize.template" ]; then
|
|
||||||
if [ -d "$item" ]; then
|
|
||||||
print_info " Compiling kustomize templates for $service"
|
|
||||||
wild-compile-template-dir --clean "$item" "$dest_service_dir/kustomize"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ -f "$item" ]; then
|
|
||||||
if grep -q "{{" "$item" 2>/dev/null; then
|
|
||||||
print_info " Compiling: ${item_name}"
|
|
||||||
wild-compile-template < "$item" > "$dest_service_dir/$item_name"
|
|
||||||
else
|
|
||||||
cp "$item" "$dest_service_dir/$item_name"
|
|
||||||
fi
|
|
||||||
elif [ -d "$item" ]; then
|
|
||||||
cp -r "$item" "$dest_service_dir/"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Run installation script.
|
|
||||||
if [ -f "./$service/install.sh" ]; then
|
if [ -f "./$service/install.sh" ]; then
|
||||||
print_info "Running $service installation..."
|
print_info "Running $service installation..."
|
||||||
if ./"$service"/install.sh; then
|
if ./"$service"/install.sh; then
|
||||||
@@ -185,7 +148,7 @@ cd - >/dev/null
|
|||||||
|
|
||||||
# Summary
|
# Summary
|
||||||
echo ""
|
echo ""
|
||||||
print_header "Installation Summary"
|
print_header "Installation summary"
|
||||||
print_success "Successfully installed: $INSTALLED_COUNT services"
|
print_success "Successfully installed: $INSTALLED_COUNT services"
|
||||||
if [ $FAILED_COUNT -gt 0 ]; then
|
if [ $FAILED_COUNT -gt 0 ]; then
|
||||||
print_warning "Failed to install: $FAILED_COUNT services"
|
print_warning "Failed to install: $FAILED_COUNT services"
|
||||||
|
@@ -80,8 +80,8 @@ if ! kubectl cluster-info >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate cluster services setup files
|
# Generate cluster services setup files
|
||||||
|
wild-cluster-services-fetch
|
||||||
wild-cluster-services-generate --force
|
wild-cluster-services-generate
|
||||||
|
|
||||||
# Apply cluster services to cluster
|
# Apply cluster services to cluster
|
||||||
|
|
||||||
|
@@ -9,11 +9,13 @@ Follow the instructions to [set up cluster nodes](./cluster-nodes/README.md).
|
|||||||
Set up cluster services:
|
Set up cluster services:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./setup/cluster/setup-all.sh
|
wild-cluster-services-fetch
|
||||||
|
wild-cluster-services-configure
|
||||||
|
wild-cluster-services-up
|
||||||
```
|
```
|
||||||
|
|
||||||
Now make sure everything works:
|
Now make sure everything works:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./setup/cluster/validate-setup.sh
|
wild-health
|
||||||
```
|
```
|
||||||
|
10
setup/cluster-services/cert-manager/configure.sh
Normal file
10
setup/cluster-services/cert-manager/configure.sh
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting cert-manager configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cloud.domain" "Enter main domain name" "example.com"
|
||||||
|
domain=$(wild-config "cloud.domain")
|
||||||
|
prompt_if_unset_config "cloud.internalDomain" "Enter internal domain name" "local.${domain}"
|
||||||
|
prompt_if_unset_config "operator.email" "Enter operator email address (for Let's Encrypt)" ""
|
||||||
|
prompt_if_unset_config "cluster.certManager.cloudflare.domain" "Enter Cloudflare domain (for DNS challenges)" "${domain}"
|
||||||
|
prompt_if_unset_secret "cloudflare.token" "Enter Cloudflare API token (for DNS challenges)" ""
|
@@ -16,21 +16,6 @@ CERT_MANAGER_DIR="${CLUSTER_SETUP_DIR}/cert-manager"
|
|||||||
|
|
||||||
print_header "Setting up cert-manager"
|
print_header "Setting up cert-manager"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting cert-manager configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cloud.domain" "Enter main domain name" "example.com"
|
|
||||||
|
|
||||||
# Get the domain value to use as default for internal domain
|
|
||||||
domain=$(wild-config "cloud.domain")
|
|
||||||
prompt_if_unset_config "cloud.internalDomain" "Enter internal domain name" "local.${domain}"
|
|
||||||
prompt_if_unset_config "operator.email" "Enter operator email address (for Let's Encrypt)" ""
|
|
||||||
prompt_if_unset_config "cluster.certManager.cloudflare.domain" "Enter Cloudflare domain (for DNS challenges)" "${domain}"
|
|
||||||
prompt_if_unset_secret "cloudflare.token" "Enter Cloudflare API token (for DNS challenges)" ""
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled cert-manager templates..."
|
echo "Using pre-compiled cert-manager templates..."
|
||||||
if [ ! -d "${CERT_MANAGER_DIR}/kustomize" ]; then
|
if [ ! -d "${CERT_MANAGER_DIR}/kustomize" ]; then
|
||||||
|
7
setup/cluster-services/coredns/configure.sh
Normal file
7
setup/cluster-services/coredns/configure.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting CoreDNS configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cloud.internalDomain" "Enter internal domain name" "local.example.com"
|
||||||
|
prompt_if_unset_config "cluster.loadBalancerIp" "Enter load balancer IP address" "192.168.1.240"
|
||||||
|
prompt_if_unset_config "cloud.dns.externalResolver" "Enter external DNS resolver" "8.8.8.8"
|
@@ -16,16 +16,6 @@ COREDNS_DIR="${CLUSTER_SETUP_DIR}/coredns"
|
|||||||
|
|
||||||
print_header "Setting up CoreDNS for k3s"
|
print_header "Setting up CoreDNS for k3s"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting CoreDNS configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cloud.internalDomain" "Enter internal domain name" "local.example.com"
|
|
||||||
prompt_if_unset_config "cluster.loadBalancerIp" "Enter load balancer IP address" "192.168.1.240"
|
|
||||||
prompt_if_unset_config "cloud.dns.externalResolver" "Enter external DNS resolver" "8.8.8.8"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled CoreDNS templates..."
|
echo "Using pre-compiled CoreDNS templates..."
|
||||||
if [ ! -d "${COREDNS_DIR}/kustomize" ]; then
|
if [ ! -d "${COREDNS_DIR}/kustomize" ]; then
|
||||||
|
6
setup/cluster-services/docker-registry/configure.sh
Normal file
6
setup/cluster-services/docker-registry/configure.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting Docker Registry configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cloud.dockerRegistryHost" "Enter Docker Registry hostname" "registry.local.example.com"
|
||||||
|
prompt_if_unset_config "cluster.dockerRegistry.storage" "Enter Docker Registry storage size" "100Gi"
|
@@ -16,15 +16,6 @@ DOCKER_REGISTRY_DIR="${CLUSTER_SETUP_DIR}/docker-registry"
|
|||||||
|
|
||||||
print_header "Setting up Docker Registry"
|
print_header "Setting up Docker Registry"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting Docker Registry configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cloud.dockerRegistryHost" "Enter Docker Registry hostname" "registry.local.example.com"
|
|
||||||
prompt_if_unset_config "cluster.dockerRegistry.storage" "Enter Docker Registry storage size" "100Gi"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled Docker Registry templates..."
|
echo "Using pre-compiled Docker Registry templates..."
|
||||||
if [ ! -d "${DOCKER_REGISTRY_DIR}/kustomize" ]; then
|
if [ ! -d "${DOCKER_REGISTRY_DIR}/kustomize" ]; then
|
||||||
|
3
setup/cluster-services/externaldns/configure.sh
Normal file
3
setup/cluster-services/externaldns/configure.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
print_info "Collecting ExternalDNS configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cluster.externalDns.ownerId" "Enter ExternalDNS owner ID (unique identifier for this cluster)" "wild-cloud-$(hostname -s)"
|
@@ -16,14 +16,6 @@ EXTERNALDNS_DIR="${CLUSTER_SETUP_DIR}/externaldns"
|
|||||||
|
|
||||||
print_header "Setting up ExternalDNS"
|
print_header "Setting up ExternalDNS"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting ExternalDNS configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cluster.externalDns.ownerId" "Enter ExternalDNS owner ID (unique identifier for this cluster)" "wild-cloud-$(hostname -s)"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled ExternalDNS templates..."
|
echo "Using pre-compiled ExternalDNS templates..."
|
||||||
if [ ! -d "${EXTERNALDNS_DIR}/kustomize" ]; then
|
if [ ! -d "${EXTERNALDNS_DIR}/kustomize" ]; then
|
||||||
|
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Navigate to script directory
|
|
||||||
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
|
|
||||||
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
|
||||||
cd "$SCRIPT_DIR"
|
|
||||||
|
|
||||||
echo "Setting up your wild-cloud cluster services..."
|
|
||||||
echo
|
|
||||||
|
|
||||||
./metallb/install.sh
|
|
||||||
./longhorn/install.sh
|
|
||||||
./traefik/install.sh
|
|
||||||
./coredns/install.sh
|
|
||||||
./cert-manager/install.sh
|
|
||||||
./externaldns/install.sh
|
|
||||||
./kubernetes-dashboard/install.sh
|
|
||||||
./nfs/install.sh
|
|
||||||
./docker-registry/install.sh
|
|
||||||
|
|
||||||
echo "Service setup complete!"
|
|
5
setup/cluster-services/kubernetes-dashboard/configure.sh
Normal file
5
setup/cluster-services/kubernetes-dashboard/configure.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting Kubernetes Dashboard configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cloud.internalDomain" "Enter internal domain name (for dashboard URL)" "local.example.com"
|
@@ -16,14 +16,6 @@ KUBERNETES_DASHBOARD_DIR="${CLUSTER_SETUP_DIR}/kubernetes-dashboard"
|
|||||||
|
|
||||||
print_header "Setting up Kubernetes Dashboard"
|
print_header "Setting up Kubernetes Dashboard"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting Kubernetes Dashboard configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cloud.internalDomain" "Enter internal domain name (for dashboard URL)" "local.example.com"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled Dashboard templates..."
|
echo "Using pre-compiled Dashboard templates..."
|
||||||
if [ ! -d "${KUBERNETES_DASHBOARD_DIR}/kustomize" ]; then
|
if [ ! -d "${KUBERNETES_DASHBOARD_DIR}/kustomize" ]; then
|
||||||
|
6
setup/cluster-services/metallb/configure.sh
Normal file
6
setup/cluster-services/metallb/configure.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting MetalLB configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cluster.ipAddressPool" "Enter IP address pool for MetalLB (CIDR format, e.g., 192.168.1.240-192.168.1.250)" "192.168.1.240-192.168.1.250"
|
||||||
|
prompt_if_unset_config "cluster.loadBalancerIp" "Enter load balancer IP address" "192.168.1.240"
|
@@ -16,15 +16,6 @@ METALLB_DIR="${CLUSTER_SETUP_DIR}/metallb"
|
|||||||
|
|
||||||
print_header "Setting up MetalLB"
|
print_header "Setting up MetalLB"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting MetalLB configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cluster.ipAddressPool" "Enter IP address pool for MetalLB (CIDR format, e.g., 192.168.1.240-192.168.1.250)" "192.168.1.240-192.168.1.250"
|
|
||||||
prompt_if_unset_config "cluster.loadBalancerIp" "Enter load balancer IP address" "192.168.1.240"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled MetalLB templates..."
|
echo "Using pre-compiled MetalLB templates..."
|
||||||
if [ ! -d "${METALLB_DIR}/kustomize" ]; then
|
if [ ! -d "${METALLB_DIR}/kustomize" ]; then
|
||||||
|
7
setup/cluster-services/nfs/configure.sh
Normal file
7
setup/cluster-services/nfs/configure.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting NFS configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cloud.nfs.host" "Enter NFS server hostname or IP address" "192.168.1.100"
|
||||||
|
prompt_if_unset_config "cloud.nfs.mediaPath" "Enter NFS export path for media storage" "/mnt/storage/media"
|
||||||
|
prompt_if_unset_config "cloud.nfs.storageCapacity" "Enter NFS storage capacity (e.g., 1Ti, 500Gi)" "1Ti"
|
@@ -16,16 +16,6 @@ NFS_DIR="${CLUSTER_SETUP_DIR}/nfs"
|
|||||||
|
|
||||||
print_header "Registering NFS server with Kubernetes cluster"
|
print_header "Registering NFS server with Kubernetes cluster"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting NFS configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cloud.nfs.host" "Enter NFS server hostname or IP address" "192.168.1.100"
|
|
||||||
prompt_if_unset_config "cloud.nfs.mediaPath" "Enter NFS export path for media storage" "/mnt/storage/media"
|
|
||||||
prompt_if_unset_config "cloud.nfs.storageCapacity" "Enter NFS storage capacity (e.g., 1Ti, 500Gi)" "1Ti"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Templates should already be compiled by wild-cluster-services-generate
|
# Templates should already be compiled by wild-cluster-services-generate
|
||||||
echo "Using pre-compiled NFS templates..."
|
echo "Using pre-compiled NFS templates..."
|
||||||
if [ ! -d "${NFS_DIR}/kustomize" ]; then
|
if [ ! -d "${NFS_DIR}/kustomize" ]; then
|
||||||
|
@@ -1,15 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Initialize Wild Cloud environment
|
|
||||||
if [ -z "${WC_ROOT}" ]; then
|
|
||||||
print "WC_ROOT is not set."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
source "${WC_ROOT}/scripts/common.sh"
|
|
||||||
init_wild_env
|
|
||||||
fi
|
|
||||||
|
|
||||||
print_header "Setting up SMTP Configuration"
|
print_header "Setting up SMTP Configuration"
|
||||||
|
|
||||||
@@ -19,7 +8,6 @@ echo ""
|
|||||||
|
|
||||||
# Collect SMTP configuration
|
# Collect SMTP configuration
|
||||||
print_info "Collecting SMTP configuration..."
|
print_info "Collecting SMTP configuration..."
|
||||||
|
|
||||||
prompt_if_unset_config "cloud.smtp.host" "Enter SMTP host (e.g., email-smtp.us-east-2.amazonaws.com for AWS SES)" ""
|
prompt_if_unset_config "cloud.smtp.host" "Enter SMTP host (e.g., email-smtp.us-east-2.amazonaws.com for AWS SES)" ""
|
||||||
prompt_if_unset_config "cloud.smtp.port" "Enter SMTP port (usually 465 for SSL, 587 for STARTTLS)" "465"
|
prompt_if_unset_config "cloud.smtp.port" "Enter SMTP port (usually 465 for SSL, 587 for STARTTLS)" "465"
|
||||||
prompt_if_unset_config "cloud.smtp.user" "Enter SMTP username/access key" ""
|
prompt_if_unset_config "cloud.smtp.user" "Enter SMTP username/access key" ""
|
||||||
@@ -47,7 +35,3 @@ echo " User: $(wild-config cloud.smtp.user)"
|
|||||||
echo " From: $(wild-config cloud.smtp.from)"
|
echo " From: $(wild-config cloud.smtp.from)"
|
||||||
echo " Password: $(wild-secret cloud.smtp.password >/dev/null 2>&1 && echo "✓ Set" || echo "✗ Not set")"
|
echo " Password: $(wild-secret cloud.smtp.password >/dev/null 2>&1 && echo "✓ Set" || echo "✗ Not set")"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Applications that use SMTP: ghost, gitea, and others"
|
|
||||||
echo ""
|
|
||||||
echo "To test SMTP configuration, deploy an app that uses email (like Ghost)"
|
|
||||||
echo "and try the password reset or user invitation features."
|
|
5
setup/cluster-services/traefik/configure.sh
Normal file
5
setup/cluster-services/traefik/configure.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
print_info "Collecting Traefik configuration..."
|
||||||
|
|
||||||
|
prompt_if_unset_config "cluster.loadBalancerIp" "Enter load balancer IP address for Traefik" "192.168.1.240"
|
@@ -16,14 +16,6 @@ TRAEFIK_DIR="${CLUSTER_SETUP_DIR}/traefik"
|
|||||||
|
|
||||||
print_header "Setting up Traefik ingress controller"
|
print_header "Setting up Traefik ingress controller"
|
||||||
|
|
||||||
# Collect required configuration variables
|
|
||||||
print_info "Collecting Traefik configuration..."
|
|
||||||
|
|
||||||
# Prompt for configuration using helper functions
|
|
||||||
prompt_if_unset_config "cluster.loadBalancerIp" "Enter load balancer IP address for Traefik" "192.168.1.240"
|
|
||||||
|
|
||||||
print_success "Configuration collected successfully"
|
|
||||||
|
|
||||||
# Install required CRDs first
|
# Install required CRDs first
|
||||||
echo "Installing Gateway API CRDs..."
|
echo "Installing Gateway API CRDs..."
|
||||||
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
|
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.0.0/standard-install.yaml
|
||||||
|
Reference in New Issue
Block a user