-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy-argo.sh
executable file
·45 lines (37 loc) · 1.06 KB
/
deploy-argo.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
#!/bin/bash
# Function to check if all pods are running
function check_pods_running {
# Loop until all pods are running
while true; do
# Get all pods in the current namespace
pods=$(oc get pods -o=name)
# Flag to track if all pods are running
all_running=true
# Loop through each pod and check if it's running
for pod in $pods; do
status=$(oc get $pod -o=jsonpath='{.status.phase}')
if [[ "$status" != "Running" ]]; then
echo "Error: Pod $pod is not running (status: $status)."
all_running=false
fi
done
# Exit the loop if all pods are running
if $all_running; then
echo "All pods are running."
break
fi
# Wait for a few seconds before checking again
sleep 5
done
}
# Check if the user is logged in to OpenShift
if ! oc whoami &> /dev/null; then
echo "Error: You are not logged in to OpenShift."
exit 1
fi
oc create namespace openshift-gitops
oc create -f init/
oc project openshift-gitops
check_pods_running
oc new-project user1-bgd
oc create -f app-config/cluster-config.yaml