Skip to content

Commit

Permalink
Merge pull request #8 from kremerpatrick/main
Browse files Browse the repository at this point in the history
feat: Uninstall script with option to retain the persistent volume claim
  • Loading branch information
saintdle authored Oct 31, 2021
2 parents 5f54d9b + c65d220 commit 1c73cfc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ or the following steps:
kubectl create namespace pacman
kubectl create -n pacman -f pacman-tanzu/

## Uninstall
Run file `./pacman-uninstall.sh`. This will delete all objects created by `./pacman-install.sh`

Alternatively, run `./pacman-uninstall.sh keeppvc`. This will delete all objects except for the pacman namespace and the persistent volume claim. You can use this to demonstrate persistence of the MongoDB data by installing, playing a game and recording a high score, then unininstalling with the `keeppvc` argument. You can then run the installation again and the high score will persist.

## Architecture

The application is made up of the following components:
Expand Down
16 changes: 16 additions & 0 deletions pacman-uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

kubectl delete -n pacman -f security/rbac.yaml
kubectl delete -n pacman -f security/secret.yaml
kubectl delete -n pacman -f deployments/mongo-deployment.yaml
kubectl delete -n pacman -f deployments/pacman-deployment.yaml
kubectl delete -n pacman -f services/mongo-service.yaml
kubectl delete -n pacman -f services/pacman-service.yaml

if [[ $# -gt 0 && "$1" == "keeppvc" ]]
then
echo "Keeping namespace and persistent volume claim"
else
kubectl delete -n pacman -f persistentvolumeclaim/mongo-pvc.yaml
kubectl delete namespace pacman
fi

0 comments on commit 1c73cfc

Please sign in to comment.