#!/bin/bash # Build and deploy orchestrator to Kubernetes set -e echo "Building orchestrator Docker image..." docker build -f Dockerfile.orchestrator -t swarm-orchestrator:latest . echo "Loading image into kind cluster..." kind load docker-image swarm-orchestrator:latest --name swarm-cluster echo "Deploying Redis StatefulSet..." kubectl apply -f k8s/redis-statefulset.yaml echo "Waiting for Redis to be ready..." kubectl wait --for=condition=ready pod -l app=redis -n swarm-system --timeout=120s echo "Deploying orchestrator..." kubectl apply -f k8s/orchestrator-deployment.yaml echo "Waiting for orchestrator to be ready..." kubectl wait --for=condition=ready pod -l app=orchestrator -n swarm-system --timeout=120s echo "Orchestrator deployed successfully!" echo "" echo "Check status:" echo " kubectl get pods -n swarm-system" echo "" echo "View logs:" echo " kubectl logs -f -l app=orchestrator -n swarm-system" echo "" echo "Port forward to access API:" echo " kubectl port-forward -n swarm-system svc/orchestrator-service 8000:8000"