From 0f6ea0b26247e835397d514ca3bd712192a3a69f Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:07:12 +0000 Subject: [PATCH] replace dapi with taskinfo --- apps/kubernetes-provider/src/index.ts | 80 ++++++++++++++++++--------- 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/apps/kubernetes-provider/src/index.ts b/apps/kubernetes-provider/src/index.ts index 2e5b36714..068d3ccad 100644 --- a/apps/kubernetes-provider/src/index.ts +++ b/apps/kubernetes-provider/src/index.ts @@ -159,6 +159,30 @@ class KubernetesTaskOperations implements TaskOperations { name: "registry-trigger", }, ], + initContainers: [ + { + name: "populate-taskinfo", + image: "busybox", + command: ["/bin/sh", "-c"], + args: ["printenv COORDINATOR_HOST | tee /etc/taskinfo/coordinator-host"], + env: [ + { + name: "COORDINATOR_HOST", + valueFrom: { + fieldRef: { + fieldPath: "status.hostIP", + }, + }, + }, + ], + volumeMounts: [ + { + name: "taskinfo", + mountPath: "/etc/taskinfo", + }, + ], + }, + ], containers: [ { name: this.#getRunContainerName(opts.attemptId), @@ -223,25 +247,16 @@ class KubernetesTaskOperations implements TaskOperations { ], volumeMounts: [ { - name: "dapi", - mountPath: "/etc/dapi", + name: "taskinfo", + mountPath: "/etc/taskinfo", }, ], }, ], volumes: [ { - name: "dapi", - downwardAPI: { - items: [ - { - path: "coordinator-host", - fieldRef: { - fieldPath: "status.hostIP", - }, - }, - ], - }, + name: "taskinfo", + emptyDir: {}, }, ], }, @@ -269,6 +284,28 @@ class KubernetesTaskOperations implements TaskOperations { image: opts.imageRef, command: ["sleep", "0"], }, + { + name: "populate-taskinfo", + image: "busybox", + command: ["/bin/sh", "-c"], + args: ["printenv COORDINATOR_HOST | tee /etc/taskinfo/coordinator-host"], + env: [ + { + name: "COORDINATOR_HOST", + valueFrom: { + fieldRef: { + fieldPath: "status.hostIP", + }, + }, + }, + ], + volumeMounts: [ + { + name: "taskinfo", + mountPath: "/etc/taskinfo", + }, + ], + }, ], containers: [ { @@ -292,25 +329,16 @@ class KubernetesTaskOperations implements TaskOperations { // }, volumeMounts: [ { - name: "dapi", - mountPath: "/etc/dapi", + name: "taskinfo", + mountPath: "/etc/taskinfo", }, ], }, ], volumes: [ { - name: "dapi", - downwardAPI: { - items: [ - { - path: "coordinator-host", - fieldRef: { - fieldPath: "status.hostIP", - }, - }, - ], - }, + name: "taskinfo", + emptyDir: {}, }, ], },