#!/bin/bash # Dynamic Mycelium IPv6 Address Discovery Script # This script fetches Mycelium IPv6 addresses from the cluster and generates HTML content set -e echo "🔍 Discovering Mycelium IPv6 addresses..." # Fetch IPv6 addresses from cluster nodes IPV6_ADDRESSES=$(kubectl get nodes -o jsonpath='{range .items[*]}{range .status.addresses[?(@.type=="InternalIP")]}{.address}{"\n"}{end}{end}' | grep -E '^[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+$') if [ -z "$IPV6_ADDRESSES" ]; then echo "❌ No IPv6 addresses found!" exit 1 fi echo "✅ Found IPv6 addresses:" echo "$IPV6_ADDRESSES" # Generate HTML content with dynamic addresses cat > /tmp/index.html << HTML_EOF 🌍 Mycelium Global Web Hosting

🌍 Mycelium Global Web Hosting

✅ Success!

This website is globally accessible via Mycelium Cloud!

This demonstrates that you can host a real website that anyone with Mycelium can access from anywhere in the world.

🔄 Dynamic Discovery

IPv6 addresses are automatically discovered from the cluster!

This page updates every 30 seconds to show the current cluster state.

🗓️ Technical Details

🌐 Global Access URLs

Your website is accessible via any Mycelium IPv6:

Anyone with Mycelium can access your website from anywhere!

🚀 Load Balancing Test

Test if load balancing is working:

curl -H "Cache-Control: no-cache" http://[$(echo "$IPV6_ADDRESSES" | head -1)]:30090

Try multiple requests to see traffic distribute across different pods!

Last updated: $(date -u +"%Y-%m-%d %H:%M:%S UTC")

IPv6 addresses discovered: $(echo "$IPV6_ADDRESSES" | wc -l)

Mycelium Cloud • Real Global Internet Infrastructure
Deploy once, access worldwide! 🌍

HTML_EOF echo "📝 Generated HTML content with $(echo "$IPV6_ADDRESSES" | wc -l) IPv6 addresses" # Update the ConfigMap echo "🔄 Updating ConfigMap..." kubectl create configmap nginx-mycelium-content --from-file=index.html=/tmp/index.html --dry-run=client -o yaml | kubectl apply -f - echo "✅ Successfully updated nginx-mycelium-content ConfigMap" echo "🌐 Website will be accessible at: http://[any-ipv6]:30090"