Skip to content

Commit fedb72e

Browse files
committed
feat(supervisor): add Kubernetes worker pod priority class support
Add KUBERNETES_POD_PRIORITY_CLASS_NAME environment variable to allow configuring a priority class for task run pods in Kubernetes environments. This addresses pod preemption issues in resource-constrained clusters, particularly in GKE Autopilot where low-priority pods can be preempted by system pods during scale-up operations. Fixes: Pod preemption causing SIGTERM failures during cluster scale-up Related: GKE Autopilot resource contention
1 parent 8fdbbeb commit fedb72e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

apps/supervisor/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ const Env = z.object({
9191
KUBERNETES_MEMORY_REQUEST_RATIO: z.coerce.number().min(0).max(1).default(1), // Ratio of memory limit, so 1 = 100% of memory limit
9292
KUBERNETES_MEMORY_OVERHEAD_GB: z.coerce.number().min(0).optional(), // Optional memory overhead to add to the limit in GB
9393
KUBERNETES_SCHEDULER_NAME: z.string().optional(), // Custom scheduler name for pods
94+
KUBERNETES_POD_PRIORITY_CLASS_NAME: z.string().optional(), // Priority class name for task run pods
9495

9596
// Placement tags settings
9697
PLACEMENT_TAGS_ENABLED: BoolEnv.default(false),

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ export class KubernetesWorkloadManager implements WorkloadManager {
286286
},
287287
}
288288
: {}),
289+
...(env.KUBERNETES_POD_PRIORITY_CLASS_NAME
290+
? {
291+
priorityClassName: env.KUBERNETES_POD_PRIORITY_CLASS_NAME,
292+
}
293+
: {}),
289294
};
290295
}
291296

0 commit comments

Comments
 (0)