Fix k3s run:detached not returning pod name in a similar fashion to docker-local (as described in docs)

This commit is contained in:
Tasos Maschalidis
2024-12-17 18:53:30 +02:00
parent 838beb4db3
commit f786c8c0bc

View File

@@ -1192,7 +1192,7 @@ func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []
}
batchJobSelector := fmt.Sprintf("batch.kubernetes.io/job-name=%s", createdJob.Name)
_, err = waitForPodToExist(ctx, WaitForPodToExistInput{
pods, err := waitForPodToExist(ctx, WaitForPodToExistInput{
Clientset: clientset,
Namespace: namespace,
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)
}
if !attachToPod {
fmt.Println(pods[0].Name)
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)
}
pods, err := clientset.ListPods(ctx, ListPodsInput{
pods, err = clientset.ListPods(ctx, ListPodsInput{
Namespace: namespace,
LabelSelector: batchJobSelector,
})