- Opzet cluster werkt
- Opstart redis en minio werkt - Bezig om eigenlijke apps op te starten ... werkt nog niet.
This commit is contained in:
@@ -41,10 +41,28 @@ deploy_service_group() {
|
||||
log_operation "INFO" "Applying YAML file: $yaml_file"
|
||||
log_kubectl_command "kubectl apply -f $full_path"
|
||||
|
||||
if kubectl apply -f "$full_path"; then
|
||||
log_operation "SUCCESS" "Successfully applied: $yaml_file"
|
||||
else
|
||||
log_operation "ERROR" "Failed to apply: $yaml_file"
|
||||
# Apply with retry logic for namespace race condition handling
|
||||
local max_attempts=3
|
||||
local attempt=1
|
||||
local file_success=false
|
||||
|
||||
while [[ $attempt -le $max_attempts ]] && [[ "$file_success" == "false" ]]; do
|
||||
if kubectl apply -f "$full_path"; then
|
||||
log_operation "SUCCESS" "Successfully applied: $yaml_file"
|
||||
file_success=true
|
||||
else
|
||||
if [[ $attempt -lt $max_attempts ]]; then
|
||||
log_operation "WARNING" "Attempt $attempt failed for $yaml_file, retrying after namespace sync..."
|
||||
sleep 3
|
||||
attempt=$((attempt + 1))
|
||||
else
|
||||
log_operation "ERROR" "Failed to apply $yaml_file after $max_attempts attempts"
|
||||
success=false
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$file_success" == "false" ]]; then
|
||||
success=false
|
||||
fi
|
||||
done
|
||||
@@ -405,13 +423,167 @@ restart_service() {
|
||||
log_operation "SUCCESS" "Successfully restarted service: $service"
|
||||
}
|
||||
|
||||
# Test service connectivity via Ingress
|
||||
test_connectivity_ingress() {
|
||||
log_operation "INFO" "Testing Ingress connectivity..."
|
||||
|
||||
# Test Ingress endpoints
|
||||
local endpoints=(
|
||||
"http://minty.ask-eve-ai-local.com:3080/admin/"
|
||||
"http://minty.ask-eve-ai-local.com:3080/api/healthz/ready"
|
||||
"http://minty.ask-eve-ai-local.com:3080/chat-client/"
|
||||
"http://minty.ask-eve-ai-local.com:3080/static/"
|
||||
"http://localhost:3009" # MinIO Console (direct)
|
||||
"http://localhost:3010" # Prometheus (direct)
|
||||
"http://localhost:3012" # Grafana (direct)
|
||||
)
|
||||
|
||||
local success_count=0
|
||||
local total_count=${#endpoints[@]}
|
||||
|
||||
for endpoint in "${endpoints[@]}"; do
|
||||
log_operation "INFO" "Testing $endpoint..."
|
||||
if curl -f -s --max-time 10 "$endpoint" > /dev/null; then
|
||||
log_operation "SUCCESS" "$endpoint is responding"
|
||||
((success_count++))
|
||||
else
|
||||
log_operation "WARNING" "$endpoint is not responding (may still be starting up)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
log_operation "INFO" "Connectivity test completed: $success_count/$total_count endpoints responding"
|
||||
|
||||
if [[ $success_count -eq $total_count ]]; then
|
||||
log_operation "SUCCESS" "All endpoints are responding"
|
||||
return 0
|
||||
elif [[ $success_count -gt 0 ]]; then
|
||||
log_operation "WARNING" "Some endpoints are not responding"
|
||||
return 1
|
||||
else
|
||||
log_operation "ERROR" "No endpoints are responding"
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
# Show connection information for Ingress setup
|
||||
show_connection_info() {
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
log_operation "SUCCESS" "EveAI $K8S_ENVIRONMENT Cluster Connection Info"
|
||||
echo "=================================================="
|
||||
echo ""
|
||||
echo "🌐 Service URLs:"
|
||||
echo " Main Application (via Ingress only):"
|
||||
echo " • Main App: http://minty.ask-eve-ai-local.com:3080/admin/"
|
||||
echo " • API: http://minty.ask-eve-ai-local.com:3080/api/"
|
||||
echo " • Chat Client: http://minty.ask-eve-ai-local.com:3080/chat-client/"
|
||||
echo " • Static Files: http://minty.ask-eve-ai-local.com:3080/static/"
|
||||
echo ""
|
||||
echo " Infrastructure (direct NodePort access):"
|
||||
echo " • Redis: redis://minty.ask-eve-ai-local.com:3006"
|
||||
echo " • MinIO S3: http://minty.ask-eve-ai-local.com:3008"
|
||||
echo " • MinIO Console: http://minty.ask-eve-ai-local.com:3009"
|
||||
echo ""
|
||||
echo " Monitoring (direct NodePort access):"
|
||||
echo " • Prometheus: http://minty.ask-eve-ai-local.com:3010"
|
||||
echo " • Grafana: http://minty.ask-eve-ai-local.com:3012"
|
||||
echo ""
|
||||
echo "🔑 Default Credentials:"
|
||||
echo " • MinIO: minioadmin / minioadmin"
|
||||
echo " • Grafana: admin / admin"
|
||||
echo " • Flower: Felucia / Jungles"
|
||||
echo ""
|
||||
echo "🛠️ Management Commands:"
|
||||
echo " • kubectl get all -n $K8S_NAMESPACE"
|
||||
echo " • kubectl get ingress -n $K8S_NAMESPACE"
|
||||
echo " • kubectl logs -f deployment/eveai-app -n $K8S_NAMESPACE"
|
||||
echo " • kubectl describe ingress eveai-ingress -n $K8S_NAMESPACE"
|
||||
echo ""
|
||||
echo "🗂️ Data Persistence:"
|
||||
echo " • Host data path: \$HOME/k8s-data/$K8S_ENVIRONMENT/"
|
||||
echo " • Logs path: \$HOME/k8s-data/$K8S_ENVIRONMENT/logs/"
|
||||
echo ""
|
||||
echo "📊 Environment Details:"
|
||||
echo " • Environment: $K8S_ENVIRONMENT"
|
||||
echo " • Version: $K8S_VERSION"
|
||||
echo " • Cluster: $K8S_CLUSTER"
|
||||
echo " • Namespace: $K8S_NAMESPACE"
|
||||
echo " • Config Dir: $K8S_CONFIG_DIR"
|
||||
}
|
||||
|
||||
# Deploy all services in structured order (like deploy-all-services.sh)
|
||||
deploy_all_structured() {
|
||||
log_operation "INFO" "Starting structured deployment of all services"
|
||||
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
echo "🚀 Deploying EveAI $K8S_ENVIRONMENT Services"
|
||||
echo "=================================================="
|
||||
|
||||
# Stage 1: Infrastructure
|
||||
log_operation "INFO" "Stage 1: Deploying infrastructure services..."
|
||||
if ! deploy_service_group "infrastructure"; then
|
||||
log_operation "ERROR" "Failed to deploy infrastructure services"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_operation "INFO" "Waiting for infrastructure to be ready..."
|
||||
if ! wait_for_group_ready "infrastructure"; then
|
||||
log_operation "ERROR" "Infrastructure services failed to become ready"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
|
||||
# Stage 2: Application services
|
||||
log_operation "INFO" "Stage 2: Deploying application services..."
|
||||
if ! deploy_service_group "apps"; then
|
||||
log_operation "ERROR" "Failed to deploy application services"
|
||||
return 1
|
||||
fi
|
||||
|
||||
log_operation "INFO" "Waiting for application services to be ready..."
|
||||
if ! wait_for_group_ready "apps"; then
|
||||
log_operation "WARNING" "Some application services may still be starting"
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
|
||||
# Stage 3: Static files and ingress
|
||||
log_operation "INFO" "Stage 3: Deploying static files and ingress..."
|
||||
if ! deploy_service_group "static"; then
|
||||
log_operation "ERROR" "Failed to deploy static services"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Stage 4: Monitoring services
|
||||
log_operation "INFO" "Stage 4: Deploying monitoring services..."
|
||||
if ! deploy_service_group "monitoring"; then
|
||||
log_operation "WARNING" "Failed to deploy monitoring services (continuing anyway)"
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
|
||||
# Final verification
|
||||
log_operation "INFO" "Running final connectivity tests..."
|
||||
test_connectivity_ingress
|
||||
|
||||
show_connection_info
|
||||
|
||||
log_operation "SUCCESS" "Structured deployment completed!"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Export functions for use in other scripts
|
||||
if [[ -n "$ZSH_VERSION" ]]; then
|
||||
typeset -f deploy_service_group stop_service_group start_service_group > /dev/null
|
||||
typeset -f deploy_individual_service stop_individual_service start_individual_service > /dev/null
|
||||
typeset -f wait_for_group_ready get_service_status show_service_status restart_service > /dev/null
|
||||
typeset -f test_connectivity_ingress show_connection_info deploy_all_structured > /dev/null
|
||||
else
|
||||
export -f deploy_service_group stop_service_group start_service_group
|
||||
export -f deploy_individual_service stop_individual_service start_individual_service
|
||||
export -f wait_for_group_ready get_service_status show_service_status restart_service
|
||||
export -f test_connectivity_ingress show_connection_info deploy_all_structured
|
||||
fi
|
||||
Reference in New Issue
Block a user