From 65f92eaecaacc68f12729ef36671c0cff76a92b1 Mon Sep 17 00:00:00 2001 From: Abhijit Mukherjee Date: Tue, 26 Mar 2024 16:23:30 +0530 Subject: [PATCH] Addressed review comments Signed-off-by: Abhijit Mukherjee --- pkg/function/kube_task.go | 1 - pkg/kube/utils.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/function/kube_task.go b/pkg/function/kube_task.go index da9064084f..f2f4b869cb 100644 --- a/pkg/function/kube_task.go +++ b/pkg/function/kube_task.go @@ -64,7 +64,6 @@ func kubeTask(ctx context.Context, cli kubernetes.Interface, namespace, image st Command: command, PodOverride: podOverride, } - // Mark labels to pods with prefix `kanister.io`. Add the jobID as reference to the origin for the pod. kube.AddDebugLabelsToPodOptions(ctx, options, consts.LabelPrefix, "JobID") diff --git a/pkg/kube/utils.go b/pkg/kube/utils.go index affbb8f3a7..ded358a760 100644 --- a/pkg/kube/utils.go +++ b/pkg/kube/utils.go @@ -23,7 +23,6 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/client-go/kubernetes" - "github.com/kanisterio/kanister/pkg/consts" "github.com/kanisterio/kanister/pkg/field" ) @@ -179,14 +178,15 @@ func PVCContainsReadOnlyAccessMode(pvc *corev1.PersistentVolumeClaim) bool { // AddDebugLabelsToPodOptions adds additional label selector to `PodOptions`, // provided the context has a key starting with `keyPrefix`. func AddDebugLabelsToPodOptions(ctx context.Context, options *PodOptions, keyPrefix, keySuffix string) { - if fields := field.FromContext(ctx); fields != nil { + fields := field.FromContext(ctx) + if fields != nil { for _, f := range fields.Fields() { if strings.HasPrefix(f.Key(), keyPrefix) { value := f.Value().(string) if options.Labels == nil { options.Labels = make(map[string]string) } - options.Labels[consts.LabelPrefix+keySuffix] = value + options.Labels[keyPrefix+keySuffix] = value } } }