From 4ae4630ed8b4715dbaaef42ddf1d09485fe97158 Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Sat, 20 Jun 2020 12:29:04 +0100 Subject: [PATCH] feat: add undeploy makefile target --- docs/book/src/quick-start.md | 8 ++++++++ pkg/plugin/v3/scaffolds/internal/templates/makefile.go | 4 ++++ testdata/project-v3-addon/Makefile | 4 ++++ testdata/project-v3-multigroup/Makefile | 4 ++++ testdata/project-v3/Makefile | 4 ++++ 5 files changed, 24 insertions(+) diff --git a/docs/book/src/quick-start.md b/docs/book/src/quick-start.md index b4586890169..d137176422a 100644 --- a/docs/book/src/quick-start.md +++ b/docs/book/src/quick-start.md @@ -208,6 +208,14 @@ To delete your CRDs from the cluster: make uninstall ``` +## Undeploy controller + +UnDeploy the controller to the cluster: + +```bash +make undeploy +``` + ## Next Step Now, follow up the [CronJob tutorial][cronjob-tutorial] to better understand how it works by developing a demo example project. diff --git a/pkg/plugin/v3/scaffolds/internal/templates/makefile.go b/pkg/plugin/v3/scaffolds/internal/templates/makefile.go index 97420cba41d..a770146e3f3 100644 --- a/pkg/plugin/v3/scaffolds/internal/templates/makefile.go +++ b/pkg/plugin/v3/scaffolds/internal/templates/makefile.go @@ -94,6 +94,10 @@ deploy: manifests kustomize cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default | kubectl apply -f - +# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config +undeploy: + $(KUSTOMIZE) build config/default | kubectl delete -f - + # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases diff --git a/testdata/project-v3-addon/Makefile b/testdata/project-v3-addon/Makefile index f6362e191e3..4e59a64f967 100644 --- a/testdata/project-v3-addon/Makefile +++ b/testdata/project-v3-addon/Makefile @@ -38,6 +38,10 @@ deploy: manifests kustomize cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default | kubectl apply -f - +# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config +undeploy: + $(KUSTOMIZE) build config/default | kubectl delete -f - + # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases diff --git a/testdata/project-v3-multigroup/Makefile b/testdata/project-v3-multigroup/Makefile index f6362e191e3..4e59a64f967 100644 --- a/testdata/project-v3-multigroup/Makefile +++ b/testdata/project-v3-multigroup/Makefile @@ -38,6 +38,10 @@ deploy: manifests kustomize cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default | kubectl apply -f - +# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config +undeploy: + $(KUSTOMIZE) build config/default | kubectl delete -f - + # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases diff --git a/testdata/project-v3/Makefile b/testdata/project-v3/Makefile index f6362e191e3..4e59a64f967 100644 --- a/testdata/project-v3/Makefile +++ b/testdata/project-v3/Makefile @@ -38,6 +38,10 @@ deploy: manifests kustomize cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} $(KUSTOMIZE) build config/default | kubectl apply -f - +# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config +undeploy: + $(KUSTOMIZE) build config/default | kubectl delete -f - + # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases