Skip to content

Commit

Permalink
Specify k6 container when reading logs
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Candeia <[email protected]>
  • Loading branch information
mcandeia committed Nov 5, 2022
1 parent 6117d20 commit df6c3a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/k6_initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func InitializeJobs(ctx context.Context, log logr.Logger, k6 *v1alpha1.K6, r *K6
// recommended to use REST client instead:
// https://github.com/kubernetes-sigs/controller-runtime/issues/1229

var opts corev1.PodLogOptions
config, err := rest.InClusterConfig()
if err != nil {
log.Error(err, "unable to fetch in-cluster REST config")
Expand All @@ -107,7 +106,9 @@ func InitializeJobs(ctx context.Context, log logr.Logger, k6 *v1alpha1.K6, r *K6
// don't return here
return false, nil
}
req := clientset.CoreV1().Pods(k6.Namespace).GetLogs(podList.Items[0].Name, &opts)
req := clientset.CoreV1().Pods(k6.Namespace).GetLogs(podList.Items[0].Name, &corev1.PodLogOptions{
Container: "k6",
})
ctx, cancel := context.WithTimeout(context.Background(), time.Second*60)
defer cancel()

Expand Down

0 comments on commit df6c3a6

Please sign in to comment.