Skip to content

Commit 62e1b7d

Browse files
committed
fix retry container names on kubernetes
1 parent d9f64a7 commit 62e1b7d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

apps/kubernetes-provider/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ class KubernetesTaskOperations implements TaskOperations {
139139
}
140140

141141
async create(opts: TaskOperationsCreateOptions) {
142+
const containerName = this.#getRunContainerName(opts.runId, opts.nextAttemptNumber);
143+
142144
await this.#createPod(
143145
{
144146
metadata: {
145-
name: this.#getRunContainerName(opts.runId),
147+
name: containerName,
146148
namespace: this.#namespace.metadata.name,
147149
labels: {
148150
...this.#getSharedLabels(opts),
@@ -157,7 +159,7 @@ class KubernetesTaskOperations implements TaskOperations {
157159
terminationGracePeriodSeconds: 60 * 60,
158160
containers: [
159161
{
160-
name: this.#getRunContainerName(opts.runId),
162+
name: containerName,
161163
image: opts.image,
162164
ports: [
163165
{
@@ -514,8 +516,8 @@ class KubernetesTaskOperations implements TaskOperations {
514516
return `task-index-${suffix}`;
515517
}
516518

517-
#getRunContainerName(suffix: string) {
518-
return `task-run-${suffix}`;
519+
#getRunContainerName(suffix: string, attemptNumber?: number) {
520+
return `task-run-${suffix}${attemptNumber && attemptNumber > 1 ? `-att${attemptNumber}` : ""}`;
519521
}
520522

521523
#getPrePullContainerName(suffix: string) {

0 commit comments

Comments
 (0)