From df6c3a6530fabc7d36d3463388f9a888b0a94edc Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Fri, 4 Nov 2022 22:04:13 -0300 Subject: [PATCH] Specify k6 container when reading logs Signed-off-by: Marcos Candeia --- controllers/k6_initialize.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/k6_initialize.go b/controllers/k6_initialize.go index 34a9dc6a..ef3a6090 100644 --- a/controllers/k6_initialize.go +++ b/controllers/k6_initialize.go @@ -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") @@ -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()