-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-container-security.sh
49 lines (40 loc) · 1.39 KB
/
deploy-container-security.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
46
47
48
49
#!/bin/bash
# exit when any command fails
set -e
# Check if number of arguments isn't equal to 2
if [ "$#" -ne 2 ]; then
echo "You must enter 2 command line arguments: CLOUD_ONE_REGION CLOUD_ONE_API_KEY"
exit
fi
# Check if helm is installed.
if ! command -v helm &> /dev/null
then
echo "helm could not be found. Install it following this: https://helm.sh/docs/intro/install/"
exit
fi
# Check if jq is installed.
if ! command -v jq &> /dev/null
then
echo "jq could not be found. Install it following this: https://stedolan.github.io/jq/download/"
exit
fi
# First parameter is the cloudone api key.
REGION=$1
C1APIKEY=$2
echo $C1APIKEY
CSAPIKEY=$(curl --location --request POST "https://container.${REGION}.cloudone.trendmicro.com/api/clusters" \
--header 'api-version: v1' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: ApiKey ${C1APIKEY}" \
--data-raw '{
"name": "DemoCluster",
"description": "My Demo Cluster description"
}' | jq -r '.apiKey')
echo "Your Container Security Cluster API Key is ${CSAPIKEY}"
sed -e "s/YOUR_REGION_HERE/${REGION}/" -e "s/YOUR_API_HERE/${CSAPIKEY}/" overrides.yaml > overrides.yaml
helm install \
trendmicro \
--namespace trendmicro-system --create-namespace \
--values overrides.yaml \
https://github.com/trendmicro/cloudone-container-security-helm/archive/master.tar.gz