diff --git a/garden-service/src/commands/run/module.ts b/garden-service/src/commands/run/module.ts index 5f215626dd..faca2784b4 100644 --- a/garden-service/src/commands/run/module.ts +++ b/garden-service/src/commands/run/module.ts @@ -106,6 +106,7 @@ export class RunModuleCommand extends Command { args: args.arguments || [], runtimeContext, interactive: opts.interactive, + timeout: opts.interactive ? 999999 : undefined, }) return { result } diff --git a/garden-service/src/commands/run/service.ts b/garden-service/src/commands/run/service.ts index f42171fea2..7b30d161c8 100644 --- a/garden-service/src/commands/run/service.ts +++ b/garden-service/src/commands/run/service.ts @@ -78,6 +78,7 @@ export class RunServiceCommand extends Command { service, runtimeContext, interactive: true, + timeout: 999999, }) return { result } diff --git a/garden-service/src/plugins/kubernetes/run.ts b/garden-service/src/plugins/kubernetes/run.ts index f9f5f2ccf2..f4895af520 100644 --- a/garden-service/src/plugins/kubernetes/run.ts +++ b/garden-service/src/plugins/kubernetes/run.ts @@ -60,12 +60,19 @@ export async function runPod( }) } + if (interactive) { + spec.containers[0].stdin = true + spec.containers[0].stdinOnce = true + spec.containers[0].tty = true + } + + const runPodName = podName || `run-${module.name}-${Math.round(new Date().getTime())}` + const kubecmd = [ "run", - podName || `run-${module.name}-${Math.round(new Date().getTime())}`, + runPodName, `--image=${image}`, "--restart=Never", - "--quiet", "--rm", // Need to attach to get the log output and exit code. "-i", @@ -75,10 +82,12 @@ export async function runPod( if (interactive) { kubecmd.push("--tty") + } else { + kubecmd.push("--quiet") } const command = [...spec.containers[0].command || [], ...spec.containers[0].args || []] - log.verbose(`Running '${command.join(" ")}'`) + log.verbose(`Running '${command.join(" ")}' in Pod ${runPodName}`) const startedAt = new Date()