forked from vmware-tanzu/cloud-native-security-inspector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·104 lines (88 loc) · 2.34 KB
/
deploy.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
set -e
usage=$'Run "./deploy install" to install Project Narrows. Please set --build-source if needs build from scratch.'
source src/tools/installation/common.sh
set +o noglob
with_portal=true
build_source=$false
install=$false
uninstall=$false
if [ $# -eq 0 ]; then
error "$usage"
fi
DIR="$(cd "$(dirname "$0")" && pwd)"
source $DIR/src/tools/installation/common.sh
function install_opensearch() {
note "Installing opensearch"
check_helm
helm repo add opensearch https://opensearch-project.github.io/helm-charts/
helm repo update
helm install opensearch-deployment-for-narrows opensearch/opensearch -n opensearch --version 2.8.0 --create-namespace --set persistence.enabled=false
success "OpenSearch installed"
}
function uninstall_opensearch() {
note "Uninstalling opensearch"
check_helm
helm repo add opensearch https://opensearch-project.github.io/helm-charts/
helm uninstall opensearch-deployment-for-narrows -n opensearch || :
success "OpenSearch uninstalled"
}
while [ $# -gt 0 ]; do
case $1 in
--help)
note "$usage"
exit 0;;
install)
install=true;;
--build-source)
check_golang
build_source=true;;
uninstall)
uninstall=true;;
*)
note "$usage"
exit 1;;
esac
shift || true
done
cd src/
if [ $install ] && [ $with_portal ]
then
check_kubectl
install_opensearch
note "Installing Project Narrows"
make install
success "Project Narrows installed"
fi
if [ $install ] && [ $with_portal != "true" ]
then
check_kubectl
install_opensearch
note "Installing Project Narrows"
make install
success "Project Narrows installed"
fi
if [ $install ] && [ $build_source ]
then
check_kubectl
check_docker
note "Docker build manager"
make docker-build-manager
note "Docker build inspector"
make docker-build-inspector
note "Docker build portal"
make docker-build-portal
note "Push images to registry"
make docker-push
note "Deploying ..."
make deploy
success "Project Narrows installed"
fi
if [ $uninstall ]
then
check_kubectl
uninstall_opensearch
note "Uninstalling Project Narrows..."
make uninstall
success "Project Narrows uninstalled"
fi