diff --git a/controllers/asosecret_controller.go b/controllers/asosecret_controller.go index 2765633bfa7..a7b1fe0fcde 100644 --- a/controllers/asosecret_controller.go +++ b/controllers/asosecret_controller.go @@ -116,7 +116,7 @@ func (asos *ASOSecretReconciler) Reconcile(ctx context.Context, req ctrl.Request ) defer done() - log = log.WithValues("namespace", req.Namespace, "AzureCluster", req.Name) + log = log.WithValues("namespace", req.Namespace) // asoSecretOwner is the resource that created the identity. This could be either an AzureCluster or AzureManagedControlPlane (if AKS is enabled). // check for AzureCluster first and if it is not found, check for AzureManagedControlPlane. diff --git a/controllers/azureidentity_controller.go b/controllers/azureidentity_controller.go index b1175b820ab..e1f20de53ff 100644 --- a/controllers/azureidentity_controller.go +++ b/controllers/azureidentity_controller.go @@ -151,8 +151,6 @@ func (r *AzureIdentityReconciler) Reconcile(ctx context.Context, req ctrl.Reques var bindingsToDelete []aadpodv1.AzureIdentityBinding for _, b := range bindings.Items { - log = log.WithValues("azureidentitybinding", b.Name) - binding := b clusterName := binding.ObjectMeta.Labels[clusterv1.ClusterNameLabel] clusterNamespace := binding.ObjectMeta.Labels[infrav1.ClusterLabelNamespace] diff --git a/controllers/helpers.go b/controllers/helpers.go index 49746b8b481..97de96a198d 100644 --- a/controllers/helpers.go +++ b/controllers/helpers.go @@ -103,7 +103,7 @@ func AzureClusterToAzureMachinesMapper(ctx context.Context, c client.Client, obj return nil } - log = log.WithValues("AzureCluster", azCluster.Name, "Namespace", azCluster.Namespace) + log := log.WithValues("AzureCluster", azCluster.Name, "Namespace", azCluster.Namespace) // Don't handle deleted AzureClusters if !azCluster.ObjectMeta.DeletionTimestamp.IsZero() { @@ -750,7 +750,7 @@ func AzureManagedClusterToAzureManagedMachinePoolsMapper(ctx context.Context, c return nil } - log = log.WithValues("AzureManagedCluster", azCluster.Name, "Namespace", azCluster.Namespace) + log := log.WithValues("AzureManagedCluster", azCluster.Name, "Namespace", azCluster.Namespace) // Don't handle deleted AzureManagedClusters if !azCluster.ObjectMeta.DeletionTimestamp.IsZero() { @@ -803,7 +803,7 @@ func AzureManagedControlPlaneToAzureManagedMachinePoolsMapper(ctx context.Contex return nil } - log = log.WithValues("AzureManagedControlPlane", azControlPlane.Name, "Namespace", azControlPlane.Namespace) + log := log.WithValues("AzureManagedControlPlane", azControlPlane.Name, "Namespace", azControlPlane.Namespace) // Don't handle deleted AzureManagedControlPlanes if !azControlPlane.ObjectMeta.DeletionTimestamp.IsZero() { @@ -850,7 +850,7 @@ func AzureManagedClusterToAzureManagedControlPlaneMapper(ctx context.Context, c return nil } - log = log.WithValues("AzureManagedCluster", azCluster.Name, "Namespace", azCluster.Namespace) + log := log.WithValues("AzureManagedCluster", azCluster.Name, "Namespace", azCluster.Namespace) // Don't handle deleted AzureManagedClusters if !azCluster.ObjectMeta.DeletionTimestamp.IsZero() { @@ -899,7 +899,7 @@ func AzureManagedControlPlaneToAzureManagedClusterMapper(ctx context.Context, c return nil } - log = log.WithValues("AzureManagedControlPlane", azManagedControlPlane.Name, "Namespace", azManagedControlPlane.Namespace) + log := log.WithValues("AzureManagedControlPlane", azManagedControlPlane.Name, "Namespace", azManagedControlPlane.Namespace) // Don't handle deleted AzureManagedControlPlanes if !azManagedControlPlane.ObjectMeta.DeletionTimestamp.IsZero() { diff --git a/exp/controllers/helpers.go b/exp/controllers/helpers.go index e15238fbd8f..dfa908b0b7d 100644 --- a/exp/controllers/helpers.go +++ b/exp/controllers/helpers.go @@ -63,7 +63,7 @@ func AzureClusterToAzureMachinePoolsMapper(ctx context.Context, c client.Client, return nil } - log = log.WithValues("AzureCluster", azCluster.Name, "Namespace", azCluster.Namespace) + log := log.WithValues("AzureCluster", azCluster.Name, "Namespace", azCluster.Namespace) // Don't handle deleted AzureClusters if !azCluster.ObjectMeta.DeletionTimestamp.IsZero() { @@ -116,7 +116,7 @@ func AzureManagedControlPlaneToAzureMachinePoolsMapper(ctx context.Context, c cl return nil } - log = log.WithValues("AzureManagedControlPlane", azControlPlane.Name, "Namespace", azControlPlane.Namespace) + log := log.WithValues("AzureManagedControlPlane", azControlPlane.Name, "Namespace", azControlPlane.Namespace) // Don't handle deleted AzureManagedControlPlane if !azControlPlane.ObjectMeta.DeletionTimestamp.IsZero() { @@ -165,7 +165,7 @@ func AzureMachinePoolMachineMapper(scheme *runtime.Scheme, log logr.Logger) hand return nil } - log = log.WithValues("AzureMachinePoolMachine", azureMachinePoolMachine.Name, "Namespace", azureMachinePoolMachine.Namespace) + log := log.WithValues("AzureMachinePoolMachine", azureMachinePoolMachine.Name, "Namespace", azureMachinePoolMachine.Namespace) for _, ref := range azureMachinePoolMachine.OwnerReferences { if ref.Kind != gvk.Kind { continue