Skip to content

Commit

Permalink
Remove unused deprecated remote tracker
Browse files Browse the repository at this point in the history
Signed-off-by: Danil-Grigorev <[email protected]>
  • Loading branch information
Danil-Grigorev committed Dec 12, 2024
1 parent 9a131b4 commit e2642ad
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
38 changes: 1 addition & 37 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"sigs.k8s.io/cluster-api-operator/internal/webhook"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
"sigs.k8s.io/cluster-api/controllers/remote"
"sigs.k8s.io/cluster-api/util/flags"
"sigs.k8s.io/cluster-api/version"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -228,39 +227,11 @@ func setupChecks(mgr ctrl.Manager) {
}

func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
secretCachingClient, err := client.New(mgr.GetConfig(), client.Options{
HTTPClient: mgr.GetHTTPClient(),
Cache: &client.CacheOptions{
Reader: mgr.GetCache(),
},
})
if err != nil {
setupLog.Error(err, "unable to create secret caching client")
os.Exit(1)
}
// Set up a ClusterCacheTracker and ClusterCacheReconciler to provide to controllers
// requiring a connection to a remote cluster
tracker, err := remote.NewClusterCacheTracker(
mgr,
remote.ClusterCacheTrackerOptions{
SecretCachingClient: secretCachingClient,
ControllerName: "cluster-api-operator-controller",
Log: &ctrl.Log,
ClientQPS: clusterCacheTrackerClientQPS,
ClientBurst: clusterCacheTrackerClientBurst,
},
)
if err != nil {
setupLog.Error(err, "Unable to create cluster cache tracker")
os.Exit(1)
}

if err := (&providercontroller.GenericProviderReconciler{
Provider: &operatorv1.CoreProvider{},
ProviderList: &operatorv1.CoreProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "CoreProvider")
Expand All @@ -272,7 +243,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.InfrastructureProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "InfrastructureProvider")
Expand All @@ -284,7 +254,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.BootstrapProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "BootstrapProvider")
Expand All @@ -296,7 +265,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.ControlPlaneProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ControlPlaneProvider")
Expand All @@ -308,7 +276,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.AddonProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "AddonProvider")
Expand All @@ -320,7 +287,6 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.IPAMProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "IPAMProvider")
Expand All @@ -332,16 +298,14 @@ func setupReconcilers(mgr ctrl.Manager, watchConfigSecretChanges bool) {
ProviderList: &operatorv1.RuntimeExtensionProviderList{},
Client: mgr.GetClient(),
Config: mgr.GetConfig(),
Tracker: tracker,
WatchConfigSecretChanges: watchConfigSecretChanges,
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "RuntimeExtensionProvider")
os.Exit(1)
}

if err := (&healtchcheckcontroller.ProviderHealthCheckReconciler{
Client: mgr.GetClient(),
Tracker: tracker,
Client: mgr.GetClient(),
}).SetupWithManager(mgr, concurrency(concurrencyNumber)); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Healthcheck")
os.Exit(1)
Expand Down
2 changes: 0 additions & 2 deletions internal/controller/genericprovider_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
"sigs.k8s.io/cluster-api-operator/internal/controller/genericprovider"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/remote"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/cluster-api/util/patch"
ctrl "sigs.k8s.io/controller-runtime"
Expand All @@ -48,7 +47,6 @@ type GenericProviderReconciler struct {
ProviderList genericprovider.GenericProviderList
Client client.Client
Config *rest.Config
Tracker *remote.ClusterCacheTracker
WatchConfigSecretChanges bool
}

Expand Down
4 changes: 1 addition & 3 deletions internal/controller/healthcheck/healthcheck_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
kerrors "k8s.io/apimachinery/pkg/util/errors"
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/cluster-api/controllers/remote"
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/cluster-api/util/patch"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -61,8 +60,7 @@ const providerLabelKey = "cluster.x-k8s.io/provider"
var deploymentPredicate predicate.Predicate

type ProviderHealthCheckReconciler struct {
Client client.Client
Tracker *remote.ClusterCacheTracker
Client client.Client
}

type GenericProviderHealthCheckReconciler struct {
Expand Down

0 comments on commit e2642ad

Please sign in to comment.