Merge pull request #7422 from Tashows/fix_detached_tty
Fix detached tty for k3s
This commit is contained in:
@@ -66,7 +66,7 @@ dokku run --no-tty node-js-app ls -lah
|
|||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> New as of 0.25.0
|
> New as of 0.25.0
|
||||||
|
|
||||||
Finally, a container can be run in "detached" mode via the `run:detached` Dokku command. Running a process in detached mode will immediately return a `CONTAINER_ID`. Detached containers are run without a tty and are also removed at the end of process execution.
|
Finally, a container can be run in "detached" mode via the `run:detached` Dokku command. Running a process in detached mode will immediately return the container name (or pod name when using the k3s scheduler). Detached containers run without a tty by default and are also removed at the end of process execution.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
dokku run:detached node-js-app ls -lah
|
dokku run:detached node-js-app ls -lah
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
|
|||||||
|
|
||||||
size := t.GetSize()
|
size := t.GetSize()
|
||||||
sizeQueue := t.MonitorSize(size)
|
sizeQueue := t.MonitorSize(size)
|
||||||
actuallyTty := sizeQueue != nil
|
actuallyTty := (sizeQueue != nil) || common.ToBool(os.Getenv("DOKKU_FORCE_TTY"))
|
||||||
|
|
||||||
if actuallyTty {
|
if actuallyTty {
|
||||||
req.Param("tty", "true")
|
req.Param("tty", "true")
|
||||||
|
|||||||
@@ -1142,7 +1142,7 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
|||||||
Image: image,
|
Image: image,
|
||||||
ImagePullSecrets: imagePullSecrets,
|
ImagePullSecrets: imagePullSecrets,
|
||||||
ImageSourceType: imageSourceType,
|
ImageSourceType: imageSourceType,
|
||||||
Interactive: attachToPod,
|
Interactive: attachToPod || common.ToBool(os.Getenv("DOKKU_FORCE_TTY")),
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
ProcessType: processType,
|
ProcessType: processType,
|
||||||
@@ -1192,7 +1192,7 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
|||||||
}
|
}
|
||||||
|
|
||||||
batchJobSelector := fmt.Sprintf("batch.kubernetes.io/job-name=%s", createdJob.Name)
|
batchJobSelector := fmt.Sprintf("batch.kubernetes.io/job-name=%s", createdJob.Name)
|
||||||
_, err = waitForPodToExist(ctx, WaitForPodToExistInput{
|
pods, err := waitForPodToExist(ctx, WaitForPodToExistInput{
|
||||||
Clientset: clientset,
|
Clientset: clientset,
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
RetryCount: 3,
|
RetryCount: 3,
|
||||||
@@ -1202,6 +1202,7 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
|||||||
return fmt.Errorf("Error waiting for pod to exist: %w", err)
|
return fmt.Errorf("Error waiting for pod to exist: %w", err)
|
||||||
}
|
}
|
||||||
if !attachToPod {
|
if !attachToPod {
|
||||||
|
fmt.Println(pods[0].Name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1254,7 +1255,7 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
|
|||||||
return fmt.Errorf("Error waiting for pod to be running: %w", err)
|
return fmt.Errorf("Error waiting for pod to be running: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pods, err := clientset.ListPods(ctx, ListPodsInput{
|
pods, err = clientset.ListPods(ctx, ListPodsInput{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
LabelSelector: batchJobSelector,
|
LabelSelector: batchJobSelector,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user