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 2023/10/18 07:25:15 UTC

[camel-k] 01/02: feat(api): Kamelet as static resource

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

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

commit 92b4276ea521631155186a769e67dd72ef56ff77
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Oct 6 11:10:03 2023 +0200

    feat(api): Kamelet as static resource
    
    Remove the reconciliation loop and the kamelet.status property
---
 pkg/apis/camel/v1/kamelet_types.go           |   1 +
 pkg/cmd/describe_kamelet.go                  |   3 -
 pkg/cmd/kamelet_get.go                       |   3 +-
 pkg/controller/add_kamelet.go                |  26 ----
 pkg/controller/kamelet/action.go             |  54 -------
 pkg/controller/kamelet/initialize.go         |  48 ------
 pkg/controller/kamelet/kamelet_controller.go | 210 ---------------------------
 pkg/controller/kamelet/log.go                |  23 ---
 pkg/controller/kamelet/monitor.go            |  46 ------
 pkg/event/manager.go                         |  29 ----
 pkg/kamelet/initialize.go                    | 105 --------------
 pkg/trait/kamelets.go                        |  14 +-
 pkg/trait/kamelets_test.go                   |  10 --
 13 files changed, 4 insertions(+), 568 deletions(-)

diff --git a/pkg/apis/camel/v1/kamelet_types.go b/pkg/apis/camel/v1/kamelet_types.go
index 04730d4ac..9a3680fb8 100644
--- a/pkg/apis/camel/v1/kamelet_types.go
+++ b/pkg/apis/camel/v1/kamelet_types.go
@@ -64,6 +64,7 @@ type Kamelet struct {
 	// the desired specification
 	Spec KameletSpec `json:"spec,omitempty"`
 	// the actual status of the resource
+	// Deprecated no longer in use
 	Status KameletStatus `json:"status,omitempty"`
 }
 
diff --git a/pkg/cmd/describe_kamelet.go b/pkg/cmd/describe_kamelet.go
index c7267fd84..b8601b8b7 100644
--- a/pkg/cmd/describe_kamelet.go
+++ b/pkg/cmd/describe_kamelet.go
@@ -99,9 +99,6 @@ func (command *describeKameletCommandOptions) describeKamelet(cmd *cobra.Command
 		w := indentedwriter.NewWriter(cmd.OutOrStdout())
 
 		describeObjectMeta(w, kamelet.ObjectMeta)
-
-		w.Writef(0, "Phase:\t%s\n", kamelet.Status.Phase)
-
 		// Definition
 		def := kamelet.Spec.Definition
 		if def != nil {
diff --git a/pkg/cmd/kamelet_get.go b/pkg/cmd/kamelet_get.go
index 37e7023c7..707e30067 100644
--- a/pkg/cmd/kamelet_get.go
+++ b/pkg/cmd/kamelet_get.go
@@ -121,9 +121,8 @@ func (command *kameletGetCommandOptions) run(cmd *cobra.Command) error {
 			continue
 		}
 
-		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
+		fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\n",
 			kl.Name,
-			string(kl.Status.Phase),
 			klType,
 			group,
 			bundled,
diff --git a/pkg/controller/add_kamelet.go b/pkg/controller/add_kamelet.go
deleted file mode 100644
index bf3b2e524..000000000
--- a/pkg/controller/add_kamelet.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package controller
-
-import (
-	"github.com/apache/camel-k/v2/pkg/controller/kamelet"
-)
-
-func init() {
-	addToManager = append(addToManager, kamelet.Add)
-}
diff --git a/pkg/controller/kamelet/action.go b/pkg/controller/kamelet/action.go
deleted file mode 100644
index 618d2423e..000000000
--- a/pkg/controller/kamelet/action.go
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kamelet
-
-import (
-	"context"
-
-	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-	"github.com/apache/camel-k/v2/pkg/client"
-	"github.com/apache/camel-k/v2/pkg/util/log"
-)
-
-// Action --.
-type Action interface {
-	client.Injectable
-	log.Injectable
-
-	// a user friendly name for the action
-	Name() string
-
-	// returns true if the action can handle the kamelet
-	CanHandle(kamelet *v1.Kamelet) bool
-
-	// executes the handling function
-	Handle(ctx context.Context, kamelet *v1.Kamelet) (*v1.Kamelet, error)
-}
-
-type baseAction struct {
-	client client.Client
-	L      log.Logger
-}
-
-func (action *baseAction) InjectClient(client client.Client) {
-	action.client = client
-}
-
-func (action *baseAction) InjectLogger(log log.Logger) {
-	action.L = log
-}
diff --git a/pkg/controller/kamelet/initialize.go b/pkg/controller/kamelet/initialize.go
deleted file mode 100644
index 96845af49..000000000
--- a/pkg/controller/kamelet/initialize.go
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kamelet
-
-import (
-	"context"
-
-	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-	kameletutils "github.com/apache/camel-k/v2/pkg/kamelet"
-)
-
-// NewInitializeAction returns a action that initializes the kamelet configuration when not provided by the user.
-func NewInitializeAction() Action {
-	return &initializeAction{}
-}
-
-type initializeAction struct {
-	baseAction
-}
-
-func (action *initializeAction) Name() string {
-	return "initialize"
-}
-
-func (action *initializeAction) CanHandle(kamelet *v1.Kamelet) bool {
-	return kamelet.Status.Phase == v1.KameletPhaseNone
-}
-
-func (action *initializeAction) Handle(ctx context.Context, kamelet *v1.Kamelet) (*v1.Kamelet, error) {
-	action.L.Info("Initializing Kamelet")
-
-	return kameletutils.Initialize(kamelet)
-}
diff --git a/pkg/controller/kamelet/kamelet_controller.go b/pkg/controller/kamelet/kamelet_controller.go
deleted file mode 100644
index e005ff48d..000000000
--- a/pkg/controller/kamelet/kamelet_controller.go
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kamelet
-
-import (
-	"context"
-	goruntime "runtime"
-	"time"
-
-	k8serrors "k8s.io/apimachinery/pkg/api/errors"
-	"k8s.io/apimachinery/pkg/runtime"
-	"k8s.io/apimachinery/pkg/runtime/schema"
-	"k8s.io/client-go/tools/record"
-
-	"sigs.k8s.io/controller-runtime/pkg/builder"
-	ctrl "sigs.k8s.io/controller-runtime/pkg/client"
-	"sigs.k8s.io/controller-runtime/pkg/controller"
-	"sigs.k8s.io/controller-runtime/pkg/event"
-	"sigs.k8s.io/controller-runtime/pkg/manager"
-	"sigs.k8s.io/controller-runtime/pkg/reconcile"
-
-	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-
-	"github.com/apache/camel-k/v2/pkg/client"
-	camelevent "github.com/apache/camel-k/v2/pkg/event"
-	"github.com/apache/camel-k/v2/pkg/platform"
-	"github.com/apache/camel-k/v2/pkg/util/monitoring"
-)
-
-// Add creates a new Kamelet Controller and adds it to the Manager. The Manager will set fields on the Controller
-// and Start it when the Manager is Started.
-func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
-	return add(mgr, newReconciler(mgr, c))
-}
-
-func newReconciler(mgr manager.Manager, c client.Client) reconcile.Reconciler {
-	return monitoring.NewInstrumentedReconciler(
-		&reconcileKamelet{
-			client:   c,
-			scheme:   mgr.GetScheme(),
-			recorder: mgr.GetEventRecorderFor("camel-k-kamelet-controller"),
-		},
-		schema.GroupVersionKind{
-			Group:   v1.SchemeGroupVersion.Group,
-			Version: v1.SchemeGroupVersion.Version,
-			Kind:    v1.KameletKind,
-		},
-	)
-}
-
-func add(mgr manager.Manager, r reconcile.Reconciler) error {
-	return builder.ControllerManagedBy(mgr).
-		Named("kamelet-controller").
-		// Watch for changes to primary resource Kamelet
-		For(&v1.Kamelet{}, builder.WithPredicates(
-			platform.FilteringFuncs{
-				UpdateFunc: func(e event.UpdateEvent) bool {
-					oldKamelet, ok := e.ObjectOld.(*v1.Kamelet)
-					if !ok {
-						return false
-					}
-					newKamelet, ok := e.ObjectNew.(*v1.Kamelet)
-					if !ok {
-						return false
-					}
-					// Ignore updates to the Kamelet status in which case metadata.Generation
-					// does not change, or except when the Kamelet phase changes as it's used
-					// to transition from one phase to another
-					return oldKamelet.Generation != newKamelet.Generation ||
-						oldKamelet.Status.Phase != newKamelet.Status.Phase
-				},
-				DeleteFunc: func(e event.DeleteEvent) bool {
-					// Evaluates to false if the object has been confirmed deleted
-					return !e.DeleteStateUnknown
-				},
-			})).
-		WithOptions(controller.Options{
-			MaxConcurrentReconciles: goruntime.GOMAXPROCS(0),
-		}).
-		Complete(r)
-}
-
-var _ reconcile.Reconciler = &reconcileKamelet{}
-
-// reconcileKamelet reconciles a Kamelet object.
-type reconcileKamelet struct {
-	// This client, initialized using mgr.Client() above, is a split client
-	// that reads objects from the cache and writes to the API server
-	client   client.Client
-	scheme   *runtime.Scheme
-	recorder record.EventRecorder
-}
-
-// Reconcile reads that state of the cluster for a Kamelet object and makes changes based
-// on the state read and what is in the Kamelet.Spec
-// Note:
-// The Controller will requeue the Request to be processed again if the returned error is non-nil or
-// Result.Requeue is true, otherwise upon completion it will remove the work from the queue.
-func (r *reconcileKamelet) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error) {
-	rlog := Log.WithValues("request-namespace", request.Namespace, "request-name", request.Name)
-	rlog.Debug("Reconciling Kamelet")
-
-	// Make sure the operator is allowed to act on namespace
-	if ok, err := platform.IsOperatorAllowedOnNamespace(ctx, r.client, request.Namespace); err != nil {
-		return reconcile.Result{}, err
-	} else if !ok {
-		rlog.Info("Ignoring request because namespace is locked")
-		return reconcile.Result{}, nil
-	}
-
-	// Fetch the Kamelet instance
-	var instance v1.Kamelet
-
-	if err := r.client.Get(ctx, request.NamespacedName, &instance); err != nil {
-		if k8serrors.IsNotFound(err) {
-			// Request object not found, could have been deleted after reconcile request.
-			// Owned objects are automatically garbage collected. For additional cleanup
-			// logic use finalizers.
-
-			// Return and don't requeue
-			return reconcile.Result{}, nil
-		}
-		// Error reading the object - requeue the request.
-		return reconcile.Result{}, err
-	}
-
-	// Only process resources assigned to the operator
-	if !platform.IsOperatorHandlerConsideringLock(ctx, r.client, request.Namespace, &instance) {
-		rlog.Info("Ignoring request because resource is not assigned to current operator")
-		return reconcile.Result{}, nil
-	}
-
-	actions := []Action{
-		NewInitializeAction(),
-		NewMonitorAction(),
-	}
-
-	var targetPhase v1.KameletPhase
-	var err error
-
-	target := instance.DeepCopy()
-	targetLog := rlog.ForKamelet(target)
-
-	for _, a := range actions {
-		a.InjectClient(r.client)
-		a.InjectLogger(targetLog)
-
-		if !a.CanHandle(target) {
-			continue
-		}
-
-		targetLog.Debugf("Invoking action %s", a.Name())
-
-		phaseFrom := target.Status.Phase
-
-		target, err = a.Handle(ctx, target)
-		if err != nil {
-			camelevent.NotifyKameletError(ctx, r.client, r.recorder, &instance, target, err)
-			return reconcile.Result{}, err
-		}
-
-		if target != nil {
-			target.Status.ObservedGeneration = instance.GetGeneration()
-
-			if err := r.client.Status().Patch(ctx, target, ctrl.MergeFrom(&instance)); err != nil {
-				camelevent.NotifyKameletError(ctx, r.client, r.recorder, &instance, target, err)
-				return reconcile.Result{}, err
-			}
-
-			targetPhase = target.Status.Phase
-
-			if targetPhase != phaseFrom {
-				targetLog.Info(
-					"State transition",
-					"phase-from", phaseFrom,
-					"phase-to", target.Status.Phase,
-				)
-			}
-		}
-
-		// handle one action at time so the resource
-		// is always at its latest state
-		camelevent.NotifyKameletUpdated(ctx, r.client, r.recorder, &instance, target)
-		break
-	}
-
-	if targetPhase == v1.KameletPhaseReady {
-		return reconcile.Result{}, nil
-	}
-
-	// Requeue
-	return reconcile.Result{
-		RequeueAfter: 5 * time.Second,
-	}, nil
-}
diff --git a/pkg/controller/kamelet/log.go b/pkg/controller/kamelet/log.go
deleted file mode 100644
index 468c42b8e..000000000
--- a/pkg/controller/kamelet/log.go
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kamelet
-
-import "github.com/apache/camel-k/v2/pkg/util/log"
-
-// Log --.
-var Log = log.Log.WithName("controller").WithName("kamelet")
diff --git a/pkg/controller/kamelet/monitor.go b/pkg/controller/kamelet/monitor.go
deleted file mode 100644
index a3a655d0a..000000000
--- a/pkg/controller/kamelet/monitor.go
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kamelet
-
-import (
-	"context"
-
-	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-	kameletutils "github.com/apache/camel-k/v2/pkg/kamelet"
-)
-
-// NewMonitorAction returns an action that monitors the kamelet after it's fully initialized.
-func NewMonitorAction() Action {
-	return &monitorAction{}
-}
-
-type monitorAction struct {
-	baseAction
-}
-
-func (action *monitorAction) Name() string {
-	return "monitor"
-}
-
-func (action *monitorAction) CanHandle(kamelet *v1.Kamelet) bool {
-	return kamelet.Status.Phase == v1.KameletPhaseReady || kamelet.Status.Phase == v1.KameletPhaseError
-}
-
-func (action *monitorAction) Handle(ctx context.Context, kamelet *v1.Kamelet) (*v1.Kamelet, error) {
-	return kameletutils.Initialize(kamelet)
-}
diff --git a/pkg/event/manager.go b/pkg/event/manager.go
index 6c87aa579..106287b73 100644
--- a/pkg/event/manager.go
+++ b/pkg/event/manager.go
@@ -168,35 +168,6 @@ func NotifyIntegrationPlatformError(ctx context.Context, c client.Client, record
 	recorder.Eventf(p, corev1.EventTypeWarning, ReasonIntegrationPlatformError, "Cannot reconcile Integration Platform %s: %v", p.Name, err)
 }
 
-// NotifyKameletUpdated automatically generates events when a Kamelet changes.
-func NotifyKameletUpdated(ctx context.Context, c client.Client, recorder record.EventRecorder, old, newResource *v1.Kamelet) {
-	if newResource == nil {
-		return
-	}
-	oldPhase := ""
-	var oldConditions []v1.ResourceCondition
-	if old != nil {
-		oldPhase = string(old.Status.Phase)
-		oldConditions = old.Status.GetConditions()
-	}
-	if newResource.Status.Phase != v1.KameletPhaseNone {
-		notifyIfConditionUpdated(recorder, newResource, oldConditions, newResource.Status.GetConditions(), "Kamelet", newResource.Name, ReasonKameletConditionChanged)
-	}
-	notifyIfPhaseUpdated(ctx, c, recorder, newResource, oldPhase, string(newResource.Status.Phase), "Kamelet", newResource.Name, ReasonKameletPhaseUpdated, "")
-}
-
-// NotifyKameletError automatically generates error events when the kamelet reconcile cycle phase has an error.
-func NotifyKameletError(ctx context.Context, c client.Client, recorder record.EventRecorder, old, newResource *v1.Kamelet, err error) {
-	k := old
-	if newResource != nil {
-		k = newResource
-	}
-	if k == nil {
-		return
-	}
-	recorder.Eventf(k, corev1.EventTypeWarning, ReasonKameletError, "Cannot reconcile Kamelet %s: %v", k.Name, err)
-}
-
 // NotifyCamelCatalogUpdated automatically generates events when a CamelCatalog changes.
 func NotifyCamelCatalogUpdated(ctx context.Context, c client.Client, recorder record.EventRecorder, old, newResource *v1.CamelCatalog) {
 	if newResource == nil {
diff --git a/pkg/kamelet/initialize.go b/pkg/kamelet/initialize.go
deleted file mode 100644
index cce099784..000000000
--- a/pkg/kamelet/initialize.go
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package kamelet
-
-import (
-	"bytes"
-	"encoding/json"
-	"fmt"
-	"sort"
-
-	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
-
-	corev1 "k8s.io/api/core/v1"
-)
-
-func Initialize(kamelet *v1.Kamelet) (*v1.Kamelet, error) {
-	target := kamelet.DeepCopy()
-
-	ok := true
-	if !v1.ValidKameletName(kamelet.Name) {
-		ok = false
-		target.Status.SetCondition(
-			v1.KameletConditionReady,
-			corev1.ConditionFalse,
-			v1.KameletConditionReasonInvalidName,
-			fmt.Sprintf("Kamelet name %q is reserved", kamelet.Name),
-		)
-	}
-	if !v1.ValidKameletProperties(kamelet) {
-		ok = false
-		target.Status.SetCondition(
-			v1.KameletConditionReady,
-			corev1.ConditionFalse,
-			v1.KameletConditionReasonInvalidProperty,
-			fmt.Sprintf("Kamelet property %q is reserved and cannot be part of the schema", v1.KameletIDProperty),
-		)
-	}
-
-	if !ok {
-		target.Status.Phase = v1.KameletPhaseError
-	} else {
-		target.Status.Phase = v1.KameletPhaseReady
-		target.Status.SetCondition(
-			v1.KameletConditionReady,
-			corev1.ConditionTrue,
-			"",
-			"",
-		)
-		if err := recomputeProperties(target); err != nil {
-			return nil, err
-		}
-	}
-
-	return target, nil
-}
-
-func recomputeProperties(kamelet *v1.Kamelet) error {
-	if kamelet.Spec.Definition == nil {
-		return nil
-	}
-
-	kamelet.Status.Properties = make([]v1.KameletProperty, 0, len(kamelet.Spec.Definition.Properties))
-	propSet := make(map[string]bool)
-	for k, v := range kamelet.Spec.Definition.Properties {
-		if propSet[k] {
-			continue
-		}
-		propSet[k] = true
-		defValue := ""
-		if v.Default != nil {
-			var val interface{}
-			d := json.NewDecoder(bytes.NewReader(v.Default.RawMessage))
-			d.UseNumber()
-			if err := d.Decode(&val); err != nil {
-				return fmt.Errorf("cannot decode default value for property %q: %w", k, err)
-			}
-			defValue = fmt.Sprintf("%v", val)
-		}
-		kamelet.Status.Properties = append(kamelet.Status.Properties, v1.KameletProperty{
-			Name:    k,
-			Default: defValue,
-		})
-	}
-	sort.SliceStable(kamelet.Status.Properties, func(i, j int) bool {
-		pi := kamelet.Status.Properties[i].Name
-		pj := kamelet.Status.Properties[j].Name
-		return pi < pj
-	})
-	return nil
-}
diff --git a/pkg/trait/kamelets.go b/pkg/trait/kamelets.go
index 46629b24f..012e17835 100644
--- a/pkg/trait/kamelets.go
+++ b/pkg/trait/kamelets.go
@@ -31,8 +31,6 @@ import (
 
 	v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 	traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
-
-	kameletutils "github.com/apache/camel-k/v2/pkg/kamelet"
 	"github.com/apache/camel-k/v2/pkg/kamelet/repository"
 	"github.com/apache/camel-k/v2/pkg/platform"
 	"github.com/apache/camel-k/v2/pkg/util"
@@ -134,11 +132,7 @@ func (t *kameletsTrait) collectKamelets(e *Environment) (map[string]*v1.Kamelet,
 			missingKamelets = append(missingKamelets, key)
 		} else {
 			availableKamelets = append(availableKamelets, key)
-			// Initialize remote kamelets
-			kamelets[key], err = kameletutils.Initialize(kamelet)
-			if err != nil {
-				return nil, err
-			}
+			kamelets[key] = kamelet
 		}
 	}
 
@@ -180,14 +174,10 @@ func (t *kameletsTrait) addKamelets(e *Environment) error {
 		kb := newKameletBundle()
 		for _, key := range t.getKameletKeys() {
 			kamelet := kamelets[key]
-			if kamelet.Status.Phase != v1.KameletPhaseReady {
-				return fmt.Errorf("kamelet %q is not %s: %s", key, v1.KameletPhaseReady, kamelet.Status.Phase)
-			}
-			// Add source for parsing capabilities
 			if err := t.addKameletAsSource(e, kamelet); err != nil {
 				return err
 			}
-			// Adding explicit dependencies from Kamelets
+			// Adding dependencies from Kamelets
 			util.StringSliceUniqueConcat(&e.Integration.Status.Dependencies, kamelet.Spec.Dependencies)
 			// Add to Kamelet bundle configmap
 			kb.add(kamelet)
diff --git a/pkg/trait/kamelets_test.go b/pkg/trait/kamelets_test.go
index 483fcddc9..ea2bf5690 100644
--- a/pkg/trait/kamelets_test.go
+++ b/pkg/trait/kamelets_test.go
@@ -98,7 +98,6 @@ func TestKameletLookup(t *testing.T) {
 				"camel:log",
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	})
 	enabled, err := trait.Configure(environment)
 	require.NoError(t, err)
@@ -147,7 +146,6 @@ func TestKameletSecondarySourcesLookup(t *testing.T) {
 				},
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	})
 	enabled, err := trait.Configure(environment)
 	require.NoError(t, err)
@@ -198,7 +196,6 @@ func TestNonYAMLKameletLookup(t *testing.T) {
 				},
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	})
 	enabled, err := trait.Configure(environment)
 	require.NoError(t, err)
@@ -250,7 +247,6 @@ func TestMultipleKamelets(t *testing.T) {
 				"camel:xxx",
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	}, &v1.Kamelet{
 		ObjectMeta: metav1.ObjectMeta{
 			Namespace: "test",
@@ -274,7 +270,6 @@ func TestMultipleKamelets(t *testing.T) {
 				"camel:tbd",
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	})
 	enabled, err := trait.Configure(environment)
 	require.NoError(t, err)
@@ -336,7 +331,6 @@ func TestKameletConfigLookup(t *testing.T) {
 				"camel:log",
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	}, &corev1.Secret{
 		ObjectMeta: metav1.ObjectMeta{
 			Namespace: "test",
@@ -399,7 +393,6 @@ func TestKameletNamedConfigLookup(t *testing.T) {
 				"camel:log",
 			},
 		},
-		Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 	}, &corev1.Secret{
 		ObjectMeta: metav1.ObjectMeta{
 			Namespace: "test",
@@ -465,7 +458,6 @@ func TestKameletConditionFalse(t *testing.T) {
 					},
 				}),
 			},
-			Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 		})
 
 	enabled, err := trait.Configure(environment)
@@ -504,7 +496,6 @@ func TestKameletConditionTrue(t *testing.T) {
 					},
 				}),
 			},
-			Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 		},
 		&v1.Kamelet{
 			ObjectMeta: metav1.ObjectMeta{
@@ -518,7 +509,6 @@ func TestKameletConditionTrue(t *testing.T) {
 					},
 				}),
 			},
-			Status: v1.KameletStatus{Phase: v1.KameletPhaseReady},
 		})
 
 	enabled, err := trait.Configure(environment)