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 } } }