Files

5.1 KiB

🚀 Ready for AKS Deployment

✅ Pre-Deployment Checklist

  • Docker image built: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v1
  • Image pushed to ACR successfully
  • ConfigMap updated with Heicode env vars
  • Secret updated with HEICODE_SERVICE_TOKEN
  • Deployment YAML updated with new image tag
  • Changes reviewed (see diff output above)

📋 What Will Be Deployed

New Environment Variables (ConfigMap)

REDIS_URL: redis://localhost:6379/0
HEICODE_NEWAPI_BASE_URL: https://code.xinghanlab.com
LITELLM_BASE_URL: http://litellm-service:8000
NAMESPACE_PREFIX: agnet
MAX_CONCURRENT_DEPLOYMENTS_PER_USER: 10
MAX_CONCURRENT_DEPLOYMENTS_PER_SCOPE: 50

New Secret

HEICODE_SERVICE_TOKEN: heicode-prod-token-change-me

Image Update

  • From: agnettaiji.azurecr.io/agent-manager:ee73763-arm64
  • To: agnettaiji.azurecr.io/ai-agents/agent-manager:heicode-v1

🎯 Deploy Now

Run these commands to deploy:

# 1. Apply ConfigMap (adds Heicode env vars)
kubectl apply -f k8s/agent-manager-configmap.yaml

# 2. Apply Secret (adds HEICODE_SERVICE_TOKEN)
kubectl apply -f k8s/agent-manager-secret.yaml

# 3. Apply Deployment (updates image to heicode-v1)
kubectl apply -f k8s/agent-manager-deployment.yaml

# 4. Watch rollout
kubectl rollout status deployment/agent-manager -n agent-manager

# 5. Check pods
kubectl get pods -n agent-manager

# 6. View logs
kubectl logs -n agent-manager -l app=agent-manager --tail=50

🧪 Test After Deployment

1. Port Forward

kubectl port-forward -n agent-manager svc/agent-manager 8000:8000

2. Test Health Endpoint

curl -X GET "http://localhost:8000/api/agnet/health" \
  -H "Authorization: Bearer heicode-prod-token-change-me" \
  -H "X-Correlation-Id: test-123"

Expected Response:

{
  "success": true,
  "data": {
    "status": "healthy",
    "service": "agent-manager-agnet",
    "version": "1.0.0",
    "phase": "2-deployments"
  }
}

3. Test Create Deployment

curl -X POST "http://localhost:8000/api/agnet/deployments" \
  -H "Authorization: Bearer heicode-prod-token-change-me" \
  -H "Content-Type: application/json" \
  -H "X-Correlation-Id: test-deploy-001" \
  -H "X-User-Id: test-user" \
  -H "X-Binding-Scope: test-project" \
  -H "Idempotency-Key: test-idem-001" \
  -d '{
    "orchestration_plan": "Deploy a test data analysis agent",
    "agents": [{
      "role": "data-analyst",
      "image": "agnettaiji.azurecr.io/agents/analyst:v1",
      "sk_sources": []
    }],
    "risk_level": "low",
    "budget": {
      "max_usd": 100.0,
      "alert_threshold_pct": 80
    },
    "billing_context": {
      "provider": "newapi",
      "default_model_id": "gpt-4",
      "allowed_model_ids": ["gpt-4", "gpt-3.5-turbo"],
      "secret_ref": "vault:secret/users/test-user/bindings/test-project/newapi-token"
    },
    "resource_grants": [],
    "metadata": {
      "test": true
    }
  }'

4. Verify Database

# Connect to PostgreSQL
psql "postgresql://taiji:By@123456.@taijipda.postgres.database.azure.com:5432/taijiagnet"

# Check deployments table
SELECT deployment_id, user_id, status, risk_level, billing_provider, created_at 
FROM deployments 
ORDER BY created_at DESC 
LIMIT 5;

# Check audit logs
SELECT audit_id, actor, action, result, occurred_at 
FROM audit_logs 
ORDER BY occurred_at DESC 
LIMIT 10;

📊 What's Been Implemented

Phase 1: Foundation ✅

  • Service token authentication
  • Sensitive field scanner
  • Redis idempotency cache
  • Error response standardization
  • Health check endpoint

Phase 2: Core Endpoints ✅

  • POST /api/agnet/deployments (create)
  • GET /api/agnet/deployments (list)
  • GET /api/agnet/deployments/{id} (details)
  • POST /api/agnet/deployments/{id}/stop (stop)
  • Database tables (deployments, agent_instances, events, audit_logs)
  • Full audit trail
  • Event tracking

🔍 Monitoring After Deployment

# Watch logs in real-time
kubectl logs -n agent-manager -l app=agent-manager -f

# Check pod status
kubectl get pods -n agent-manager -w

# Check deployment status
kubectl get deployment agent-manager -n agent-manager

# View recent events
kubectl get events -n agent-manager --sort-by='.lastTimestamp' | tail -20

⚠️ Rollback if Needed

If something goes wrong:

# Rollback to previous version
kubectl rollout undo deployment/agent-manager -n agent-manager

# Check rollout history
kubectl rollout history deployment/agent-manager -n agent-manager

📚 Documentation

All implementation details are in:

  • .omc/autopilot/phase1-summary.md - Foundation & Authentication
  • .omc/autopilot/phase2-summary.md - Deployment Endpoints
  • .omc/autopilot/aks-deployment-summary.md - Full deployment guide
  • .omc/plans/autopilot-impl.md - Complete implementation plan

🎉 Success Criteria

After deployment, verify:

  • Health endpoint returns 200
  • Create deployment returns 201 with deployment_id
  • Database records created
  • Audit logs written
  • No errors in pod logs
  • Service accessible via port-forward

Status: Ready for deployment! 🚀

Run the kubectl commands above to deploy to AKS.