@@ -24,6 +24,7 @@ import (
2424 "github.com/pkg/errors"
2525 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626 "k8s.io/apimachinery/pkg/runtime/schema"
27+ "k8s.io/klog/v2"
2728 "sigs.k8s.io/controller-runtime/pkg/client"
2829 "sigs.k8s.io/controller-runtime/pkg/handler"
2930 "sigs.k8s.io/controller-runtime/pkg/reconcile"
@@ -63,23 +64,23 @@ func GetMachinePoolByName(ctx context.Context, c client.Client, namespace, name
6364func MachinePoolToInfrastructureMapFunc (gvk schema.GroupVersionKind , log logr.Logger ) handler.MapFunc {
6465 log = log .WithValues ("machine-pool-to-infra-map-func" , gvk .String ())
6566 return func (o client.Object ) []reconcile.Request {
66- log := log .WithValues ("namespace" , o .GetNamespace (), "name" , o .GetName ())
6767 m , ok := o .(* expv1.MachinePool )
6868 if ! ok {
69- log .V (4 ).Info ("not a machine pool" )
69+ log .V (4 ).Info ("Not a machine pool" , "Object" , klog . KObj ( o ) )
7070 return nil
7171 }
72+ log := log .WithValues ("MachinePool" , klog .KObj (o ))
7273
7374 gk := gvk .GroupKind ()
7475 ref := m .Spec .Template .Spec .InfrastructureRef
7576 // Return early if the GroupKind doesn't match what we expect.
7677 infraGK := ref .GroupVersionKind ().GroupKind ()
7778 if gk != infraGK {
78- log .V (4 ).Info ("infra kind doesn't match filter group kind" , "infrastructureGroupKind" , infraGK .String ())
79+ log .V (4 ).Info ("Infra kind doesn't match filter group kind" , "infrastructureGroupKind" , infraGK .String ())
7980 return nil
8081 }
8182
82- log .V (4 ).Info ("projecting object" , "namespace" , m . Namespace , "name" , ref . Name )
83+ log .V (4 ).Info ("Projecting object" )
8384 return []reconcile.Request {
8485 {
8586 NamespacedName : client.ObjectKey {
0 commit comments