Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped
Co-authored-by: Cursor <cursoragent@cursor.com>
161 lines
6.0 KiB
Bash
Executable File
161 lines
6.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Update all VM template files to match current Kubernetes configurations
|
|
|
|
set -euo pipefail
|
|
|
|
TEMPLATE_DIR="examples/production"
|
|
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo " UPDATE ALL VM TEMPLATE FILES"
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
|
|
# Function to create/update a VM template file
|
|
update_vm_template() {
|
|
local vm_name=$1
|
|
local namespace=$2
|
|
local node=$3
|
|
local cpu=$4
|
|
local memory=$5
|
|
local disk=$6
|
|
local storage=$7
|
|
local image=$8
|
|
local network=$9
|
|
local site=${10}
|
|
local file_path=$11
|
|
|
|
# Ensure directory exists
|
|
mkdir -p "$(dirname "$file_path")"
|
|
|
|
# Create/update the template file
|
|
cat > "$file_path" <<EOF
|
|
apiVersion: proxmox.sankofa.nexus/v1alpha1
|
|
kind: ProxmoxVM
|
|
metadata:
|
|
name: $vm_name
|
|
namespace: $namespace
|
|
spec:
|
|
forProvider:
|
|
node: $node
|
|
name: $vm_name
|
|
cpu: $cpu
|
|
memory: $memory
|
|
disk: $disk
|
|
storage: $storage
|
|
network: $network
|
|
image: $image
|
|
site: $site
|
|
EOF
|
|
|
|
echo " ✅ Updated: $file_path"
|
|
}
|
|
|
|
# Get all VM configurations from Kubernetes
|
|
echo "Step 1: Fetching VM configurations from Kubernetes..."
|
|
VM_CONFIGS=$(kubectl get proxmoxvms -A -o json 2>/dev/null | jq -r '.items[] |
|
|
select(.spec.forProvider.node == "r630-01" or .spec.forProvider.node == "ml110-01") |
|
|
"\(.metadata.namespace)|\(.metadata.name)|\(.spec.forProvider.node)|\(.spec.forProvider.cpu)|\(.spec.forProvider.memory)|\(.spec.forProvider.disk)|\(.spec.forProvider.storage)|\(.spec.forProvider.image)|\(.spec.forProvider.network)|\(.spec.forProvider.site)"' | sort)
|
|
|
|
echo "Found $(echo "$VM_CONFIGS" | wc -l) VMs to update"
|
|
echo ""
|
|
|
|
# Update SMOM-DBIS-138 VMs
|
|
echo "Step 2: Updating SMOM-DBIS-138 VM templates..."
|
|
while IFS='|' read -r namespace name node cpu memory disk storage image network site; do
|
|
if [[ "$name" =~ ^(smom-validator|smom-sentry|rpc-node|smom-services|smom-blockscout|monitoring|management)$ ]]; then
|
|
# Map Kubernetes names to template file names
|
|
case "$name" in
|
|
smom-validator-*)
|
|
file_name="validator-${name##smom-validator-}.yaml"
|
|
;;
|
|
smom-sentry-*)
|
|
file_name="sentry-${name##smom-sentry-}.yaml"
|
|
;;
|
|
rpc-node-*)
|
|
file_name="rpc-node-${name##rpc-node-}.yaml"
|
|
;;
|
|
smom-services)
|
|
file_name="services.yaml"
|
|
;;
|
|
smom-blockscout)
|
|
file_name="blockscout.yaml"
|
|
;;
|
|
monitoring)
|
|
file_name="monitoring.yaml"
|
|
;;
|
|
management)
|
|
file_name="management.yaml"
|
|
;;
|
|
*)
|
|
continue
|
|
;;
|
|
esac
|
|
|
|
file_path="$TEMPLATE_DIR/smom-dbis-138/$file_name"
|
|
update_vm_template "$name" "$namespace" "$node" "$cpu" "$memory" "$disk" "$storage" "$image" "$network" "$site" "$file_path"
|
|
fi
|
|
done <<< "$VM_CONFIGS"
|
|
echo ""
|
|
|
|
# Update Phoenix VMs
|
|
echo "Step 3: Updating Phoenix VM templates..."
|
|
while IFS='|' read -r namespace name node cpu memory disk storage image network site; do
|
|
if [[ "$name" =~ ^phoenix- ]]; then
|
|
# Map Kubernetes names to template file names
|
|
file_name="${name##phoenix-}.yaml"
|
|
file_path="$TEMPLATE_DIR/phoenix/$file_name"
|
|
update_vm_template "$name" "$namespace" "$node" "$cpu" "$memory" "$disk" "$storage" "$image" "$network" "$site" "$file_path"
|
|
fi
|
|
done <<< "$VM_CONFIGS"
|
|
echo ""
|
|
|
|
# Update other production VMs
|
|
echo "Step 4: Updating other production VM templates..."
|
|
while IFS='|' read -r namespace name node cpu memory disk storage image network site; do
|
|
# Skip SMOM and Phoenix VMs (already handled)
|
|
if [[ "$name" =~ ^(smom-|phoenix-|rpc-node|monitoring|management)$ ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Skip example/template VMs that aren't meant for production
|
|
if [[ "$name" =~ ^(basic-vm-001|large-vm-001|medium-vm-001|vm-100)$ ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Map to template file names
|
|
case "$name" in
|
|
nginx-proxy-vm)
|
|
file_name="nginx-proxy-vm.yaml"
|
|
;;
|
|
cloudflare-tunnel-vm)
|
|
file_name="cloudflare-tunnel-vm.yaml"
|
|
;;
|
|
*)
|
|
# Use name as-is for other VMs
|
|
file_name="${name}.yaml"
|
|
;;
|
|
esac
|
|
|
|
file_path="$TEMPLATE_DIR/$file_name"
|
|
update_vm_template "$name" "$namespace" "$node" "$cpu" "$memory" "$disk" "$storage" "$image" "$network" "$site" "$file_path"
|
|
done <<< "$VM_CONFIGS"
|
|
echo ""
|
|
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo " SUMMARY"
|
|
echo "═══════════════════════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "✅ All VM template files updated!"
|
|
echo ""
|
|
echo "📝 Updated templates:"
|
|
echo " - SMOM-DBIS-138 VMs: $(find $TEMPLATE_DIR/smom-dbis-138 -name "*.yaml" | wc -l) files"
|
|
echo " - Phoenix VMs: $(find $TEMPLATE_DIR/phoenix -name "*.yaml" | wc -l) files"
|
|
echo " - Other production VMs: $(find $TEMPLATE_DIR -maxdepth 1 -name "*.yaml" | wc -l) files"
|
|
echo ""
|
|
echo "All templates now use:"
|
|
echo " - Storage: local-lvm"
|
|
echo " - Image: 9000 (template) or local:iso/ubuntu-22.04-cloud.img"
|
|
echo " - Network: vmbr0"
|
|
echo " - Current CPU, RAM, and Disk specifications"
|
|
|