Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Some checks failed
Test / test (push) Has been cancelled
Some checks failed
Test / test (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
169
scripts/azure-arc/onboard-proxmox-hosts.sh
Executable file
169
scripts/azure-arc/onboard-proxmox-hosts.sh
Executable file
@@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
source ~/.bashrc
|
||||
# Azure Arc Onboarding Script for Proxmox Hosts
|
||||
# Installs Azure Connected Machine Agent and connects Proxmox nodes to Azure
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Azure configuration (set via environment variables)
|
||||
RESOURCE_GROUP="${RESOURCE_GROUP:-HC-Stack}"
|
||||
TENANT_ID="${TENANT_ID:-}"
|
||||
LOCATION="${LOCATION:-eastus}"
|
||||
SUBSCRIPTION_ID="${SUBSCRIPTION_ID:-}"
|
||||
CLOUD="${CLOUD:-AzureCloud}"
|
||||
TAGS="${TAGS:-type=proxmox}"
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
check_root() {
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
log_error "Please run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
validate_config() {
|
||||
if [ -z "$TENANT_ID" ] || [ -z "$SUBSCRIPTION_ID" ] || [ -z "$RESOURCE_GROUP" ]; then
|
||||
log_error "Required Azure configuration missing"
|
||||
log_info "Required environment variables:"
|
||||
log_info " TENANT_ID - Azure tenant ID"
|
||||
log_info " SUBSCRIPTION_ID - Azure subscription ID"
|
||||
log_info " RESOURCE_GROUP - Azure resource group name"
|
||||
log_info " LOCATION - Azure region (default: eastus)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_azure_cli() {
|
||||
if ! command -v az &> /dev/null; then
|
||||
log_error "Azure CLI not found. Please install it first:"
|
||||
log_info " curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! az account show &>/dev/null; then
|
||||
log_error "Azure CLI not authenticated. Please run: az login"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_arc_agent() {
|
||||
log_info "Installing Azure Connected Machine Agent..."
|
||||
|
||||
# Check if already installed
|
||||
if command -v azcmagent &> /dev/null; then
|
||||
log_warn "Azure Arc agent already installed"
|
||||
azcmagent version
|
||||
return
|
||||
fi
|
||||
|
||||
# Download and install agent
|
||||
log_info "Downloading Azure Arc agent installer..."
|
||||
wget -q https://aka.ms/azcmagent -O /tmp/install_linux_azcmagent.sh
|
||||
chmod +x /tmp/install_linux_azcmagent.sh
|
||||
|
||||
log_info "Running installer..."
|
||||
/tmp/install_linux_azcmagent.sh
|
||||
|
||||
# Verify installation
|
||||
if command -v azcmagent &> /dev/null; then
|
||||
log_info "Azure Arc agent installed successfully"
|
||||
azcmagent version
|
||||
else
|
||||
log_error "Failed to install Azure Arc agent"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
connect_to_azure() {
|
||||
log_info "Connecting machine to Azure Arc..."
|
||||
|
||||
# Check if already connected
|
||||
if azcmagent show &>/dev/null; then
|
||||
log_warn "Machine already connected to Azure Arc"
|
||||
azcmagent show
|
||||
read -p "Reconnect? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
return
|
||||
fi
|
||||
azcmagent disconnect --force-local-only
|
||||
fi
|
||||
|
||||
# Connect to Azure
|
||||
log_info "Connecting to Azure..."
|
||||
log_info " Resource Group: $RESOURCE_GROUP"
|
||||
log_info " Location: $LOCATION"
|
||||
log_info " Subscription: $SUBSCRIPTION_ID"
|
||||
|
||||
azcmagent connect \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--tenant-id "$TENANT_ID" \
|
||||
--location "$LOCATION" \
|
||||
--subscription-id "$SUBSCRIPTION_ID" \
|
||||
--cloud "$CLOUD" \
|
||||
--tags "$TAGS" \
|
||||
--correlation-id "proxmox-onboarding-$(date +%s)"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_info "Successfully connected to Azure Arc"
|
||||
else
|
||||
log_error "Failed to connect to Azure Arc"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
verify_connection() {
|
||||
log_info "Verifying Azure Arc connection..."
|
||||
|
||||
# Show agent status
|
||||
azcmagent show
|
||||
|
||||
# Verify in Azure Portal (via Azure CLI)
|
||||
log_info "Verifying registration in Azure..."
|
||||
MACHINE_NAME=$(hostname)
|
||||
|
||||
if az connectedmachine show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$MACHINE_NAME" &>/dev/null; then
|
||||
log_info "Machine found in Azure Portal"
|
||||
az connectedmachine show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$MACHINE_NAME" \
|
||||
--query "{name:name, location:location, status:status}" -o table
|
||||
else
|
||||
log_warn "Machine not yet visible in Azure Portal (may take a few minutes)"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
log_info "Starting Azure Arc onboarding for Proxmox host..."
|
||||
check_root
|
||||
validate_config
|
||||
check_azure_cli
|
||||
install_arc_agent
|
||||
connect_to_azure
|
||||
verify_connection
|
||||
log_info "Azure Arc onboarding completed successfully!"
|
||||
log_info "View your machine in Azure Portal:"
|
||||
log_info " https://portal.azure.com/#view/Microsoft_Azure_HybridCompute/MachinesBlade"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
205
scripts/azure-arc/onboard-vms.sh
Executable file
205
scripts/azure-arc/onboard-vms.sh
Executable file
@@ -0,0 +1,205 @@
|
||||
#!/bin/bash
|
||||
source ~/.bashrc
|
||||
# Azure Arc Onboarding Script for Proxmox VMs
|
||||
# Onboards VMs running inside Proxmox to Azure Arc
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Azure configuration
|
||||
RESOURCE_GROUP="${RESOURCE_GROUP:-HC-Stack}"
|
||||
TENANT_ID="${TENANT_ID:-}"
|
||||
LOCATION="${LOCATION:-eastus}"
|
||||
SUBSCRIPTION_ID="${SUBSCRIPTION_ID:-}"
|
||||
CLOUD="${CLOUD:-AzureCloud}"
|
||||
VM_TAGS="${VM_TAGS:-type=proxmox-vm,environment=hybrid}"
|
||||
|
||||
# VM configuration
|
||||
VM_IP="${VM_IP:-}"
|
||||
VM_USER="${VM_USER:-root}"
|
||||
SSH_KEY="${SSH_KEY:-}"
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
validate_config() {
|
||||
if [ -z "$TENANT_ID" ] || [ -z "$SUBSCRIPTION_ID" ] || [ -z "$RESOURCE_GROUP" ]; then
|
||||
log_error "Required Azure configuration missing"
|
||||
log_info "Required environment variables:"
|
||||
log_info " TENANT_ID, SUBSCRIPTION_ID, RESOURCE_GROUP"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$VM_IP" ]; then
|
||||
log_error "VM_IP must be set"
|
||||
log_info "Usage: VM_IP=192.168.1.188 VM_USER=ubuntu ./onboard-vms.sh"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_connectivity() {
|
||||
log_info "Checking connectivity to VM: $VM_IP"
|
||||
|
||||
if ! ping -c 1 -W 2 "$VM_IP" &> /dev/null; then
|
||||
log_error "Cannot reach VM at $VM_IP"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "VM is reachable"
|
||||
}
|
||||
|
||||
detect_os() {
|
||||
log_info "Detecting VM operating system..."
|
||||
|
||||
if [ -n "$SSH_KEY" ]; then
|
||||
SSH_CMD="ssh -i $SSH_KEY -o StrictHostKeyChecking=no $VM_USER@$VM_IP"
|
||||
else
|
||||
SSH_CMD="ssh -o StrictHostKeyChecking=no $VM_USER@$VM_IP"
|
||||
fi
|
||||
|
||||
OS_TYPE=$($SSH_CMD "cat /etc/os-release | grep '^ID=' | cut -d'=' -f2 | tr -d '\"' || echo 'unknown'")
|
||||
|
||||
log_info "Detected OS: $OS_TYPE"
|
||||
echo "$OS_TYPE"
|
||||
}
|
||||
|
||||
install_arc_agent_remote() {
|
||||
local os_type=$1
|
||||
log_info "Installing Azure Arc agent on VM..."
|
||||
|
||||
# Create installation script
|
||||
cat > /tmp/install_arc_agent.sh <<'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check if already installed
|
||||
if command -v azcmagent &> /dev/null; then
|
||||
echo "Azure Arc agent already installed"
|
||||
azcmagent version
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Download and install
|
||||
wget -q https://aka.ms/azcmagent -O /tmp/install_linux_azcmagent.sh
|
||||
chmod +x /tmp/install_linux_azcmagent.sh
|
||||
sudo /tmp/install_linux_azcmagent.sh
|
||||
|
||||
# Verify
|
||||
if command -v azcmagent &> /dev/null; then
|
||||
echo "Azure Arc agent installed successfully"
|
||||
azcmagent version
|
||||
else
|
||||
echo "Failed to install Azure Arc agent"
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
|
||||
# Copy and execute on remote VM
|
||||
if [ -n "$SSH_KEY" ]; then
|
||||
scp -i "$SSH_KEY" -o StrictHostKeyChecking=no /tmp/install_arc_agent.sh "$VM_USER@$VM_IP:/tmp/"
|
||||
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no "$VM_USER@$VM_IP" "chmod +x /tmp/install_arc_agent.sh && sudo /tmp/install_arc_agent.sh"
|
||||
else
|
||||
scp -o StrictHostKeyChecking=no /tmp/install_arc_agent.sh "$VM_USER@$VM_IP:/tmp/"
|
||||
ssh -o StrictHostKeyChecking=no "$VM_USER@$VM_IP" "chmod +x /tmp/install_arc_agent.sh && sudo /tmp/install_arc_agent.sh"
|
||||
fi
|
||||
|
||||
log_info "Azure Arc agent installed on VM"
|
||||
}
|
||||
|
||||
connect_vm_to_azure() {
|
||||
log_info "Connecting VM to Azure Arc..."
|
||||
|
||||
# Create connection script
|
||||
cat > /tmp/connect_arc.sh <<EOF
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Check if already connected
|
||||
if sudo azcmagent show &>/dev/null; then
|
||||
echo "VM already connected to Azure Arc"
|
||||
sudo azcmagent show
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Connect
|
||||
sudo azcmagent connect \\
|
||||
--resource-group "$RESOURCE_GROUP" \\
|
||||
--tenant-id "$TENANT_ID" \\
|
||||
--location "$LOCATION" \\
|
||||
--subscription-id "$SUBSCRIPTION_ID" \\
|
||||
--cloud "$CLOUD" \\
|
||||
--tags "$VM_TAGS" \\
|
||||
--correlation-id "proxmox-vm-onboarding-\$(date +%s)"
|
||||
|
||||
if [ \$? -eq 0 ]; then
|
||||
echo "Successfully connected to Azure Arc"
|
||||
sudo azcmagent show
|
||||
else
|
||||
echo "Failed to connect to Azure Arc"
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
|
||||
# Copy and execute on remote VM
|
||||
if [ -n "$SSH_KEY" ]; then
|
||||
scp -i "$SSH_KEY" -o StrictHostKeyChecking=no /tmp/connect_arc.sh "$VM_USER@$VM_IP:/tmp/"
|
||||
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no "$VM_USER@$VM_IP" "chmod +x /tmp/connect_arc.sh && /tmp/connect_arc.sh"
|
||||
else
|
||||
scp -o StrictHostKeyChecking=no /tmp/connect_arc.sh "$VM_USER@$VM_IP:/tmp/"
|
||||
ssh -o StrictHostKeyChecking=no "$VM_USER@$VM_IP" "chmod +x /tmp/connect_arc.sh && /tmp/connect_arc.sh"
|
||||
fi
|
||||
|
||||
log_info "VM connected to Azure Arc"
|
||||
}
|
||||
|
||||
verify_vm_connection() {
|
||||
log_info "Verifying VM connection in Azure..."
|
||||
|
||||
VM_HOSTNAME=$($SSH_CMD "hostname" 2>/dev/null || echo "unknown")
|
||||
|
||||
if command -v az &> /dev/null; then
|
||||
if az connectedmachine show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$VM_HOSTNAME" &>/dev/null; then
|
||||
log_info "VM found in Azure Portal"
|
||||
az connectedmachine show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$VM_HOSTNAME" \
|
||||
--query "{name:name, location:location, status:status}" -o table
|
||||
else
|
||||
log_warn "VM not yet visible in Azure Portal (may take a few minutes)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
log_info "Starting Azure Arc onboarding for Proxmox VM..."
|
||||
validate_config
|
||||
check_connectivity
|
||||
|
||||
OS_TYPE=$(detect_os)
|
||||
install_arc_agent_remote "$OS_TYPE"
|
||||
connect_vm_to_azure
|
||||
verify_vm_connection
|
||||
|
||||
log_info "VM onboarding completed successfully!"
|
||||
log_info "View your VMs in Azure Portal:"
|
||||
log_info " https://portal.azure.com/#view/Microsoft_Azure_HybridCompute/MachinesBlade"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
209
scripts/azure-arc/resource-bridge-setup.sh
Executable file
209
scripts/azure-arc/resource-bridge-setup.sh
Executable file
@@ -0,0 +1,209 @@
|
||||
#!/bin/bash
|
||||
source ~/.bashrc
|
||||
# Azure Arc Resource Bridge Setup Script
|
||||
# Deploys Azure Arc Resource Bridge for Proxmox VM lifecycle management
|
||||
# This uses a K3s-based approach for the Resource Bridge
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Azure configuration
|
||||
RESOURCE_GROUP="${RESOURCE_GROUP:-HC-Stack}"
|
||||
TENANT_ID="${TENANT_ID:-}"
|
||||
LOCATION="${LOCATION:-eastus}"
|
||||
SUBSCRIPTION_ID="${SUBSCRIPTION_ID:-}"
|
||||
CLUSTER_NAME="${CLUSTER_NAME:-proxmox-arc-bridge}"
|
||||
|
||||
# K3s configuration
|
||||
K3S_NODE_IP="${K3S_NODE_IP:-}"
|
||||
K3S_USER="${K3S_USER:-root}"
|
||||
SSH_KEY="${SSH_KEY:-}"
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
validate_config() {
|
||||
if [ -z "$TENANT_ID" ] || [ -z "$SUBSCRIPTION_ID" ] || [ -z "$RESOURCE_GROUP" ]; then
|
||||
log_error "Required Azure configuration missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$K3S_NODE_IP" ]; then
|
||||
log_error "K3S_NODE_IP must be set (IP of node where K3s will run)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v az &> /dev/null; then
|
||||
log_error "Azure CLI not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v kubectl &> /dev/null; then
|
||||
log_error "kubectl not found"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_k3s_installed() {
|
||||
log_info "Checking K3s installation on $K3S_NODE_IP..."
|
||||
|
||||
if [ -n "$SSH_KEY" ]; then
|
||||
SSH_CMD="ssh -i $SSH_KEY -o StrictHostKeyChecking=no $K3S_USER@$K3S_NODE_IP"
|
||||
else
|
||||
SSH_CMD="ssh -o StrictHostKeyChecking=no $K3S_USER@$K3S_NODE_IP"
|
||||
fi
|
||||
|
||||
if $SSH_CMD "command -v k3s &>/dev/null"; then
|
||||
log_info "K3s is installed"
|
||||
$SSH_CMD "k3s --version"
|
||||
return 0
|
||||
else
|
||||
log_warn "K3s not found. Please install K3s first using k3s-install.sh"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_k3s_kubeconfig() {
|
||||
log_info "Retrieving K3s kubeconfig..."
|
||||
|
||||
# Get kubeconfig from remote K3s node
|
||||
if [ -n "$SSH_KEY" ]; then
|
||||
ssh -i "$SSH_KEY" -o StrictHostKeyChecking=no "$K3S_USER@$K3S_NODE_IP" \
|
||||
"sudo cat /etc/rancher/k3s/k3s.yaml" > /tmp/k3s-kubeconfig.yaml
|
||||
else
|
||||
ssh -o StrictHostKeyChecking=no "$K3S_USER@$K3S_NODE_IP" \
|
||||
"sudo cat /etc/rancher/k3s/k3s.yaml" > /tmp/k3s-kubeconfig.yaml
|
||||
fi
|
||||
|
||||
# Update server URL to use node IP
|
||||
sed -i "s/127.0.0.1/$K3S_NODE_IP/g" /tmp/k3s-kubeconfig.yaml
|
||||
|
||||
export KUBECONFIG=/tmp/k3s-kubeconfig.yaml
|
||||
|
||||
# Verify connection
|
||||
if kubectl cluster-info &>/dev/null; then
|
||||
log_info "Successfully connected to K3s cluster"
|
||||
kubectl get nodes
|
||||
else
|
||||
log_error "Failed to connect to K3s cluster"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
onboard_k8s_to_arc() {
|
||||
log_info "Onboarding Kubernetes cluster to Azure Arc..."
|
||||
|
||||
# Check if already onboarded
|
||||
if az arc kubernetes show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$CLUSTER_NAME" &>/dev/null; then
|
||||
log_warn "Cluster already onboarded to Azure Arc"
|
||||
return
|
||||
fi
|
||||
|
||||
# Install Azure Arc extensions for Kubernetes
|
||||
log_info "Installing Azure Arc extensions..."
|
||||
az extension add --name connectedk8s --upgrade || true
|
||||
az extension add --name k8s-extension --upgrade || true
|
||||
|
||||
# Connect cluster to Azure Arc
|
||||
log_info "Connecting cluster to Azure Arc..."
|
||||
az connectedk8s connect \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$CLUSTER_NAME" \
|
||||
--location "$LOCATION" \
|
||||
--tags "type=proxmox-resource-bridge"
|
||||
|
||||
log_info "Waiting for cluster to be connected..."
|
||||
sleep 30
|
||||
|
||||
# Verify connection
|
||||
if az arc kubernetes show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$CLUSTER_NAME" \
|
||||
--query "connectivityStatus" -o tsv | grep -q "Connected"; then
|
||||
log_info "Cluster successfully connected to Azure Arc"
|
||||
else
|
||||
log_error "Cluster connection failed or still pending"
|
||||
log_info "Check status: az arc kubernetes show -g $RESOURCE_GROUP -n $CLUSTER_NAME"
|
||||
fi
|
||||
}
|
||||
|
||||
install_gitops_extension() {
|
||||
log_info "Installing GitOps extension for Azure Arc Kubernetes..."
|
||||
|
||||
# Install GitOps extension
|
||||
az k8s-extension create \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--cluster-name "$CLUSTER_NAME" \
|
||||
--cluster-type connectedClusters \
|
||||
--extension-type microsoft.flux \
|
||||
--name flux \
|
||||
--scope cluster \
|
||||
--release-namespace flux-system
|
||||
|
||||
log_info "GitOps extension installed"
|
||||
log_info "This may take a few minutes to complete. Check status with:"
|
||||
log_info " az k8s-extension show -g $RESOURCE_GROUP -c $CLUSTER_NAME -t connectedClusters -n flux"
|
||||
}
|
||||
|
||||
create_custom_location() {
|
||||
log_info "Creating custom location for Resource Bridge..."
|
||||
|
||||
CUSTOM_LOCATION_NAME="${CLUSTER_NAME}-location"
|
||||
|
||||
# Get cluster ID
|
||||
CLUSTER_ID=$(az arc kubernetes show \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$CLUSTER_NAME" \
|
||||
--query "id" -o tsv)
|
||||
|
||||
# Create custom location
|
||||
az customlocation create \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--name "$CUSTOM_LOCATION_NAME" \
|
||||
--host-resource-id "$CLUSTER_ID" \
|
||||
--namespace arc-resource-bridge \
|
||||
--location "$LOCATION"
|
||||
|
||||
log_info "Custom location created: $CUSTOM_LOCATION_NAME"
|
||||
}
|
||||
|
||||
main() {
|
||||
log_info "Starting Azure Arc Resource Bridge setup..."
|
||||
validate_config
|
||||
|
||||
if ! check_k3s_installed; then
|
||||
log_error "K3s must be installed first. Run k3s-install.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_k3s_kubeconfig
|
||||
onboard_k8s_to_arc
|
||||
install_gitops_extension
|
||||
create_custom_location
|
||||
|
||||
log_info "Azure Arc Resource Bridge setup completed!"
|
||||
log_info "Next steps:"
|
||||
log_info " 1. Configure Proxmox custom provider for VM lifecycle control"
|
||||
log_info " 2. Set up GitOps repository for declarative deployments"
|
||||
log_info " 3. View cluster in Azure Portal:"
|
||||
log_info " https://portal.azure.com/#view/Microsoft_Azure_HybridCompute/KubernetesBlade"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user