-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy_skydive_operator_on_openshift.sh
executable file
·52 lines (46 loc) · 1.27 KB
/
deploy_skydive_operator_on_openshift.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
# delete skydive project if it exists (to get new fresh deployment)
oc_delete_skydive_project_if_exists() {
PROJECT_SKYDIVE=$(oc get project | grep skydive)
if [ ! -z "$PROJECT_SKYDIVE" ]; then
oc delete project skydive
while : ; do
PROJECT_SKYDIVE=$(oc get project | grep skydive)
if [ -z "$PROJECT_SKYDIVE" ]; then break; fi
sleep 1
done
fi
}
# create and switch context to skydive project
oc_create_skydive_project() {
oc adm new-project --node-selector='' skydive
oc project skydive
}
# set credentials for skydive deployment
oc_set_credentials() {
# analyzer and agent run as privileged container
oc adm policy add-scc-to-user privileged -z default
# analyzer need cluster-reader access to get all information from the cluster
oc adm policy add-cluster-role-to-user cluster-reader -z default
}
oc_clear_skydive_crd() {
SKYDIVE_SUITE_CRD=$(oc get skydive)
if [ -n "$SKYDIVE_SUITE_CRD" ]; then
oc delete -f config/crd/bases/skydive.example.com_skydives.yaml
fi
}
# deploy skydive
oc_deploy_skydive() {
make manifests
oc create -f config/crd/bases/
oc create -f config/skydive_v1_skydive.yaml
make run
}
# main
main() {
oc_delete_skydive_project_if_exists
oc_create_skydive_project
oc_set_credentials
oc_clear_skydive_crd
oc_deploy_skydive
}
main