-
Notifications
You must be signed in to change notification settings - Fork 3
/
remove_cluster.sh
executable file
·50 lines (31 loc) · 1.63 KB
/
remove_cluster.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
45
#!/bin/bash
# ****************************************************
# CloudGuard CSPM (Dome9) Kubernetes Onboarding Helper
# Author: Jayden Kyaw Htet Aung | Check Point SW Technologies
# See LICENSE and README files
# ****************************************************
# Update this accordingly
cluster_name="jayden-dev-2"
# Update this accordingly
namespace="checkpoint"
export CHKP_CLOUDGUARD_ID="YOUR-CLOUDGUARD-API-KEY"
export CHKP_CLOUDGUARD_SECRET="YOUR-CLOUDGUARD-API-SECRET"
# If you're using AWS SSM Parameter Stores
#export CHKP_CLOUDGUARD_ID=$(aws ssm get-parameter --name "CHKP_CLOUDGUARD_ID" | jq -r '.Parameter.Value')
#export CHKP_CLOUDGUARD_SECRET=$(aws ssm get-parameter --name "CHKP_CLOUDGUARD_SECRET" | jq -r '.Parameter.Value')
echo "Hello, CloudGuarder! We are removing $cluster_name from CloudGuard. Give us a moment."
echo "Deleting clusterrolebinding.."
kubectl delete clusterrolebinding cp-resource-management --namespace=$namespace
echo "Removing clusterrole .."
kubectl delete clusterrole cp-resource-management
echo "Deleting service account.."
kubectl delete serviceaccount cp-resource-management --namespace $namespace
echo "Deleting configmap.. "
kubectl delete configmap cp-resource-management-configmap --namespace $namespace
echo "Deleting secret.."
kubectl delete secret dome9-creds --namespace $namespace
echo "Deleting Cloudguard agent.."
kubectl delete -f https://secure.dome9.com/v2/assets/files/cp-resource-management.yaml --namespace $namespace
echo "Finally deleting namespace"
kubectl delete namespace $namespace
echo "Awesome, Cloudguarder! $cluster_name has been succcessfully removed from CloudGuard!"