You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2021/07/16 10:51:57 UTC

[camel-k] 03/03: fix(cli): kamel uninstall should skip user-defined kamelets

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

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

commit fd7cb09dd8466bf37460f9141694b6d1db5a8418
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Tue Jul 13 16:05:16 2021 +0900

    fix(cli): kamel uninstall should skip user-defined kamelets
---
 pkg/cmd/uninstall.go | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pkg/cmd/uninstall.go b/pkg/cmd/uninstall.go
index e974fc0..5d1ad04 100644
--- a/pkg/cmd/uninstall.go
+++ b/pkg/cmd/uninstall.go
@@ -274,7 +274,7 @@ func (o *uninstallCmdOptions) uninstallNamespaceResources(ctx context.Context, c
 		if err := o.uninstallKamelets(ctx, c); err != nil {
 			return err
 		}
-		fmt.Printf("Kamelets removed from namespace %s\n", o.Namespace)
+		fmt.Printf("Camel K platform Kamelets removed from namespace %s\n", o.Namespace)
 	}
 
 	return nil
@@ -479,9 +479,12 @@ func (o *uninstallCmdOptions) uninstallKamelets(ctx context.Context, c client.Cl
 	}
 
 	for _, kamelet := range kameletList.Items {
-		err := c.Delete(ctx, &kamelet)
-		if err != nil {
-			return err
+		// remove only platform Kamelets (use-defined Kamelets should be skipped)
+		if kamelet.Labels[v1alpha1.KameletBundledLabel] == "true" {
+			err := c.Delete(ctx, &kamelet)
+			if err != nil {
+				return err
+			}
 		}
 	}