diff --git a/src/resources/fleet.ts b/src/resources/fleet.ts index 5af6d07..d1a6e01 100644 --- a/src/resources/fleet.ts +++ b/src/resources/fleet.ts @@ -28,12 +28,36 @@ export interface AgonesFleet extends KubeObjectInterface { }; }; template: object; + /** + * Labels/annotations to apply to GameServers when allocation count exceeds + * the desired replicas. + * + * @see {@link https://agones.dev/site/docs/reference/fleet/#allocation-overflow | Allocation Overflow} + */ + allocationOverflow?: { + labels?: Record; + annotations?: Record; + }; + /** + * Scheduling priorities used to sort GameServers during allocation. + * + * @see {@link https://agones.dev/site/docs/advanced/scheduling-and-autoscaling/#fleet-scheduling | Fleet Scheduling} + */ + priorities?: Array<{ + type: 'Counter' | 'List'; + key: string; + order: 'Ascending' | 'Descending'; + }>; }; status?: { replicas?: number; readyReplicas?: number; reservedReplicas?: number; allocatedReplicas?: number; + /** Aggregate counter status across all GameServers in the Fleet. */ + counters?: Record; + /** Aggregate list status across all GameServers in the Fleet. */ + lists?: Record; }; } @@ -90,4 +114,30 @@ export class Fleet extends KubeObject { get maxUnavailable(): string | number | undefined { return this.spec.strategy?.rollingUpdate?.maxUnavailable; } + + /** + * Allocation overflow metadata applied when allocation count exceeds desired replicas. + * + * @see {@link https://agones.dev/site/docs/reference/fleet/#allocation-overflow | Allocation Overflow} + */ + get allocationOverflow(): + | { labels?: Record; annotations?: Record } + | undefined { + return this.spec.allocationOverflow; + } + + /** Scheduling priorities for GameServer allocation ordering. */ + get priorities(): Array<{ type: string; key: string; order: string }> { + return this.spec.priorities ?? []; + } + + /** Aggregate counter status across all GameServers in the Fleet. */ + get counters(): Record { + return this.status.counters ?? {}; + } + + /** Aggregate list status across all GameServers in the Fleet. */ + get lists(): Record { + return this.status.lists ?? {}; + } } diff --git a/src/resources/fleetautoscaler.ts b/src/resources/fleetautoscaler.ts index 4df0387..9a037b6 100644 --- a/src/resources/fleetautoscaler.ts +++ b/src/resources/fleetautoscaler.ts @@ -47,9 +47,29 @@ export interface AgonesFleetAutoscaler extends KubeObjectInterface { port?: number; }; }; + /** + * WebAssembly-based autoscaling policy. + * + * @see {@link https://agones.dev/site/docs/advanced/scheduling-and-autoscaling/#custom-autoscaler-with-wasm | Wasm Autoscaler} + */ + wasm?: { + url: string; + requestsPerSecond?: number; + }; schedule?: { - between?: { start: string; end: string }; - activePeriod?: { timezone: string; schedule: string }; + between?: { + start: string; + end: string; + minReplicas: number; + maxReplicas: number; + }; + activePeriod?: { + timezone: string; + /** Cron expression for when the period begins. */ + startCron: string; + /** Duration of the active period (e.g. '2h', '30m'). */ + duration: string; + }; policy: { type: string; buffer?: { bufferSize: number | string; minReplicas: number; maxReplicas: number }; diff --git a/src/resources/gameserver.ts b/src/resources/gameserver.ts index 7c4c8f5..b509bd3 100644 --- a/src/resources/gameserver.ts +++ b/src/resources/gameserver.ts @@ -38,6 +38,24 @@ export interface ListStatus { capacity: number; } +/** + * Eviction configuration for a GameServer. + * + * @see {@link https://agones.dev/site/docs/advanced/controlling-disruption/ | Controlling Disruption} + */ +export interface Eviction { + /** Safe strategy: 'Always' | 'OnUpgrade' | 'Never'. */ + safe: string; +} + +/** + * A routable address assigned to the GameServer (e.g. NodeInternalIP, NodeExternalIP). + */ +export interface NodeAddress { + type: string; + address: string; +} + export interface AgonesGameServer extends KubeObjectInterface { spec: { scheduling: string; @@ -56,6 +74,8 @@ export interface AgonesGameServer extends KubeObjectInterface { }; counters?: Record; lists?: Record; + /** Eviction tolerance of the GameServer. */ + eviction?: Eviction; }; status?: { state?: string; @@ -64,6 +84,10 @@ export interface AgonesGameServer extends KubeObjectInterface { nodeName?: string; counters?: Record; lists?: Record; + /** All routable addresses (NodeInternalIP, NodeExternalIP, etc.). */ + addresses?: NodeAddress[]; + /** ISO 8601 timestamp: the GameServer is reserved until this time. */ + reservedUntil?: string; }; } @@ -115,6 +139,28 @@ export class GameServer extends KubeObject { return this.status.lists ?? {}; } + /** + * Eviction safe mode for this GameServer. + * + * @see {@link https://agones.dev/site/docs/advanced/controlling-disruption/ | Controlling Disruption} + */ + get eviction(): string { + return this.spec.eviction?.safe ?? 'Never'; + } + + /** All routable addresses assigned to the GameServer. */ + get addresses(): NodeAddress[] { + return this.status.addresses ?? []; + } + + /** + * ISO 8601 timestamp until which the GameServer is reserved. + * Returns `undefined` if the server is not reserved. + */ + get reservedUntil(): string | undefined { + return this.status.reservedUntil; + } + /** Merged port info: spec metadata (policy, containerPort) + status (host port). */ get mergedPorts(): Array<{ name: string; diff --git a/src/views/fleetautoscalers/Detail.tsx b/src/views/fleetautoscalers/Detail.tsx index fe36a2d..f6878b4 100644 --- a/src/views/fleetautoscalers/Detail.tsx +++ b/src/views/fleetautoscalers/Detail.tsx @@ -74,7 +74,7 @@ function policyExtraInfo(item: FleetAutoscaler) { return [ { name: 'Cron Schedule', - value: policy.schedule?.activePeriod?.schedule ?? '—', + value: policy.schedule?.activePeriod?.startCron ?? '—', }, { name: 'Timezone', @@ -152,7 +152,7 @@ function policyExplanation(item: FleetAutoscaler): string { case 'Webhook': return `Scaling decisions are delegated to an external webhook. The webhook receives current fleet state and responds with the desired replica count.`; case 'Schedule': { - const sched = policy.schedule?.activePeriod?.schedule; + const sched = policy.schedule?.activePeriod?.startCron; const tz = policy.schedule?.activePeriod?.timezone ?? 'UTC'; const nested = policy.schedule?.policy?.type ?? 'Buffer'; return sched diff --git a/src/views/overview/Overview.tsx b/src/views/overview/Overview.tsx index 67a061a..f7ba4ad 100644 --- a/src/views/overview/Overview.tsx +++ b/src/views/overview/Overview.tsx @@ -34,10 +34,12 @@ import { FleetAutoscaler } from '../../resources/fleetautoscaler'; import { GameServer } from '../../resources/gameserver'; const STATE_ORDER = [ + 'PortAllocation', + 'Creating', + 'Starting', 'Ready', 'Allocated', 'Reserved', - 'Creating', 'Scheduled', 'RequestReady', 'Shutdown',