Improve cluster allocation strategy.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user