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
+9 -6
View File
@@ -1,6 +1,9 @@
import { IsString, IsOptional, IsBoolean, IsArray, IsIn, IsNumber, Min } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
const poolStrategies = ['least-apps', 'round-robin', 'weighted-round-robin', 'least-loaded', 'weighted-resource', 'region-based'] as const;
type PoolStrategyDto = typeof poolStrategies[number];
export class CreateClusterPoolDto {
@ApiProperty({ example: 'production-pool' })
@IsString()
@@ -11,9 +14,9 @@ export class CreateClusterPoolDto {
@IsString()
description?: string;
@ApiProperty({ example: 'weighted-resource', enum: ['least-apps', 'round-robin', 'weighted-resource'] })
@IsIn(['least-apps', 'round-robin', 'weighted-resource'])
strategy: 'least-apps' | 'round-robin' | 'weighted-resource';
@ApiProperty({ example: 'weighted-resource', enum: poolStrategies })
@IsIn(poolStrategies)
strategy: PoolStrategyDto;
@ApiProperty({ example: ['uuid-1', 'uuid-2'], description: 'Array of cluster IDs in this pool' })
@IsArray()
@@ -43,10 +46,10 @@ export class UpdateClusterPoolDto {
@IsString()
description?: string;
@ApiPropertyOptional({ enum: ['least-apps', 'round-robin', 'weighted-resource'] })
@ApiPropertyOptional({ enum: poolStrategies })
@IsOptional()
@IsIn(['least-apps', 'round-robin', 'weighted-resource'])
strategy?: 'least-apps' | 'round-robin' | 'weighted-resource';
@IsIn(poolStrategies)
strategy?: PoolStrategyDto;
@ApiPropertyOptional({ description: 'Array of cluster IDs in this pool' })
@IsOptional()