Add role-based filtering and imporve code

This commit is contained in:
Urtzi Alfaro
2025-10-15 16:12:49 +02:00
parent 96ad5c6692
commit 8f9e9a7edc
158 changed files with 11033 additions and 1544 deletions

View File

@@ -236,6 +236,8 @@ get_running_pod() {
"app.kubernetes.io/name=${service}-service,app.kubernetes.io/component=microservice"
"app.kubernetes.io/name=${service}-service,app.kubernetes.io/component=worker"
"app.kubernetes.io/name=${service}-service"
"app=${service}-service,component=${service}" # Fallback for demo-session
"app=${service}-service" # Additional fallback
)
for selector in "${selectors[@]}"; do
@@ -594,6 +596,21 @@ EOFPYTHON
echo "$VERIFY_RESULT" >> "$LOG_FILE"
echo -e "${BLUE}$VERIFY_RESULT${NC}"
# Initialize alembic version table after schema reset
echo -e "${YELLOW}Initializing alembic version tracking...${NC}"
ALEMBIC_INIT_OUTPUT=$(kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER" -- sh -c "cd /app && PYTHONPATH=/app:/app/shared:\$PYTHONPATH alembic stamp base" 2>&1)
ALEMBIC_INIT_EXIT_CODE=$?
echo "$ALEMBIC_INIT_OUTPUT" >> "$LOG_FILE"
if [ $ALEMBIC_INIT_EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}✓ Alembic version tracking initialized${NC}"
log_message "INFO" "Alembic version tracking initialized for $service"
else
echo -e "${YELLOW}⚠ Alembic initialization warning (may be normal)${NC}"
log_message "WARNING" "Alembic initialization for $service: $ALEMBIC_INIT_OUTPUT"
fi
# Remove old migration files in pod
echo -e "${YELLOW}Removing old migration files in pod...${NC}"
kubectl exec -n "$NAMESPACE" "$POD_NAME" -c "$CONTAINER" -- sh -c "rm -rf /app/migrations/versions/*.py /app/migrations/versions/__pycache__" 2>>"$LOG_FILE" || log_message "WARNING" "Failed to remove old migration files for $service"

View File

@@ -66,7 +66,7 @@ check_prerequisites() {
# Check if Colima is running
if ! colima status --profile k8s-local &> /dev/null; then
print_warning "Colima is not running. Starting Colima..."
colima start --cpu 4 --memory 8 --disk 100 --runtime docker --profile k8s-local
colima start --cpu 8 --memory 16 --disk 100 --runtime docker --profile k8s-local
if [ $? -ne 0 ]; then
print_error "Failed to start Colima. Please check your Docker installation."
exit 1