fix: director ConfigMap name, CSRF, ServerSetScale replicas + error handling
- Fix ConfigMap name derivation (strip funcom-seabass- prefix from namespace) - Fix CSRF token missing on all 6 director POST handlers (fetch -> csrfFetch) - Add ServerSetScale replicas management to director map cards - Merge webOverrideCfg into cfg so UI shows active runtime overrides - Auto-refresh after Apply and reset button state on all handlers - Surface JSON error bodies in error banner instead of silent fail - Fix SSL SAN handling for IP vs DNS common name - Fix Let's Encrypt certbot paths to use project-root certbot/ dir - Fix deploys_ok to reflect actual K8s availability - Add active server deployment matching with restart buttons
This commit is contained in:
1 parent
0f173dc107
commit
4a94bf68ce
8 files changed
+321
-57
No files matched your search
+37
-1
@@ -922,7 +922,8 @@ def register_api_routes(app, services, settings):
|
||||
if map_name:
|
||||
kv = director_svc.extract_server_config_kv(config)
|
||||
if kv:
|
||||
director_svc.update_ini_section(map_name, kv)
|
||||
if not director_svc.update_ini_section(map_name, kv):
|
||||
logger.warning("ConfigMap update failed for map %s (director API call succeeded)", map_name)
|
||||
|
||||
return result, 200, {'Content-Type': 'application/json'}
|
||||
except Exception as e:
|
||||
@@ -992,6 +993,41 @@ def register_api_routes(app, services, settings):
|
||||
return jsonify({'success': False, 'error': 'Director unavailable. The BGD service is not responding.'}), 503
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/server_set_scale/<map_name>')
|
||||
@auth_req
|
||||
def director_server_set_scale_get(map_name):
|
||||
try:
|
||||
if not director_svc:
|
||||
return jsonify({'success': False, 'error': 'Director service not available'}), 503
|
||||
scale = director_svc.get_server_set_scale(map_name)
|
||||
if scale is None:
|
||||
return jsonify({'replicas': 0, 'partitions': []})
|
||||
spec = scale.get('spec', {})
|
||||
return jsonify({
|
||||
'replicas': spec.get('replicas', 0),
|
||||
'partitions': [p for p in spec.get('partitions', []) if p is not None],
|
||||
})
|
||||
except Exception as e:
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@app.route('/api/director/server_set_scale/<map_name>', methods=['POST'])
|
||||
@auth_req
|
||||
def director_server_set_scale_patch(map_name):
|
||||
try:
|
||||
if not director_svc:
|
||||
return jsonify({'success': False, 'error': 'Director service not available'}), 503
|
||||
config = request.get_json()
|
||||
replicas = int(config.get('replicas', 1))
|
||||
partitions_raw = config.get('partitions', [])
|
||||
partitions = [int(p) for p in partitions_raw if p is not None]
|
||||
if replicas > len(partitions):
|
||||
return jsonify({'success': False, 'error': 'replicas cannot exceed partition count'}), 400
|
||||
if not director_svc.patch_server_set_scale(map_name, replicas, partitions):
|
||||
return jsonify({'success': False, 'error': 'Failed to patch ServerSetScale'}), 500
|
||||
return jsonify({'success': True})
|
||||
except Exception as e:
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
# Update management
|
||||
@app.route('/api/update/status')
|
||||
@auth_req
|
||||
|
||||
Reference in new issue
Block a user