Skip to content

Commit

Permalink
fix reconciler kv in our reconciler loggers
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer [email protected]
  • Loading branch information
sbueringer committed Aug 27, 2021
1 parent cdc9347 commit 92c05ad
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 30 deletions.
6 changes: 2 additions & 4 deletions bootstrap/kubeadm/controllers/kubeadmconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ type Scope struct {
}

// SetupWithManager sets up the reconciler with the Manager.
func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, option controller.Options) error {
option.Log = mgr.GetLogger().WithValues("KubeadmConfig")

func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
if r.KubeadmInitLock == nil {
r.KubeadmInitLock = locking.NewControlPlaneInitMutex(ctrl.LoggerFrom(ctx).WithName("init-locker"), mgr.GetClient())
}
Expand All @@ -99,7 +97,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl

b := ctrl.NewControllerManagedBy(mgr).
For(&bootstrapv1.KubeadmConfig{}).
WithOptions(option).
WithOptions(options).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
Watches(
&source.Kind{Type: &clusterv1.Machine{}},
Expand Down
2 changes: 0 additions & 2 deletions controllers/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ type ClusterReconciler struct {
}

func (r *ClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("Cluster")

controller, err := ctrl.NewControllerManagedBy(mgr).
For(&clusterv1.Cluster{}).
Watches(
Expand Down
2 changes: 0 additions & 2 deletions controllers/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ type MachineReconciler struct {
}

func (r *MachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("Machine")

clusterToMachines, err := util.ClusterToObjectsMapper(mgr.GetClient(), &clusterv1.MachineList{}, mgr.GetScheme())
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions controllers/machinedeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ type MachineDeploymentReconciler struct {
}

func (r *MachineDeploymentReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("MachineDeployment")

clusterToMachineDeployments, err := util.ClusterToObjectsMapper(mgr.GetClient(), &clusterv1.MachineDeploymentList{}, mgr.GetScheme())
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions controllers/machinehealthcheck_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ type MachineHealthCheckReconciler struct {
}

func (r *MachineHealthCheckReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("MachineHealthCheck")

controller, err := ctrl.NewControllerManagedBy(mgr).
For(&clusterv1.MachineHealthCheck{}).
Watches(
Expand Down
2 changes: 0 additions & 2 deletions controllers/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ type MachineSetReconciler struct {
}

func (r *MachineSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("MachineSet")

clusterToMachineSets, err := util.ClusterToObjectsMapper(mgr.GetClient(), &clusterv1.MachineSetList{}, mgr.GetScheme())
if err != nil {
return err
Expand Down
2 changes: 0 additions & 2 deletions controllers/remote/cluster_cache_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ type ClusterCacheReconciler struct {
}

func (r *ClusterCacheReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("ClusterCache")

_, err := ctrl.NewControllerManagedBy(mgr).
For(&clusterv1.Cluster{}).
WithOptions(options).
Expand Down
1 change: 1 addition & 0 deletions controllers/topology/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type ClusterReconciler struct {
func (r *ClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
c, err := ctrl.NewControllerManagedBy(mgr).
For(&clusterv1.Cluster{}).
Named("cluster/topology").
Watches(
&source.Kind{Type: &clusterv1.ClusterClass{}},
handler.EnqueueRequestsFromMapFunc(r.clusterClassToCluster),
Expand Down
2 changes: 0 additions & 2 deletions controlplane/kubeadm/controllers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ type KubeadmControlPlaneReconciler struct {
}

func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("KubeadmControlPlane")

c, err := ctrl.NewControllerManagedBy(mgr).
For(&controlplanev1.KubeadmControlPlane{}).
Owns(&clusterv1.Machine{}).
Expand Down
2 changes: 0 additions & 2 deletions exp/addons/controllers/clusterresourceset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ type ClusterResourceSetReconciler struct {
}

func (r *ClusterResourceSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("ClusterResourceSet")

err := ctrl.NewControllerManagedBy(mgr).
For(&addonsv1.ClusterResourceSet{}).
Watches(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ type ClusterResourceSetBindingReconciler struct {
}

func (r *ClusterResourceSetBindingReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("ClusterResourceSetBinding")

_, err := ctrl.NewControllerManagedBy(mgr).
For(&addonsv1.ClusterResourceSetBinding{}).
Watches(
Expand Down
2 changes: 0 additions & 2 deletions exp/controllers/machinepool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ type MachinePoolReconciler struct {
}

func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("MachinePool")

clusterToMachinePools, err := util.ClusterToObjectsMapper(mgr.GetClient(), &expv1.MachinePoolList{}, mgr.GetScheme())
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ func (r *DockerClusterReconciler) reconcileDelete(ctx context.Context, dockerClu

// SetupWithManager will add watches for this controller.
func (r *DockerClusterReconciler) SetupWithManager(mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("DockerCluster")
c, err := ctrl.NewControllerManagedBy(mgr).
For(&infrav1.DockerCluster{}).
WithOptions(options).
WithEventFilter(predicates.ResourceNotPaused(r.Log)).
Build(r)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ func (r *DockerMachineReconciler) reconcileDelete(ctx context.Context, machine *

// SetupWithManager will add watches for this controller.
func (r *DockerMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("DockerMachine")

clusterToDockerMachines, err := util.ClusterToObjectsMapper(mgr.GetClient(), &infrav1.DockerMachineList{}, mgr.GetScheme())
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type DockerMachinePoolReconciler struct {

func (r *DockerMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, rerr error) {
log := ctrl.LoggerFrom(ctx)

// Fetch the DockerMachinePool instance.
dockerMachinePool := &infrav1exp.DockerMachinePool{}
if err := r.Client.Get(ctx, req.NamespacedName, dockerMachinePool); err != nil {
Expand Down Expand Up @@ -125,8 +124,6 @@ func (r *DockerMachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Re

// SetupWithManager will add watches for this controller.
func (r *DockerMachinePoolReconciler) SetupWithManager(mgr ctrl.Manager, options controller.Options) error {
options.Log = mgr.GetLogger().WithValues("DockerMachinePool")

clusterToDockerMachinePools, err := util.ClusterToObjectsMapper(mgr.GetClient(), &infrav1exp.DockerMachinePoolList{}, mgr.GetScheme())
if err != nil {
return err
Expand Down

0 comments on commit 92c05ad

Please sign in to comment.