# Azure Kubernetes Node Addition Configuration Template
# Copy this file to node_config.env and update the values

# =============================================================================
# VM Configuration
# =============================================================================

# VM Name (as it appears in Azure)
VM_NAME="prod-usw2-k8s-freeleaps-worker-nodes-06"

# Azure Resource Group containing the VM
RESOURCE_GROUP="k8s"

# Node Type: worker or master
NODE_TYPE="worker"

# =============================================================================
# Authentication Configuration
# =============================================================================

# Ansible user for SSH connections
# Note: This should be wwwadmin@mathmast.com for your environment
ANSIBLE_USER="wwwadmin@mathmast.com"

# SSH Password (will be prompted during execution)
# Leave empty to be prompted during script execution
SSH_PASSWORD=""

# Sudo Password (will be prompted during execution)
# Leave empty to be prompted during script execution
SUDO_PASSWORD=""

# =============================================================================
# Network Configuration
# =============================================================================

# VM Private IP Address (will be auto-detected if left empty)
# Leave empty to auto-detect from Azure
VM_PRIVATE_IP=""

# Network Security Group name (for troubleshooting)
NSG_NAME="k8s-nsg"

# Subnet name (for troubleshooting)
SUBNET_NAME="k8s-subnet"

# =============================================================================
# Kubernetes Configuration
# =============================================================================

# Kubernetes cluster name
CLUSTER_NAME="freeleaps"

# Kubernetes version (should match existing cluster)
KUBERNETES_VERSION="1.31.4"

# Container runtime (should match existing cluster)
CONTAINER_RUNTIME="docker"

# =============================================================================
# Paths and Directories
# =============================================================================

# Path to inventory file
INVENTORY_FILE="freeleaps-ops/cluster/ansible/manifests/inventory.ini"

# Path to kubespray directory
KUBESPRAY_DIR="freeleaps-ops/3rd/kubespray"

# Path to group_vars directory
GROUP_VARS_DIR="freeleaps-ops/cluster/ansible/manifests/group_vars"

# =============================================================================
# Script Behavior Configuration
# =============================================================================

# Enable verbose output (true/false)
VERBOSE="false"

# Enable dry run mode (true/false)
# When enabled, script will show what it would do without making changes
DRY_RUN="false"

# Maximum wait time for node to appear (seconds)
MAX_WAIT_TIME="300"

# Maximum wait time for node to be ready (seconds)
MAX_READY_WAIT_TIME="600"

# =============================================================================
# Backup and Recovery Configuration
# =============================================================================

# Enable automatic backup of inventory file (true/false)
ENABLE_BACKUP="true"

# Number of backup files to keep
BACKUP_RETENTION="5"

# Backup directory
BACKUP_DIR="./backups"

# =============================================================================
# Monitoring and Alerting Configuration
# =============================================================================

# Enable post-addition health checks (true/false)
ENABLE_HEALTH_CHECKS="true"

# Enable pod scheduling test (true/false)
ENABLE_POD_TEST="true"

# Test pod image
TEST_POD_IMAGE="nginx:latest"

# =============================================================================
# Troubleshooting Configuration
# =============================================================================

# Enable detailed logging (true/false)
ENABLE_LOGGING="true"

# Log file path
LOG_FILE="./node_addition.log"

# Enable SSH connection testing (true/false)
ENABLE_SSH_TEST="true"

# SSH timeout (seconds)
SSH_TIMEOUT="10"

# =============================================================================
# Advanced Configuration
# =============================================================================

# Ansible playbook timeout (seconds)
ANSIBLE_TIMEOUT="3600"

# Kubectl timeout (seconds)
KUBECTL_TIMEOUT="300"

# Azure CLI timeout (seconds)
AZURE_TIMEOUT="300"

# =============================================================================
# Validation Rules
# =============================================================================

# Allowed node types
ALLOWED_NODE_TYPES="worker,master"

# Required VM name pattern
VM_NAME_PATTERN="^[a-zA-Z0-9-]+$"

# Required resource group pattern
RESOURCE_GROUP_PATTERN="^[a-zA-Z0-9-]+$"

# =============================================================================
# Notes and Instructions
# =============================================================================

# IMPORTANT NOTES:
# 1. This template should be copied to node_config.env before use
# 2. Update the values according to your environment
# 3. Passwords will be prompted during execution for security
# 4. The script will create backups automatically
# 5. All paths are relative to the script execution directory

# USAGE:
# 1. Copy this template: cp node_config.env.template node_config.env
# 2. Edit the configuration: vim node_config.env
# 3. Run the script: ./add_k8s_node.sh

# SECURITY NOTES:
# - Never commit passwords to version control
# - Use SSH keys when possible
# - Regularly rotate passwords
# - Monitor access logs

# TROUBLESHOOTING:
# - Check VM power state in Azure
# - Verify network security group rules
# - Ensure SSH service is running on VM
# - Check firewall rules if applicable
# - Verify DNS resolution

# SUPPORT:
# - Infrastructure Team: [Contact Information]
# - Kubernetes Administrators: [Contact Information]
# - Azure Support: [Contact Information]
