Skip to content

Commit 1db1757

Browse files
zhujian7claude
andcommitted
Rename addonFilterFunc to cmaFilterFunc for clarity
The filter function parameter is specifically used for ClusterManagementAddon objects, so the new name cmaFilterFunc is more descriptive and accurate than the generic addonFilterFunc. Signed-off-by: Claude <[email protected]> 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]> Signed-off-by: zhujian <[email protected]>
1 parent 7f19b89 commit 1db1757

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

pkg/addonmanager/controllers/addonconfig/controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type addonConfigController struct {
3636
addonIndexer cache.Indexer
3737
configListers map[schema.GroupResource]dynamiclister.Lister
3838
queue workqueue.TypedRateLimitingInterface[string]
39-
addonFilterFunc factory.EventFilterFunc
39+
cmaFilterFunc factory.EventFilterFunc
4040
configGVRs map[schema.GroupVersionResource]bool
4141
clusterManagementAddonLister addonlisterv1alpha1.ClusterManagementAddOnLister
4242
}
@@ -47,7 +47,7 @@ func NewAddonConfigController(
4747
clusterManagementAddonInformers addoninformerv1alpha1.ClusterManagementAddOnInformer,
4848
configInformerFactory dynamicinformer.DynamicSharedInformerFactory,
4949
configGVRs map[schema.GroupVersionResource]bool,
50-
addonFilterFunc factory.EventFilterFunc,
50+
cmaFilterFunc factory.EventFilterFunc,
5151
) factory.Controller {
5252
syncCtx := factory.NewSyncContext(controllerName)
5353

@@ -57,7 +57,7 @@ func NewAddonConfigController(
5757
addonIndexer: addonInformers.Informer().GetIndexer(),
5858
configListers: map[schema.GroupResource]dynamiclister.Lister{},
5959
queue: syncCtx.Queue(),
60-
addonFilterFunc: addonFilterFunc,
60+
cmaFilterFunc: cmaFilterFunc,
6161
configGVRs: configGVRs,
6262
clusterManagementAddonLister: clusterManagementAddonInformers.Lister(),
6363
}
@@ -153,7 +153,7 @@ func (c *addonConfigController) sync(ctx context.Context, syncCtx factory.SyncCo
153153
return err
154154
}
155155

156-
if !c.addonFilterFunc(cma) {
156+
if !c.cmaFilterFunc(cma) {
157157
return nil
158158
}
159159

pkg/addonmanager/controllers/addonconfig/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func TestSync(t *testing.T) {
371371
addonLister: addonInformers.Addon().V1alpha1().ManagedClusterAddOns().Lister(),
372372
clusterManagementAddonLister: addonInformers.Addon().V1alpha1().ClusterManagementAddOns().Lister(),
373373
configListers: map[schema.GroupResource]dynamiclister.Lister{},
374-
addonFilterFunc: func(obj interface{}) bool { return true },
374+
cmaFilterFunc: func(obj interface{}) bool { return true },
375375
configGVRs: map[schema.GroupVersionResource]bool{fakeGVR: true},
376376
}
377377

pkg/addonmanager/controllers/cmaconfig/controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type cmaConfigController struct {
3737
clusterManagementAddonIndexer cache.Indexer
3838
configListers map[schema.GroupResource]dynamiclister.Lister
3939
queue workqueue.TypedRateLimitingInterface[string]
40-
addonFilterFunc factory.EventFilterFunc
40+
cmaFilterFunc factory.EventFilterFunc
4141
configGVRs map[schema.GroupVersionResource]bool
4242
addonPatcher patcher.Patcher[*addonapiv1alpha1.ClusterManagementAddOn,
4343
addonapiv1alpha1.ClusterManagementAddOnSpec,
@@ -49,7 +49,7 @@ func NewCMAConfigController(
4949
clusterManagementAddonInformers addoninformerv1alpha1.ClusterManagementAddOnInformer,
5050
configInformerFactory dynamicinformer.DynamicSharedInformerFactory,
5151
configGVRs map[schema.GroupVersionResource]bool,
52-
addonFilterFunc factory.EventFilterFunc,
52+
cmaFilterFunc factory.EventFilterFunc,
5353
) factory.Controller {
5454
syncCtx := factory.NewSyncContext(controllerName)
5555

@@ -59,7 +59,7 @@ func NewCMAConfigController(
5959
clusterManagementAddonIndexer: clusterManagementAddonInformers.Informer().GetIndexer(),
6060
configListers: map[schema.GroupResource]dynamiclister.Lister{},
6161
queue: syncCtx.Queue(),
62-
addonFilterFunc: addonFilterFunc,
62+
cmaFilterFunc: cmaFilterFunc,
6363
configGVRs: configGVRs,
6464
addonPatcher: patcher.NewPatcher[*addonapiv1alpha1.ClusterManagementAddOn,
6565
addonapiv1alpha1.ClusterManagementAddOnSpec,
@@ -145,7 +145,7 @@ func (c *cmaConfigController) sync(ctx context.Context, syncCtx factory.SyncCont
145145
return err
146146
}
147147

148-
if !c.addonFilterFunc(cma) {
148+
if !c.cmaFilterFunc(cma) {
149149
return nil
150150
}
151151

pkg/addonmanager/controllers/cmaconfig/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func TestSync(t *testing.T) {
259259
addonClient: fakeAddonClient,
260260
clusterManagementAddonLister: addonInformers.Addon().V1alpha1().ClusterManagementAddOns().Lister(),
261261
configListers: map[schema.GroupResource]dynamiclister.Lister{},
262-
addonFilterFunc: func(obj interface{}) bool { return true },
262+
cmaFilterFunc: func(obj interface{}) bool { return true },
263263
configGVRs: map[schema.GroupVersionResource]bool{fakeGVR: true},
264264
addonPatcher: patcher.NewPatcher[*addonapiv1alpha1.ClusterManagementAddOn,
265265
addonapiv1alpha1.ClusterManagementAddOnSpec,

pkg/addonmanager/controllers/cmamanagedby/controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type cmaManagedByController struct {
2929
addonClient addonv1alpha1client.Interface
3030
clusterManagementAddonLister addonlisterv1alpha1.ClusterManagementAddOnLister
3131
agentAddons map[string]agent.AgentAddon
32-
addonFilterFunc factory.EventFilterFunc
32+
cmaFilterFunc factory.EventFilterFunc
3333
addonPatcher patcher.Patcher[*addonapiv1alpha1.ClusterManagementAddOn,
3434
addonapiv1alpha1.ClusterManagementAddOnSpec,
3535
addonapiv1alpha1.ClusterManagementAddOnStatus]
@@ -39,15 +39,15 @@ func NewCMAManagedByController(
3939
addonClient addonv1alpha1client.Interface,
4040
clusterManagementAddonInformers addoninformerv1alpha1.ClusterManagementAddOnInformer,
4141
agentAddons map[string]agent.AgentAddon,
42-
addonFilterFunc factory.EventFilterFunc,
42+
cmaFilterFunc factory.EventFilterFunc,
4343
) factory.Controller {
4444
syncCtx := factory.NewSyncContext(controllerName)
4545

4646
c := &cmaManagedByController{
4747
addonClient: addonClient,
4848
clusterManagementAddonLister: clusterManagementAddonInformers.Lister(),
4949
agentAddons: agentAddons,
50-
addonFilterFunc: addonFilterFunc,
50+
cmaFilterFunc: cmaFilterFunc,
5151
addonPatcher: patcher.NewPatcher[*addonapiv1alpha1.ClusterManagementAddOn,
5252
addonapiv1alpha1.ClusterManagementAddOnSpec,
5353
addonapiv1alpha1.ClusterManagementAddOnStatus](addonClient.AddonV1alpha1().ClusterManagementAddOns()),
@@ -60,7 +60,7 @@ func NewCMAManagedByController(
6060
key, _ := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
6161
return []string{key}
6262
},
63-
c.addonFilterFunc, clusterManagementAddonInformers.Informer()).
63+
c.cmaFilterFunc, clusterManagementAddonInformers.Informer()).
6464
WithSync(c.sync).ToController(controllerName)
6565
}
6666

pkg/addonmanager/controllers/cmamanagedby/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func TestReconcile(t *testing.T) {
114114
addonClient: fakeAddonClient,
115115
clusterManagementAddonLister: addonInformers.Addon().V1alpha1().ClusterManagementAddOns().Lister(),
116116
agentAddons: c.testaddons,
117-
addonFilterFunc: utils.FilterByAddonName(c.testaddons),
117+
cmaFilterFunc: utils.FilterByAddonName(c.testaddons),
118118
addonPatcher: patcher.NewPatcher[*addonapiv1alpha1.ClusterManagementAddOn,
119119
addonapiv1alpha1.ClusterManagementAddOnSpec,
120120
addonapiv1alpha1.ClusterManagementAddOnStatus](fakeAddonClient.AddonV1alpha1().ClusterManagementAddOns()),

0 commit comments

Comments
 (0)