Skip to content

Commit d4b5ff9

Browse files
author
Conner Aldrich
committed
fix: restore upstream blocks accidentally removed in earlier commits
Three blocks were dropped accidentally by overly-greedy StrReplace edits in earlier commits. Restore them to match upstream main: 1. apps/supervisor/src/env.ts: KUBERNETES_POD_DNS_NDOTS_OVERRIDE_ENABLED and KUBERNETES_POD_DNS_NDOTS env vars (and their multi-line comment explaining the ndots-tuning rationale) — dropped in 171b09f (feat(supervisor): parameterize worker-pod and -container securityContext) when the surrounding KUBERNETES_WORKER_* parameterization was added. 2. apps/supervisor/src/workloadManager/kubernetes.ts: corresponding dnsConfig block in the worker pod spec that consumes the env vars — dropped in the same commit. 3. hosting/k8s/helm/values.yaml: webapp.serviceAccount block (create, name, annotations) — dropped in 7c5f3a5 (fix(helm): default worker Role to empty rules) when the worker.rbac block was edited; the StrReplace replacement string accidentally swallowed the unrelated webapp.serviceAccount block above it. No functional change to our patches; pure restoration of upstream code.
1 parent a2d7484 commit d4b5ff9

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

apps/supervisor/src/env.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ const Env = z
145145

146146
KUBERNETES_MEMORY_OVERHEAD_GB: z.coerce.number().min(0).optional(), // Optional memory overhead to add to the limit in GB
147147
KUBERNETES_SCHEDULER_NAME: z.string().optional(), // Custom scheduler name for pods
148+
149+
// Pod DNS config — override the cluster default ndots to `KUBERNETES_POD_DNS_NDOTS`.
150+
// Default k8s ndots is 5: any name with fewer than 5 dots (e.g. `api.example.com`, 2 dots) is first walked
151+
// through every entry in the cluster search list (`<ns>.svc.cluster.local`, `svc.cluster.local`, `cluster.local`)
152+
// before being tried as-is, turning one resolution into 4+ CoreDNS queries (×2 with A+AAAA).
153+
// Overriding the default can be useful to cut CoreDNS query amplification for external domains.
154+
// Note: before enabling, make sure no code path relies on search-list expansion for names with dots ≥ the value
155+
// set here — those names will now hit their as-is form first and could resolve externally before falling back.
156+
KUBERNETES_POD_DNS_NDOTS_OVERRIDE_ENABLED: BoolEnv.default(false),
157+
KUBERNETES_POD_DNS_NDOTS: z.coerce.number().int().min(1).max(15).default(2),
148158
// Large machine affinity settings - large-* presets prefer a dedicated pool
149159
KUBERNETES_LARGE_MACHINE_AFFINITY_ENABLED: BoolEnv.default(false),
150160
KUBERNETES_LARGE_MACHINE_AFFINITY_POOL_LABEL_KEY: z
@@ -213,7 +223,9 @@ const Env = z
213223
if (!validEffects.includes(effect)) {
214224
ctx.addIssue({
215225
code: z.ZodIssueCode.custom,
216-
message: `Invalid toleration effect "${effect}" in "${entry}". Must be one of: ${validEffects.join(", ")}`,
226+
message: `Invalid toleration effect "${effect}" in "${entry}". Must be one of: ${validEffects.join(
227+
", "
228+
)}`,
217229
});
218230
return z.NEVER;
219231
}

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,13 @@ export class KubernetesWorkloadManager implements WorkloadManager {
335335
},
336336
}
337337
: {}),
338+
...(env.KUBERNETES_POD_DNS_NDOTS_OVERRIDE_ENABLED
339+
? {
340+
dnsConfig: {
341+
options: [{ name: "ndots", value: `${env.KUBERNETES_POD_DNS_NDOTS}` }],
342+
},
343+
}
344+
: {}),
338345
};
339346
}
340347

hosting/k8s/helm/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ webapp:
208208
runReplication:
209209
logLevel: "info" # one of: log, error, warn, info, debug
210210

211+
# ServiceAccount configuration
212+
serviceAccount:
213+
create: true
214+
# Name of the ServiceAccount to use. Required when create is false - otherwise
215+
# the token-syncer RoleBinding would bind to the namespace's "default" SA.
216+
name: ""
217+
# Annotations to add to the ServiceAccount (e.g. eks.amazonaws.com/role-arn for IRSA)
218+
annotations: {}
219+
211220
# Observability configuration (OTel)
212221
observability:
213222
tracing:

0 commit comments

Comments
 (0)