-
Notifications
You must be signed in to change notification settings - Fork 0
/
installExporterChart
executable file
·58 lines (51 loc) · 2.41 KB
/
installExporterChart
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
50
51
52
53
54
55
56
57
58
#!/bin/bash
#
# Copyright (C) 2019 IBM Corporation.
#
# Authors:
# Frederico Araujo <[email protected]>
# Teryl Taylor <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [[ -z "$S3_ACCESS_KEY_ID" || -z "$S3_SECRET_ACCESS_KEY" || -z "$S3_HOSTNAME" || -z "$S3_SYSFLOW_BUCKET" ]]; then
echo -e "Error: The following environment varilables are ALL required\n"
echo " S3_ACCESS_KEY_ID : S3 access key ID"
echo " S3_SECRET_ACCESS_KEY : S3 secret access key"
echo " S3_HOSTNAME : S3 object store address"
echo " S3_SYSFLOW_BUCKET : S3 bucket to export data"
echo -e "\nExport the missing S3 configurations to continue, e.g."
echo -e "$ export S3_HOSTNAME=s3.us-south.cloud-object-storage.appdomain.cloud\n"
exit 1
fi
# Don't run if any of the prerequisites are not installed.
prerequisites=( "kubectl" "helm" )
for i in "${prerequisites[@]}"
do
isExist=$(command -v $i)
if [ -z "$isExist" ]
then
echo "$i not installed. Please install the required pre-requisites first (kubectl, helm)"
exit 1
fi
done
nsCreateCmd=$(kubectl create namespace sysflow 2>&1)
if [[ "$nsCreateCmd" =~ "already exists" ]]; then
echo "Warning: Namespace 'sysflow' already exists. Proceeding with existing namespace"
else
echo "Namespace 'sysflow' created successfully"
fi
# TODO: publish sysflow charts to https://kubernetes-charts.storage.googleapis.com,
# which is enabled by default, and get rid of below version and repo strings.
chartVersion="0.1-rc2"
chartRepo=https://weii666.github.io/charts/
helm install sysflow --set sfexporter.s3AccessKey="${S3_ACCESS_KEY_ID}" --set sfexporter.s3SecretKey="${S3_SECRET_ACCESS_KEY}" --set sfexporter.s3Endpoint="${S3_HOSTNAME}" --set sfexporter.s3Location="not-used" --set sfexporter.s3Bucket="${S3_SYSFLOW_BUCKET}" --set sfexporter.s3Secure=true sf-exporter-chart --version $chartVersion --repo $chartRepo --namespace sysflow --debug