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:44 UTC
[camel-k] 01/03: feat(kustomize): add uninstall target to Makefile
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.