-
Notifications
You must be signed in to change notification settings - Fork 12
/
bootstrap.sh
executable file
·68 lines (54 loc) · 1.95 KB
/
bootstrap.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
# A shell script for bootstrapping the demo into an RHDP cluster
# This will not be needed with agnosticv/agnosticd but here as a
# starting point
#
# Script requirements:
# Must be logged in as cluster-admin
# Must have `envsubst` installed
#!/bin/bash
LANG=C
SLEEP_SECONDS=45
echo ""
echo "Installing GitOps Operator."
kustomize build infra/components/gitops-operator/operator/base | oc apply -f -
echo "Pause $SLEEP_SECONDS seconds for the creation of the gitops-operator..."
sleep $SLEEP_SECONDS
echo "Waiting for operator to start"
until oc get deployment gitops-operator-controller-manager -n openshift-operators
do
sleep 5;
done
echo "Waiting for openshift-gitops namespace to be created"
until oc get ns openshift-gitops
do
sleep 5;
done
echo "Waiting for deployments to start"
until oc get deployment cluster -n openshift-gitops
do
sleep 5;
done
echo "Waiting for all pods to be created"
deployments=(cluster kam openshift-gitops-applicationset-controller openshift-gitops-redis openshift-gitops-repo-server openshift-gitops-server)
for i in "${deployments[@]}";
do
echo "Waiting for deployment $i";
oc rollout status deployment $i -n openshift-gitops
done
echo "Fetching cluster subdomain"
export SUB_DOMAIN=$(oc get ingress.config.openshift.io cluster -n openshift-ingress -o jsonpath='{.spec.domain}')
echo "SUB_DOMAIN=${SUB_DOMAIN}"
echo "Apply overlay to override default instance"
# echo "Create default instance of gitops operator"
kustomize build infra/components/gitops-operator/instance/base | envsubst '${SUB_DOMAIN}' | oc apply -f -
sleep 10
echo "Waiting for all pods to redeploy"
deployments=(cluster kam openshift-gitops-applicationset-controller openshift-gitops-redis openshift-gitops-repo-server openshift-gitops-server)
for i in "${deployments[@]}";
do
echo "Waiting for deployment $i";
oc rollout status deployment $i -n openshift-gitops
done
echo "GitOps Operator ready"
echo "Adding bootstrap app-of-app"
oc apply -k bootstrap/argo/base