-
Notifications
You must be signed in to change notification settings - Fork 706
/
Copy pathdelete-kubeapps.sh
executable file
·44 lines (37 loc) · 1.12 KB
/
delete-kubeapps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
# Copyright 2020-2022 the Kubeapps contributors.
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
# Constants
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null && pwd)"
# Load Libraries
# shellcheck disable=SC1090
. "${ROOT_DIR}/script/libtest.sh"
# shellcheck disable=SC1090
. "${ROOT_DIR}/script/liblog.sh"
namespace="kubeapps"
while [[ "$#" -gt 0 ]]; do
case "$1" in
-n | --namespace)
shift
namespace="${1:?missing namespace}"
;;
*)
echo "Invalid command line flag $1" >&2
return 1
;;
esac
shift
done
# Uninstall Kubeapps
info "Uninstalling Kubeapps in namespace '$namespace'..."
silence helm uninstall kubeapps -n "$namespace"
silence kubectl delete rolebinding example-kubeapps-repositories-write -n "$namespace"
info "Deleting '$namespace' namespace..."
silence kubectl delete ns "$namespace"
# Delete serviceAccount
info "Deleting 'example' serviceAccount and related RBAC objects..."
silence kubectl delete serviceaccount example --namespace default
silence kubectl delete rolebinding example-edit