Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 ClusterCacheTracker: drop unused Log field #6318

Merged
merged 1 commit into from Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions controllers/remote/cluster_cache_reconciler.go
Expand Up @@ -34,6 +34,7 @@ import (
// ClusterCacheReconciler is responsible for stopping remote cluster caches when
// the cluster for the remote cache is being deleted.
type ClusterCacheReconciler struct {
// Deprecated: this field is unused and will be dropped in an upcoming release.
Log logr.Logger
Client client.Client
Tracker *ClusterCacheTracker
Expand All @@ -44,6 +45,7 @@ type ClusterCacheReconciler struct {

func (r *ClusterCacheReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
err := ctrl.NewControllerManagedBy(mgr).
Named("remote/clustercache").
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabriziopandini I set the name here.

This will lead to a "controller": "remote/clustercache" k/v pair.

Before this PR the logs from this controller had "controller": "cluster" (same as the cluster controller).

Note: This info is based on controller-runtime main. The current v0.11 release will only use the name as prefix for messages ("controller/cluster: <msg>").

For(&clusterv1.Cluster{}).
WithOptions(options).
WithEventFilter(predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
Expand Down
3 changes: 0 additions & 3 deletions controllers/remote/cluster_cache_reconciler_test.go
Expand Up @@ -21,14 +21,12 @@ import (
"fmt"
"testing"

"github.com/go-logr/logr"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand Down Expand Up @@ -93,7 +91,6 @@ func TestClusterCacheReconciler(t *testing.T) {

t.Log("Creating the ClusterCacheReconciler")
r := &ClusterCacheReconciler{
Log: logr.New(log.NullLogSink{}),
Client: mgr.GetClient(),
Tracker: cct,
}
Expand Down
1 change: 0 additions & 1 deletion controlplane/kubeadm/main.go
Expand Up @@ -238,7 +238,6 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
Tracker: tracker,
WatchFilterValue: watchFilterValue,
}).SetupWithManager(ctx, mgr, concurrency(kubeadmControlPlaneConcurrency)); err != nil {
Expand Down
1 change: 0 additions & 1 deletion internal/controllers/cluster/suite_test.go
Expand Up @@ -77,7 +77,6 @@ func TestMain(m *testing.M) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
Tracker: tracker,
}).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to start ClusterCacheReconciler: %v", err))
Expand Down
1 change: 0 additions & 1 deletion internal/controllers/machine/suite_test.go
Expand Up @@ -80,7 +80,6 @@ func TestMain(m *testing.M) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
Tracker: tracker,
}).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to start ClusterCacheReconciler: %v", err))
Expand Down
1 change: 0 additions & 1 deletion internal/controllers/machinedeployment/suite_test.go
Expand Up @@ -84,7 +84,6 @@ func TestMain(m *testing.M) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
Tracker: tracker,
}).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to start ClusterCacheReconciler: %v", err))
Expand Down
1 change: 0 additions & 1 deletion internal/controllers/machinehealthcheck/suite_test.go
Expand Up @@ -80,7 +80,6 @@ func TestMain(m *testing.M) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
Tracker: tracker,
}).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to start ClusterCacheReconciler: %v", err))
Expand Down
1 change: 0 additions & 1 deletion internal/controllers/machineset/suite_test.go
Expand Up @@ -84,7 +84,6 @@ func TestMain(m *testing.M) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
Tracker: tracker,
}).SetupWithManager(ctx, mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
panic(fmt.Sprintf("Failed to start ClusterCacheReconciler: %v", err))
Expand Down
1 change: 0 additions & 1 deletion main.go
Expand Up @@ -283,7 +283,6 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
}
if err := (&remote.ClusterCacheReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("remote").WithName("ClusterCacheReconciler"),
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
Tracker: tracker,
WatchFilterValue: watchFilterValue,
}).SetupWithManager(ctx, mgr, concurrency(clusterConcurrency)); err != nil {
Expand Down