You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/12/22 10:02:43 UTC

[camel-k] branch main updated (d5eaf94c1 -> f83b7979f)

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

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


    from d5eaf94c1 fix(controller): Ready condition status using container trait value
     new e7fa22cba feat(kustomize): add uninstall target to Makefile
     new 18e023465 chore(kustomize): add commented cli options to IntegrationPlatform example patch
     new f83b7979f test(e2e): add E2E tests for kustomize uninstall

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 config/samples/patch-integration-platform.yaml    |   9 +-
 e2e/namespace/install/kustomize/common.go         |  10 +-
 e2e/namespace/install/kustomize/operator_test.go  |  52 ++++++----
 e2e/namespace/install/kustomize/setup_test.go     |  14 +--
 e2e/namespace/install/kustomize/uninstall_test.go | 112 ++++++++++++++++++++++
 e2e/support/test_support.go                       |  32 +++----
 install/Makefile                                  |  56 +++++++++--
 7 files changed, 230 insertions(+), 55 deletions(-)
 create mode 100644 e2e/namespace/install/kustomize/uninstall_test.go


[camel-k] 03/03: test(e2e): add E2E tests for kustomize uninstall

Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f83b7979ffc999a162b6d1de53a6b8b5080eee8c
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Thu Dec 22 15:54:27 2022 +0900

    test(e2e): add E2E tests for kustomize uninstall
---
 e2e/namespace/install/kustomize/common.go         |  10 +-
 e2e/namespace/install/kustomize/operator_test.go  |  52 ++++++----
 e2e/namespace/install/kustomize/setup_test.go     |  14 +--
 e2e/namespace/install/kustomize/uninstall_test.go | 112 ++++++++++++++++++++++
 e2e/support/test_support.go                       |  32 +++----
 install/Makefile                                  |  14 ++-
 6 files changed, 184 insertions(+), 50 deletions(-)

diff --git a/e2e/namespace/install/kustomize/common.go b/e2e/namespace/install/kustomize/common.go
index 15cc9bec4..856aa6233 100644
--- a/e2e/namespace/install/kustomize/common.go
+++ b/e2e/namespace/install/kustomize/common.go
@@ -58,7 +58,7 @@ const (
 	ExpectedOSClusterRoles = 1
 )
 
-func ExecMake(t *testing.T, command *exec.Cmd) {
+func ExpectExecSucceed(t *testing.T, command *exec.Cmd) {
 	t.Helper()
 
 	var cmdOut strings.Builder
@@ -74,14 +74,14 @@ func ExecMake(t *testing.T, command *exec.Cmd) {
 	session, err := gexec.Start(command, &cmdOut, &cmdErr)
 	session.Wait()
 	Eventually(session).Should(gexec.Exit(0))
-	assert.Nil(t, err)
+	assert.NoError(t, err)
 	assert.NotContains(t, strings.ToUpper(cmdErr.String()), "ERROR")
 }
 
 //
-// Expect a make error with an exit code of 1
+// Expect a command error with an exit code of 1
 //
-func ExecMakeError(t *testing.T, command *exec.Cmd) {
+func ExpectExecError(t *testing.T, command *exec.Cmd) {
 	t.Helper()
 
 	var cmdOut strings.Builder
@@ -97,7 +97,7 @@ func ExecMakeError(t *testing.T, command *exec.Cmd) {
 	session, err := gexec.Start(command, &cmdOut, &cmdErr)
 	session.Wait()
 	Eventually(session).ShouldNot(gexec.Exit(0))
-	assert.Nil(t, err)
+	assert.NoError(t, err)
 	assert.Contains(t, strings.ToUpper(cmdErr.String()), "ERROR")
 }
 
diff --git a/e2e/namespace/install/kustomize/operator_test.go b/e2e/namespace/install/kustomize/operator_test.go
index 63ee49ddf..06c52f4cd 100644
--- a/e2e/namespace/install/kustomize/operator_test.go
+++ b/e2e/namespace/install/kustomize/operator_test.go
@@ -27,12 +27,14 @@ import (
 	"os"
 	"testing"
 
+	corev1 "k8s.io/api/core/v1"
+
 	. "github.com/apache/camel-k/e2e/support"
 	testutil "github.com/apache/camel-k/e2e/support/util"
 	. "github.com/onsi/gomega"
 )
 
-func TestBasicOperator(t *testing.T) {
+func TestOperatorBasic(t *testing.T) {
 	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
 	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
 
@@ -43,18 +45,24 @@ func TestBasicOperator(t *testing.T) {
 	defer Cleanup()
 
 	WithNewTestNamespace(t, func(ns string) {
-		ExecMake(t, Make("setup-cluster", fmt.Sprintf("NAMESPACE=%s", ns)))
-		ExecMake(t, Make("setup", fmt.Sprintf("NAMESPACE=%s", ns)))
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
+		ExpectExecSucceed(t, Make("setup", namespaceArg))
 		// Skip default kamelets installation for faster test runs
-		ExecMake(t, Make("operator",
-			fmt.Sprintf("NAMESPACE=%s", ns),
+		ExpectExecSucceed(t, Make("operator",
+			namespaceArg,
 			"INSTALL_DEFAULT_KAMELETS=false"))
 
+		// Refresh the test client to account for the newly installed CRDs
+		SyncClient()
+
 		Eventually(OperatorPod(ns)).ShouldNot(BeNil())
+		Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+		Eventually(Platform(ns)).ShouldNot(BeNil())
 	})
 }
 
-func TestAlternativeImageOperator(t *testing.T) {
+func TestOperatorAlternativeImage(t *testing.T) {
 	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
 	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
 
@@ -65,24 +73,27 @@ func TestAlternativeImageOperator(t *testing.T) {
 	defer Cleanup()
 
 	WithNewTestNamespace(t, func(ns string) {
-
-		ExecMake(t, Make("setup-cluster", fmt.Sprintf("NAMESPACE=%s", ns)))
-		ExecMake(t, Make("setup", fmt.Sprintf("NAMESPACE=%s", ns)))
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
+		ExpectExecSucceed(t, Make("setup", namespaceArg))
 
 		// Skip default kamelets installation for faster test runs
 		newImage := "quay.io/kameltest/kamel-operator"
 		newTag := "1.1.1"
-		ExecMake(t, Make("operator",
+		ExpectExecSucceed(t, Make("operator",
 			fmt.Sprintf("CUSTOM_IMAGE=%s", newImage),
 			fmt.Sprintf("CUSTOM_VERSION=%s", newTag),
-			fmt.Sprintf("NAMESPACE=%s", ns),
+			namespaceArg,
 			"INSTALL_DEFAULT_KAMELETS=false"))
 
+		// Refresh the test client to account for the newly installed CRDs
+		SyncClient()
+
 		Eventually(OperatorImage(ns)).Should(Equal(fmt.Sprintf("%s:%s", newImage, newTag)))
 	})
 }
 
-func TestGlobalOperator(t *testing.T) {
+func TestOperatorGlobal(t *testing.T) {
 	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
 	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
 
@@ -93,17 +104,22 @@ func TestGlobalOperator(t *testing.T) {
 	defer Cleanup()
 
 	WithNewTestNamespace(t, func(ns string) {
-		ExecMake(t, Make("setup-cluster", fmt.Sprintf("NAMESPACE=%s", ns)))
-		ExecMake(t, Make("setup", fmt.Sprintf("NAMESPACE=%s", ns), "GLOBAL=true"))
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
+		ExpectExecSucceed(t, Make("setup", namespaceArg, "GLOBAL=true"))
 
 		// Skip default kamelets installation for faster test runs
-		ExecMake(t, Make("operator",
-			fmt.Sprintf("NAMESPACE=%s", ns),
+		ExpectExecSucceed(t, Make("operator",
+			namespaceArg,
 			"GLOBAL=true",
 			"INSTALL_DEFAULT_KAMELETS=false"))
 
+		// Refresh the test client to account for the newly installed CRDs
+		SyncClient()
+
 		podFunc := OperatorPod(ns)
-		Eventually(podFunc).Should(Not(BeNil()))
+		Eventually(podFunc).ShouldNot(BeNil())
+		Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
 		pod := podFunc()
 
 		containers := pod.Spec.Containers
@@ -121,5 +137,7 @@ func TestGlobalOperator(t *testing.T) {
 			}
 		}
 		Expect(found).To(BeTrue())
+
+		Eventually(Platform(ns)).ShouldNot(BeNil())
 	})
 }
diff --git a/e2e/namespace/install/kustomize/setup_test.go b/e2e/namespace/install/kustomize/setup_test.go
index eef0b1a40..cbe412bd4 100644
--- a/e2e/namespace/install/kustomize/setup_test.go
+++ b/e2e/namespace/install/kustomize/setup_test.go
@@ -32,7 +32,7 @@ import (
 	. "github.com/onsi/gomega"
 )
 
-func TestBasicSetup(t *testing.T) {
+func TestSetupBasic(t *testing.T) {
 	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
 	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
 
@@ -43,10 +43,11 @@ func TestBasicSetup(t *testing.T) {
 	defer Cleanup()
 
 	WithNewTestNamespace(t, func(ns string) {
-		ExecMake(t, Make("setup-cluster", fmt.Sprintf("NAMESPACE=%s", ns)))
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
 		Eventually(CRDs()).Should(HaveLen(ExpectedCRDs))
 
-		ExecMake(t, Make("setup", fmt.Sprintf("NAMESPACE=%s", ns)))
+		ExpectExecSucceed(t, Make("setup", namespaceArg))
 
 		kpRoles := ExpectedKubePromoteRoles
 		opRoles := kpRoles + ExpectedOSPromoteRoles
@@ -62,7 +63,7 @@ func TestBasicSetup(t *testing.T) {
 
 }
 
-func TestGlobalSetup(t *testing.T) {
+func TestSetupGlobal(t *testing.T) {
 	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
 	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
 
@@ -73,10 +74,11 @@ func TestGlobalSetup(t *testing.T) {
 	defer Cleanup()
 
 	WithNewTestNamespace(t, func(ns string) {
-		ExecMake(t, Make("setup-cluster", fmt.Sprintf("NAMESPACE=%s", ns)))
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
 		Eventually(CRDs()).Should(HaveLen(ExpectedCRDs))
 
-		ExecMake(t, Make("setup", "GLOBAL=true", fmt.Sprintf("NAMESPACE=%s", ns)))
+		ExpectExecSucceed(t, Make("setup", "GLOBAL=true", namespaceArg))
 
 		Eventually(Role(ns)).Should(HaveLen(0))
 
diff --git a/e2e/namespace/install/kustomize/uninstall_test.go b/e2e/namespace/install/kustomize/uninstall_test.go
new file mode 100644
index 000000000..3b89c9500
--- /dev/null
+++ b/e2e/namespace/install/kustomize/uninstall_test.go
@@ -0,0 +1,112 @@
+//go:build integration
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+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 kustomize
+
+import (
+	"fmt"
+	"os"
+	"testing"
+
+	. "github.com/apache/camel-k/e2e/support"
+	testutil "github.com/apache/camel-k/e2e/support/util"
+	. "github.com/onsi/gomega"
+)
+
+func TestUninstallBasic(t *testing.T) {
+	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
+	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
+
+	// Ensure no CRDs are already installed
+	UninstallAll()
+
+	// Return the cluster to previous state
+	defer Cleanup()
+
+	WithNewTestNamespace(t, func(ns string) {
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
+		ExpectExecSucceed(t, Make("setup", namespaceArg))
+		ExpectExecSucceed(t, Make("platform", namespaceArg))
+		// Skip default kamelets installation for faster test runs
+		ExpectExecSucceed(t, Make("operator", namespaceArg, "INSTALL_DEFAULT_KAMELETS=false"))
+		Eventually(OperatorPod(ns)).ShouldNot(BeNil())
+
+		// Do uninstall
+		ExpectExecSucceed(t, Make("uninstall", namespaceArg))
+
+		// Refresh the test client to account for the newly installed CRDs
+		SyncClient()
+
+		Eventually(OperatorPod(ns)).Should(BeNil())
+		Eventually(Platform(ns)).Should(BeNil())
+		Eventually(Role(ns)).Should(BeNil())
+		Eventually(ClusterRole()).Should(BeNil())
+		// CRDs should be still there
+		Eventually(CRDs()).Should(HaveLen(ExpectedCRDs))
+
+		// Do uninstall all
+		ExpectExecSucceed(t, Make("uninstall", namespaceArg, "UNINSTALL_ALL=true"))
+
+		Eventually(CRDs()).Should(BeNil())
+	})
+
+}
+
+func TestUninstallGlobal(t *testing.T) {
+	makeDir := testutil.MakeTempCopyDir(t, "../../../../install")
+	os.Setenv("CAMEL_K_TEST_MAKE_DIR", makeDir)
+
+	// Ensure no CRDs are already installed
+	UninstallAll()
+
+	// Return the cluster to previous state
+	defer Cleanup()
+
+	WithNewTestNamespace(t, func(ns string) {
+		namespaceArg := fmt.Sprintf("NAMESPACE=%s", ns)
+		ExpectExecSucceed(t, Make("setup-cluster", namespaceArg))
+		ExpectExecSucceed(t, Make("setup", namespaceArg, "GLOBAL=true"))
+		ExpectExecSucceed(t, Make("platform", namespaceArg))
+		// Skip default kamelets installation for faster test runs
+		ExpectExecSucceed(t, Make("operator", namespaceArg, "GLOBAL=true", "INSTALL_DEFAULT_KAMELETS=false"))
+		Eventually(OperatorPod(ns)).ShouldNot(BeNil())
+
+		// Do uninstall
+		ExpectExecSucceed(t, Make("uninstall", namespaceArg))
+
+		// Refresh the test client to account for the newly installed CRDs
+		SyncClient()
+
+		Eventually(OperatorPod(ns)).Should(BeNil())
+		Eventually(Platform(ns)).Should(BeNil())
+		Eventually(Role(ns)).Should(BeNil())
+		Eventually(ClusterRole()).Should(BeNil())
+		// CRDs should be still there
+		Eventually(CRDs()).Should(HaveLen(ExpectedCRDs))
+
+		// Do uninstall all
+		ExpectExecSucceed(t, Make("uninstall", namespaceArg, "UNINSTALL_ALL=true"))
+
+		Eventually(CRDs()).Should(BeNil())
+	})
+}
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 973e54c98..21c565c04 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -115,6 +115,7 @@ func setTestLocus(t *testing.T) {
 //
 func failTest(err error) {
 	if testLocus != nil {
+		testLocus.Helper()
 		testLocus.Error(err)
 		testLocus.FailNow()
 	} else {
@@ -708,8 +709,7 @@ func Nodes() func() []corev1.Node {
 				APIVersion: corev1.SchemeGroupVersion.String(),
 			},
 		}
-		err := TestClient().List(TestContext, nodes)
-		if err != nil {
+		if err := TestClient().List(TestContext, nodes); err != nil {
 			failTest(err)
 		}
 		return nodes.Items
@@ -825,12 +825,11 @@ func IntegrationCronJob(ns string, name string) func() *batchv1.CronJob {
 				APIVersion: batchv1.SchemeGroupVersion.String(),
 			},
 		}
-		err := TestClient().List(TestContext, &lst,
+		if err := TestClient().List(TestContext, &lst,
 			ctrl.InNamespace(ns),
 			ctrl.MatchingLabels{
 				"camel.apache.org/integration": name,
-			})
-		if err != nil {
+			}); err != nil {
 			failTest(err)
 		}
 		if len(lst.Items) == 0 {
@@ -1273,12 +1272,11 @@ func AutogeneratedConfigmapsCount(ns string) func() int {
 				APIVersion: corev1.SchemeGroupVersion.String(),
 			},
 		}
-		err := TestClient().List(TestContext, &lst,
+		if err := TestClient().List(TestContext, &lst,
 			ctrl.InNamespace(ns),
 			ctrl.MatchingLabels{
 				kubernetes.ConfigMapAutogenLabel: "true",
-			})
-		if err != nil {
+			}); err != nil {
 			failTest(err)
 		}
 		return len(lst.Items)
@@ -1667,12 +1665,11 @@ func OperatorPod(ns string) func() *corev1.Pod {
 				APIVersion: v1.SchemeGroupVersion.String(),
 			},
 		}
-		err := TestClient().List(TestContext, &lst,
+		if err := TestClient().List(TestContext, &lst,
 			ctrl.InNamespace(namespace),
 			ctrl.MatchingLabels{
 				"camel.apache.org/component": "operator",
-			})
-		if err != nil {
+			}); err != nil {
 			failTest(err)
 		}
 		if len(lst.Items) == 0 {
@@ -1717,11 +1714,10 @@ func ClusterRole() func() []rbacv1.ClusterRole {
 				APIVersion: rbacv1.SchemeGroupVersion.String(),
 			},
 		}
-		err := TestClient().List(TestContext, &lst,
+		if err := TestClient().List(TestContext, &lst,
 			ctrl.MatchingLabels{
 				"app": "camel-k",
-			})
-		if err != nil {
+			}); err != nil {
 			failTest(err)
 		}
 		if len(lst.Items) == 0 {
@@ -1783,12 +1779,11 @@ func ServiceAccount(ns, name string) func() *corev1.ServiceAccount {
 				APIVersion: corev1.SchemeGroupVersion.String(),
 			},
 		}
-		err := TestClient().List(TestContext, &lst,
+		if err := TestClient().List(TestContext, &lst,
 			ctrl.InNamespace(ns),
 			ctrl.MatchingLabels{
 				"app": "camel-k",
-			})
-		if err != nil {
+			}); err != nil {
 			failTest(err)
 		}
 		if len(lst.Items) == 0 {
@@ -1801,8 +1796,7 @@ func ServiceAccount(ns, name string) func() *corev1.ServiceAccount {
 func KameletList(ns string) func() []v1alpha1.Kamelet {
 	return func() []v1alpha1.Kamelet {
 		lst := v1alpha1.NewKameletList()
-		err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns))
-		if err != nil {
+		if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns)); err != nil {
 			failTest(err)
 		}
 		return lst.Items
diff --git a/install/Makefile b/install/Makefile
index 945e64b60..6aab1d77f 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -318,7 +318,7 @@ ifeq ($(MONITORING), true)
 else
 	@$(call add-remove-operator-monitoring,$@,remove)
 endif
-# Set the namespace in the setup kustomization yaml
+# Set the namespace in the operator kustomization yaml
 	@$(call set-kustomize-namespace,$@)
 # Set the image reference of the kustomization
 	@$(call set-kustomize-image,$@)
@@ -391,7 +391,7 @@ endif
 platform: have-platform kustomize kubectl
 # Cannot be a dependency as PLATFORM could contain 'ERROR: '
 	@$(MAKE) .platform-$(PLATFORM)-patch
-# Set the namespace in the setup kustomization yaml
+# Set the namespace in the platform kustomization yaml
 	@$(call set-kustomize-namespace,$@)
 ifeq ($(DRY_RUN), false)
 	@$(KUSTOMIZE) build $(KOPTIONS) $@ | kubectl apply -f -
@@ -414,7 +414,7 @@ endif
 #
 #---
 example: kubectl
-# Set the namespace in the setup kustomization yaml
+# Set the namespace in the example kustomization yaml
 	@$(call set-kustomize-namespace,$@)
 ifeq ($(DRY_RUN), false)
 	@$(KUSTOMIZE) build $(KOPTIONS) $@ | kubectl apply -f -
@@ -433,11 +433,19 @@ endif
 #=== Cluster-admin privileges are required.
 #
 #* PARAMETERS:
+#** NAMESPACE:     Set the namespace to uninstall the resources from
 #** UNINSTALL_ALL: Uninstall all Camel K resources including crds and cluster roles installed by setup-cluster [true|false]
 #** DRY_RUN:       Print the resources to be applied instead of applying them [true|false]
 #
 #---
 uninstall: kubectl
+# Set the namespace in the all target kustomization yaml
+	@$(call set-kustomize-namespace, platform)
+	@$(call set-kustomize-namespace, operator)
+	@$(call set-kustomize-namespace, setup)
+ifeq ($(UNINSTALL_ALL), true)
+	@$(call set-kustomize-namespace, setup-cluster)
+endif
 ifeq ($(DRY_RUN), false)
 	@$(KUSTOMIZE) build $(KOPTIONS) platform | kubectl delete --ignore-not-found=true -f -
 	@$(KUSTOMIZE) build $(KOPTIONS) operator | kubectl delete --ignore-not-found=true -f -


[camel-k] 02/03: chore(kustomize): add commented cli options to IntegrationPlatform example patch

Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 18e023465bd6ecaacdacb5b92e032a39d3a7a3c1
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Mon Dec 19 15:37:07 2022 +0900

    chore(kustomize): add commented cli options to IntegrationPlatform example patch
---
 config/samples/patch-integration-platform.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/config/samples/patch-integration-platform.yaml b/config/samples/patch-integration-platform.yaml
index 75ab2dfdd..f53bd4783 100644
--- a/config/samples/patch-integration-platform.yaml
+++ b/config/samples/patch-integration-platform.yaml
@@ -73,6 +73,13 @@ spec:
     #
     maven:
     #
+    # CLI options passed to the Maven commands to be executed
+    #
+    # cliOptions:
+    #   - --show-version
+    #   - --batch-mode
+    #
+    #
     # Location of the local Maven repository
     #
     #  localRepository: my.repository.url


[camel-k] 01/03: feat(kustomize): add uninstall target to Makefile

Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e7fa22cbada5608c83d4c127ed847c8d51e2e453
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Fri Dec 16 23:08:18 2022 +0900

    feat(kustomize): add uninstall target to Makefile
---
 config/samples/patch-integration-platform.yaml |  2 --
 install/Makefile                               | 42 ++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/config/samples/patch-integration-platform.yaml b/config/samples/patch-integration-platform.yaml
index 4af3fedc8..75ab2dfdd 100644
--- a/config/samples/patch-integration-platform.yaml
+++ b/config/samples/patch-integration-platform.yaml
@@ -123,11 +123,9 @@ spec:
     #
     #  insecure: true | false
   kamelet: {}
-  resources: {}
 status:
   build:
     maven:
       settings: {}
     registry: {}
   kamelet: {}
-  resources: {}
diff --git a/install/Makefile b/install/Makefile
index 7c998bbb7..945e64b60 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -19,6 +19,8 @@
 #
 SHELL := /bin/bash
 
+MAKE := make --no-print-directory
+
 #
 # Allows for resources to be loaded from outside the root location of
 # the kustomize config file. Ensures that resource don't need to be
@@ -58,6 +60,8 @@ HEALTH_PORT ?= 8081
 LOGGING_LEVEL ?= info
 # Install default kamelets: [true|false]
 INSTALL_DEFAULT_KAMELETS ?= true
+# Uninstall all Camel K resources: [true|false]
+UNINSTALL_ALL ?=false
 
 CONFIG := config
 MANAGER := $(CONFIG)/manager
@@ -288,7 +292,7 @@ endif
 #
 #@ operator
 #
-#== Install the operator deployment and related resources
+#== Install the operator deployment and related resources.
 #
 #=== Cluster-admin privileges are required.
 #
@@ -374,7 +378,7 @@ endif
 #
 #@ platform
 #
-#== Install the integration platform
+#== Install the integration platform.
 #
 #=== Cluster-admin privileges are required.
 #
@@ -401,7 +405,7 @@ endif
 #
 #@ example
 #
-#== Installs the example integration
+#== Install the example integration.
 #
 #* PARAMETERS:
 #** NAMESPACE: Set the namespace to install the example into
@@ -418,6 +422,38 @@ else
 	@$(KUSTOMIZE) build $(KOPTIONS) $@
 endif
 
+.PHONY: uninstall
+
+#---
+#
+#@ uninstall
+#
+#== Uninstall the resources previously installed by the platform, operator, setup, and setup-cluster targets.
+#
+#=== Cluster-admin privileges are required.
+#
+#* PARAMETERS:
+#** UNINSTALL_ALL: Uninstall all Camel K resources including crds and cluster roles installed by setup-cluster [true|false]
+#** DRY_RUN:       Print the resources to be applied instead of applying them [true|false]
+#
+#---
+uninstall: kubectl
+ifeq ($(DRY_RUN), false)
+	@$(KUSTOMIZE) build $(KOPTIONS) platform | kubectl delete --ignore-not-found=true -f -
+	@$(KUSTOMIZE) build $(KOPTIONS) operator | kubectl delete --ignore-not-found=true -f -
+	@$(KUSTOMIZE) build $(KOPTIONS) setup    | kubectl delete --ignore-not-found=true -f -
+ifeq ($(UNINSTALL_ALL), true)
+	@$(KUSTOMIZE) build $(KOPTIONS) setup-cluster | kubectl delete --ignore-not-found=true -f -
+endif
+else
+	@$(KUSTOMIZE) build $(KOPTIONS) platform | kubectl delete --dry-run=client -f -
+	@$(KUSTOMIZE) build $(KOPTIONS) operator | kubectl delete --dry-run=client -f -
+	@$(KUSTOMIZE) build $(KOPTIONS) setup    | kubectl delete --dry-run=client -f -
+ifeq ($(UNINSTALL_ALL), true)
+	@$(KUSTOMIZE) build $(KOPTIONS) setup-cluster | kubectl delete --dry-run=client -f -
+endif
+endif
+
 .DEFAULT_GOAL := help
 .PHONY: help
 help: ## Show this help screen.