Skip to content

Commit 822d0bb

Browse files
adambkaplanRoming22
authored andcommitted
Check OLM subscription status
We also need to check the OLM subscription status to verify the install of Pipeline Service is complete. ArgoCD will sync the OLM Subscription object, but may not necessarily reflect accurate sync and health data of the underlying deployments. Per review, also removing premature exit if an application or subscription does not meet the install criteria. This allows the deployment status to be checked/dumped at the end. Signed-off-by: Adam Kaplan <[email protected]>
1 parent 2e86176 commit 822d0bb

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ install_clusters() {
130130
printf -- "- Checking application status\n"
131131
check_applications "openshift-gitops" "pipeline-service" | indent 4
132132

133+
printf -- "- Checking subscription status\n"
134+
check_subscriptions "openshift-operators" "openshift-pipelines-operator" | indent 4
135+
133136
#checking if the pipelines and triggers pods are up and running
134137
printf -- "- Checking deployment status\n"
135138
tektonDeployments=("tekton-pipelines-controller" "tekton-triggers-controller" "tekton-triggers-core-interceptors")

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ check_applications() {
3232
if ! timeout 300s bash -c "while ! kubectl get application/$app -n $ns >/dev/null 2>/dev/null; do printf '.'; sleep 10; done"; then
3333
printf "%s not found (timeout)\n" "$app"
3434
kubectl get application/"$app" -n "$ns"
35-
kubectl -n "$ns" get events | grep Warning
3635
exit 1
3736
else
3837
printf "Exists"
@@ -46,12 +45,37 @@ check_applications() {
4645
else
4746
printf ", Unhealthy\n"
4847
kubectl -n "$ns" describe "application/$app"
49-
exit 1
5048
fi
5149
else
5250
printf ", OutOfSync\n"
5351
kubectl -n "$ns" describe "application/$app"
52+
fi
53+
done
54+
}
55+
56+
check_subscriptions() {
57+
local ns="$1"
58+
shift
59+
local subscriptions=("$@")
60+
61+
for sub in "${subscriptions[@]}"; do
62+
printf -- "- %s: " "$sub"
63+
64+
#a loop to check if the OLM Subscription exists
65+
if ! timeout 300s bash -c "while ! kubectl get subscription/$sub -n $ns >/dev/null 2>/dev/null; do printf '.'; sleep 10; done"; then
66+
printf "%s not found (timeout)\n" "$sub"
67+
kubectl get subscription/"$sub" -n "$ns"
5468
exit 1
69+
else
70+
printf "Exists"
71+
fi
72+
73+
#a loop to check if the OLM Subscription is at the latest known version
74+
if kubectl wait --for=jsonpath="{.status.state}"="AtLatestKnown" "subscription/$sub" -n "$ns" --timeout=600s >/dev/null; then
75+
printf ", AtLatestKnown\n"
76+
else
77+
printf ", NotUpdated\n"
78+
kubectl -n "$ns" describe "subscription/$sub"
5579
fi
5680
done
5781
}

0 commit comments

Comments
 (0)