You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2026/04/19 07:13:47 UTC

(camel-k) 05/06: chore(controller): move catalog action declarations from reconcile to init

This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 12d41ac17050627d27f1238852f2c4c8f384cf6b
Author: chaojixinren <ch...@163.com>
AuthorDate: Fri Apr 17 15:39:38 2026 +0800

    chore(controller): move catalog action declarations from reconcile to init
---
 pkg/controller/catalog/catalog_controller.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkg/controller/catalog/catalog_controller.go b/pkg/controller/catalog/catalog_controller.go
index 58aa4eacb..bfdf5e0ba 100644
--- a/pkg/controller/catalog/catalog_controller.go
+++ b/pkg/controller/catalog/catalog_controller.go
@@ -57,6 +57,10 @@ func newReconciler(mgr manager.Manager, c client.Client) reconcile.Reconciler {
 			client:   c,
 			scheme:   mgr.GetScheme(),
 			recorder: mgr.GetEventRecorder("camel-k-catalog-controller"),
+			actions: []Action{
+				NewInitializeAction(),
+				NewMonitorAction(),
+			},
 		},
 		schema.GroupVersionKind{
 			Group:   v1.SchemeGroupVersion.Group,
@@ -107,6 +111,7 @@ type reconcileCatalog struct {
 	client   client.Client
 	scheme   *runtime.Scheme
 	recorder events.EventRecorder
+	actions  []Action
 }
 
 // Reconcile reads that state of the cluster for a catalog object and makes changes based
@@ -150,18 +155,13 @@ func (r *reconcileCatalog) Reconcile(ctx context.Context, request reconcile.Requ
 		return reconcile.Result{}, nil
 	}
 
-	actions := []Action{
-		NewInitializeAction(),
-		NewMonitorAction(),
-	}
-
 	var targetPhase v1.CamelCatalogPhase
 	var err error
 
 	target := instance.DeepCopy()
 	targetLog := rlog.ForCatalog(target)
 
-	for _, a := range actions {
+	for _, a := range r.actions {
 		a.InjectClient(r.client)
 		a.InjectLogger(targetLog)