Skip to content

Commit b085a41

Browse files
committed
Adjust the large machine affinity flag name for consistency
1 parent 72f14f8 commit b085a41

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

apps/supervisor/src/env.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ const Env = z.object({
110110

111111
KUBERNETES_MEMORY_OVERHEAD_GB: z.coerce.number().min(0).optional(), // Optional memory overhead to add to the limit in GB
112112
KUBERNETES_SCHEDULER_NAME: z.string().optional(), // Custom scheduler name for pods
113-
KUBERNETES_LARGE_MACHINE_POOL_LABEL: z.string().optional(), // if set, large-* presets affinity for machinepool=<value>
113+
// Large machine affinity settings - large-* presets prefer a dedicated pool
114+
KUBERNETES_LARGE_MACHINE_AFFINITY_ENABLED: BoolEnv.default(false),
115+
KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_KEY: z.string().default("node.cluster.x-k8s.io/machinepool"),
116+
KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_VALUE: z.string().default("large-machines"),
114117

115118
// Project affinity settings - pods from the same project prefer the same node
116119
KUBERNETES_PROJECT_AFFINITY_ENABLED: BoolEnv.default(false),

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
435435
}
436436

437437
#getNodeAffinityRules(preset: MachinePreset): k8s.V1NodeAffinity | undefined {
438-
if (!env.KUBERNETES_LARGE_MACHINE_POOL_LABEL) {
438+
if (!env.KUBERNETES_LARGE_MACHINE_AFFINITY_ENABLED) {
439439
return undefined;
440440
}
441441

@@ -448,9 +448,9 @@ export class KubernetesWorkloadManager implements WorkloadManager {
448448
preference: {
449449
matchExpressions: [
450450
{
451-
key: "node.cluster.x-k8s.io/machinepool",
451+
key: env.KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_KEY,
452452
operator: "In",
453-
values: [env.KUBERNETES_LARGE_MACHINE_POOL_LABEL],
453+
values: [env.KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_VALUE],
454454
},
455455
],
456456
},
@@ -466,9 +466,9 @@ export class KubernetesWorkloadManager implements WorkloadManager {
466466
{
467467
matchExpressions: [
468468
{
469-
key: "node.cluster.x-k8s.io/machinepool",
469+
key: env.KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_KEY,
470470
operator: "NotIn",
471-
values: [env.KUBERNETES_LARGE_MACHINE_POOL_LABEL],
471+
values: [env.KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_VALUE],
472472
},
473473
],
474474
},

0 commit comments

Comments
 (0)