Improve cluster allocation strategy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-18 23:18:50 +03:30
parent 72a1519ea0
commit fda8384a5c
10 changed files with 439 additions and 64 deletions
@@ -16,7 +16,7 @@ export default function AdminPoolsPage() {
const [form, setForm] = useState({
name: '',
description: '',
strategy: 'weighted-resource' as 'least-apps' | 'round-robin' | 'weighted-resource',
strategy: 'weighted-resource' as 'least-apps' | 'round-robin' | 'weighted-round-robin' | 'least-loaded' | 'weighted-resource' | 'region-based',
clusterIds: [] as string[],
isDefault: false,
priority: 100,
@@ -143,6 +143,9 @@ export default function AdminPoolsPage() {
onChange={(e) => setForm({ ...form, strategy: e.target.value as any })}
>
<option value="weighted-resource">Weighted Resource prefer healthy capacity and higher weights</option>
<option value="least-loaded">Least Loaded prefer lowest CPU, memory, and pod pressure</option>
<option value="weighted-round-robin">Weighted Round Robin rotate proportionally by weight</option>
<option value="region-based">Region Based prefer matching region, then weight and load</option>
<option value="least-apps">Least Apps deploy to cluster with fewest apps</option>
<option value="round-robin">Round Robin rotate across clusters evenly</option>
</select>
@@ -315,6 +318,12 @@ export default function AdminPoolsPage() {
<span className="badge badge-purple flex items-center gap-1">
{pool.strategy === 'weighted-resource'
? <><BarChart3 className="w-3 h-3" /> Weighted Resource</>
: pool.strategy === 'least-loaded'
? <><BarChart3 className="w-3 h-3" /> Least Loaded</>
: pool.strategy === 'weighted-round-robin'
? <><RotateCw className="w-3 h-3" /> Weighted RR</>
: pool.strategy === 'region-based'
? <><BarChart3 className="w-3 h-3" /> Region Based</>
: pool.strategy === 'least-apps'
? <><BarChart3 className="w-3 h-3" /> Least Apps</>
: <><RotateCw className="w-3 h-3" /> Round Robin</>}
@@ -2281,6 +2281,12 @@ export default function DeployPage() {
<span className="text-xs bg-purple-100 text-purple-700 px-1.5 py-0.5 rounded flex items-center gap-1">
{pool.strategy === 'weighted-resource'
? <><BarChart3 className="w-3 h-3" /> Weighted Resource</>
: pool.strategy === 'least-loaded'
? <><BarChart3 className="w-3 h-3" /> Least Loaded</>
: pool.strategy === 'weighted-round-robin'
? <><RotateCw className="w-3 h-3" /> Weighted RR</>
: pool.strategy === 'region-based'
? <><BarChart3 className="w-3 h-3" /> Region Based</>
: pool.strategy === 'least-apps'
? <><BarChart3 className="w-3 h-3" /> Least Apps</>
: <><RotateCw className="w-3 h-3" /> Round Robin</>}
+3 -3
View File
@@ -254,7 +254,7 @@ export interface ClusterPoolPublic {
id: string;
name: string;
description?: string;
strategy: 'least-apps' | 'round-robin' | 'weighted-resource';
strategy: 'least-apps' | 'round-robin' | 'weighted-round-robin' | 'least-loaded' | 'weighted-resource' | 'region-based';
clusterIds: string[];
isActive: boolean;
isDefault: boolean;
@@ -266,7 +266,7 @@ export interface ClusterPool {
id: string;
name: string;
description?: string;
strategy: 'least-apps' | 'round-robin' | 'weighted-resource';
strategy: 'least-apps' | 'round-robin' | 'weighted-round-robin' | 'least-loaded' | 'weighted-resource' | 'region-based';
clusterIds: string[];
isActive: boolean;
isDefault: boolean;
@@ -295,7 +295,7 @@ export interface ClusterAllocationLog {
userId: string;
poolId?: string;
selectedClusterId?: string;
strategy: 'least-apps' | 'round-robin' | 'weighted-resource';
strategy: 'least-apps' | 'round-robin' | 'weighted-round-robin' | 'least-loaded' | 'weighted-resource' | 'region-based';
estimatedRequest?: Record<string, any>;
candidateScores?: Record<string, any>[];
rejectionReasons?: Record<string, any>[];