Skip to content

Commit

Permalink
Update make uninstall (#191)
Browse files Browse the repository at this point in the history
* Update uninstall

- create and delete authorino-operator namespace (requied by make
  install-authorino)
- add make uninstall-authorino
- add make uninstall-cert-manager
- update make uninstall

* Refactor deployment commands to have `<action>` and `un<action>`
- `<action>` = runs deps + action itself; safe to run if deps already present
- `un<action>` = undo the action only
  • Loading branch information
Boomatang committed Jul 25, 2024
1 parent 7e2fb1b commit 189abfd
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 14 deletions.
28 changes: 22 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,9 @@ docker-push: ## Push docker image with the manager.

##@ Deployment

install: manifests kustomize install-authorino ## Install CRDs into the K8s cluster specified in ~/.kube/config.
kubectl apply -f $(OPERATOR_MANIFESTS)
install: install-authorino install-operator ## Install CRDs into the K8s cluster specified in ~/.kube/config.

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
kubectl delete -f $(OPERATOR_MANIFESTS)
uninstall: uninstall-operator uninstall-authorino ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${OPERATOR_IMAGE}
Expand All @@ -219,15 +217,33 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
cd config/manager && $(KUSTOMIZE) edit set image controller=${DEFAULT_OPERATOR_IMAGE}

undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -
$(KUSTOMIZE) build config/default | kubectl delete -f - --ignore-not-found

install-operator: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
kubectl apply -f $(OPERATOR_MANIFESTS)

uninstall-operator: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
kubectl delete -f $(OPERATOR_MANIFESTS) --ignore-not-found

install-authorino: install-cert-manager ## install RBAC and CRD for authorino
install-authorino: create-namespace install-cert-manager ## install RBAC and CRD for authorino
$(KUSTOMIZE) build config/authorino | kubectl apply -f -

uninstall-authorino: ## uninstall RBAC and CRD for authorino
$(KUSTOMIZE) build config/authorino | kubectl delete -f - --ignore-not-found

install-cert-manager: ## install the cert manager need for the web hooks
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v${CERT_MANAGER_VERSION}/cert-manager.yaml
kubectl -n cert-manager wait --timeout=300s --for=condition=Available deployments --all

uninstall-cert-manager: ## uninstall the cert manager need for the web hooks
kubectl delete -f https://github.com/cert-manager/cert-manager/releases/download/v${CERT_MANAGER_VERSION}/cert-manager.yaml --ignore-not-found

create-namespace:
kubectl create namespace authorino-operator --dry-run=client -o yaml | kubectl apply -f - ## handle namespace already existing.

delete-namespace:
kubectl delete namespace authorino-operator --ignore-not-found

# go-get-tool will 'go install' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
Expand Down
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ The Operator can be installed by applying the manifests to the Kubernetes cluste

### Applying the manifests to the cluster

1. Create the namespace for the Operator

```sh
kubectl create namespace authorino-operator
```

2. Install the Operator manifests
1. Install the Operator manifests

```sh
make install
```

3. Deploy the Operator
2. Deploy the Operator

```sh
make deploy
Expand Down Expand Up @@ -289,3 +283,30 @@ spec:
path: keycloak.crt
defaultMode: 420
```
## Removal

### Removing the operator installed via manifests

1. Undeploy the Operator

```sh
make undeploy
```

2. Remove the Operator manifests

```sh
make uninstall
```

#### Remove dependencies (Optional)

1. Remove operator namespace
```sh
make delete-namespace
```

2. Uninstall cert manager
```sh
make uninstall-cert-manager
```

0 comments on commit 189abfd

Please sign in to comment.