Skip to content

Commit 2e86176

Browse files
adambkaplanRoming22
authored andcommitted
install: Check Application Sync Status
When installing Pipeline Service, check that the ArgocD application has synced in addition to the deployment status of Pipeline Service components. Also ensure that the ArgoCD application reports "Healthy". - Add function check_applications to cluster-setup `utils.sh` - Update cluster-setup `install.sh` to check ArgoCD sync status. Signed-off-by: Adam Kaplan <[email protected]>
1 parent 7d9c180 commit 2e86176

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

operator/images/cluster-setup/content/bin/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ install_clusters() {
127127
printf -- "- Installing applications via Openshift GitOps... \n"
128128
install_applications | indent 4
129129

130+
printf -- "- Checking application status\n"
131+
check_applications "openshift-gitops" "pipeline-service" | indent 4
132+
130133
#checking if the pipelines and triggers pods are up and running
131134
printf -- "- Checking deployment status\n"
132135
tektonDeployments=("tekton-pipelines-controller" "tekton-triggers-controller" "tekton-triggers-core-interceptors")

operator/images/cluster-setup/content/bin/utils.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,42 @@ exit_error() {
2020
exit 1
2121
}
2222

23+
check_applications() {
24+
local ns="$1"
25+
shift
26+
local applications=("$@")
27+
28+
for app in "${applications[@]}"; do
29+
printf -- "- %s: " "$app"
30+
31+
#a loop to check if the ArgoCD application exists
32+
if ! timeout 300s bash -c "while ! kubectl get application/$app -n $ns >/dev/null 2>/dev/null; do printf '.'; sleep 10; done"; then
33+
printf "%s not found (timeout)\n" "$app"
34+
kubectl get application/"$app" -n "$ns"
35+
kubectl -n "$ns" get events | grep Warning
36+
exit 1
37+
else
38+
printf "Exists"
39+
fi
40+
41+
#a loop to check if the ArgoCD application is synced
42+
if kubectl wait --for=jsonpath="{.status.sync.status}"="Synced" "application/$app" -n "$ns" --timeout=600s >/dev/null; then
43+
printf ", Synced"
44+
if kubectl wait --for=jsonpath="{.status.health.status}"="Healthy" "application/$app" -n "$ns" --timeout=600s >/dev/null; then
45+
printf ", Healthy\n"
46+
else
47+
printf ", Unhealthy\n"
48+
kubectl -n "$ns" describe "application/$app"
49+
exit 1
50+
fi
51+
else
52+
printf ", OutOfSync\n"
53+
kubectl -n "$ns" describe "application/$app"
54+
exit 1
55+
fi
56+
done
57+
}
58+
2359
check_deployments() {
2460
local ns="$1"
2561
shift

0 commit comments

Comments
 (0)