Files
haproxy-openmanager/backend
taylanbakircioglu a13daabf90 feat: SSL scope-aware apply - restore original behavior with improvements
PROBLEM:
- SSL content was updated (Global or Cluster-specific)
- Required separate Apply action for each cluster (poor UX)
- Original system: Single Apply propagated to all clusters in scope

SOLUTION:
- Added apply_ssl_related_configs() helper function (line 48-163)
- Detects SSL-related PENDING configs
- Auto-applies based on SSL scope:
  * Global SSL → APPLIED in all clusters with PENDING configs
  * Cluster-specific SSL → APPLIED in associated clusters only

KEY IMPROVEMENTS:
 Transaction-safe (old code was NOT)
 Direct UPDATE (old code used recursive calls)
 Cluster-specific SSL support (old code did NOT handle this)
 Version name based (more reliable than metadata parsing)
 Single transaction (old code had partial success risk)

WORKFLOW:
1. SSL 'demo-global' updated (Global scope)
2. PENDING configs created for Cluster-1, 2, 3
3. User clicks Apply in any cluster
4. Backend detects SSL scope
5. Auto-APPLIED in ALL affected clusters 
6. Agents pull SSL and deploy 

TECHNICAL DETAILS:
- Helper function: apply_ssl_related_configs() (line 48-163)
  * SSL ID extraction from version name (ssl-{id}-update-{ts})
  * Scope detection from ssl_certificates table
  * Target cluster discovery based on scope
  * Direct UPDATE (no recursion)
  * is_active=FALSE (consolidated version will be TRUE)

- Integration: apply_pending_changes() (line 1329-1332)
  * Called INSIDE transaction for atomicity
  * Before consolidated version creation
  * Replaces old recursive logic

- Old logic disabled: (line 1253-1255)
  * Empty lists prevent old recursive apply
  * Old code only handled global SSL
  * New code handles both global AND cluster-specific SSL

PERFORMANCE:
- Old: N recursive calls (1 per cluster)
- New: 1 transaction with direct UPDATEs
- Result: Faster and safer

SAFETY:
 Transaction rollback tested
 All edge cases handled (SSL deleted, cluster deleted, etc)
 No UI breaking changes (global_ssl_applied field not used)
 Backward compatible

FILES MODIFIED:
- backend/routers/cluster.py
  + apply_ssl_related_configs() helper function
  + Integration in apply_pending_changes()
  + Old recursive logic disabled
2025-11-14 01:06:38 +03:00
..
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00