Skip to content

Commit 112f6f6

Browse files
authored
feat(supervisor): optionally strip digests from image refs (#2410)
1 parent 0b35cc3 commit 112f6f6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

apps/supervisor/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const Env = z.object({
7676
KUBERNETES_IMAGE_PULL_SECRETS: z.string().optional(), // csv
7777
KUBERNETES_EPHEMERAL_STORAGE_SIZE_LIMIT: z.string().default("10Gi"),
7878
KUBERNETES_EPHEMERAL_STORAGE_SIZE_REQUEST: z.string().default("2Gi"),
79+
KUBERNETES_STRIP_IMAGE_DIGEST: BoolEnv.default(false),
7980

8081
// Placement tags settings
8182
PLACEMENT_TAGS_ENABLED: BoolEnv.default(false),

apps/supervisor/src/workloadManager/kubernetes.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ export class KubernetesWorkloadManager implements WorkloadManager {
4949
};
5050
}
5151

52+
private stripImageDigest(imageRef: string): string {
53+
if (!env.KUBERNETES_STRIP_IMAGE_DIGEST) {
54+
return imageRef;
55+
}
56+
57+
const atIndex = imageRef.lastIndexOf("@");
58+
59+
if (atIndex === -1) {
60+
return imageRef;
61+
}
62+
63+
return imageRef.substring(0, atIndex);
64+
}
65+
5266
async create(opts: WorkloadManagerCreateOptions) {
5367
this.logger.log("[KubernetesWorkloadManager] Creating container", { opts });
5468

@@ -74,7 +88,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
7488
containers: [
7589
{
7690
name: "run-controller",
77-
image: opts.image,
91+
image: this.stripImageDigest(opts.image),
7892
ports: [
7993
{
8094
containerPort: 8000,

0 commit comments

Comments
 (0)