From ebe1e328048158d3b59e8803eeaaba60f8190d4f Mon Sep 17 00:00:00 2001 From: Traian Schiau Date: Mon, 5 Feb 2024 19:05:24 +0200 Subject: [PATCH] Review remarks --- cmd/kueue/main.go | 2 +- .../admissionchecks/multikueue/multikueuecluster.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/kueue/main.go b/cmd/kueue/main.go index ea1acd7365..92dced5870 100644 --- a/cmd/kueue/main.go +++ b/cmd/kueue/main.go @@ -25,7 +25,6 @@ import ( // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. _ "k8s.io/client-go/plugin/pkg/client/auth" - "k8s.io/utils/ptr" zaplog "go.uber.org/zap" "go.uber.org/zap/zapcore" @@ -39,6 +38,7 @@ import ( "k8s.io/client-go/discovery" clientgoscheme "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" diff --git a/pkg/controller/admissionchecks/multikueue/multikueuecluster.go b/pkg/controller/admissionchecks/multikueue/multikueuecluster.go index 88a6e8f0c4..2375d34dab 100644 --- a/pkg/controller/admissionchecks/multikueue/multikueuecluster.go +++ b/pkg/controller/admissionchecks/multikueue/multikueuecluster.go @@ -162,13 +162,13 @@ func (rc *remoteClient) runGC(ctx context.Context) { // if the remote wl has a controller(owning Job), delete the job if controller := metav1.GetControllerOf(&remoteWl); controller != nil { - ownerKey := types.NamespacedName{Name: controller.Name, Namespace: remoteWl.Namespace} + ownerKey := klog.KRef(remoteWl.Namespace, controller.Name) adapterKey := schema.FromAPIVersionAndKind(controller.APIVersion, controller.Kind).String() if adapter, found := adapters[adapterKey]; !found { wlLog.V(2).Info("No adapter found", "adapterKey", adapterKey, "ownerKey", ownerKey) } else { wlLog.V(5).Info("MultiKueueGC deleting workload owner", "ownerKey", ownerKey, "ownnerKind", controller) - err := adapter.DeleteRemoteObject(ctx, rc.client, ownerKey) + err := adapter.DeleteRemoteObject(ctx, rc.client, types.NamespacedName{Name: controller.Name, Namespace: remoteWl.Namespace}) if client.IgnoreNotFound(err) != nil { wlLog.V(2).Error(err, "Deleting remote workload's owner", "ownerKey", ownerKey) } @@ -344,7 +344,7 @@ func (c *clustersReconciler) updateStatus(ctx context.Context, cluster *kueuealp } func (c *clustersReconciler) runGC(ctx context.Context) { - log := ctrl.LoggerFrom(ctx) + log := ctrl.LoggerFrom(ctx).WithName("MultiKueueGC") if c.gcInterval == 0 { log.V(2).Info("Garbage Collection is disabled") return