Skip to content

Commit abac63b

Browse files
prietyc123Roming22
authored andcommitted
Fail ci for installation error of pipeline service
1 parent 02d8acc commit abac63b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ install_clusters() {
143143
check_statefulsets "tekton-results" "${resultsStatefulsets[@]}" | indent 4
144144
chainsDeployments=("tekton-chains-controller")
145145
check_deployments "tekton-chains" "${chainsDeployments[@]}" | indent 4
146+
147+
printf -- "- Checking pods status for controlplane namespaces\n"
148+
# list of control plane namespaces
149+
CONTROL_PLANE_NS=("openshift-apiserver" "openshift-controller-manager" "openshift-etcd" "openshift-ingress" "openshift-kube-apiserver" "openshift-kube-controller-manager" "openshift-kube-scheduler")
150+
for ns in "${CONTROL_PLANE_NS[@]}"; do
151+
check_crashlooping_pods "$ns" | indent 4
152+
done
146153
done
147154
}
148155

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,27 @@ check_deployments() {
113113
done
114114
}
115115

116+
check_crashlooping_pods() {
117+
local ns="$1"
118+
local crashlooping_pods
119+
120+
printf "checking for crashlooping pods in namsespace: %s\n" "$ns"
121+
crashlooping_pods=$(kubectl get pods -n "$ns" --field-selector=status.phase!=Running -o jsonpath='{range .items[?(@.status.containerStatuses[*].state.waiting.reason=="CrashLoopBackOff")]}{.metadata.name}{","}{end}' 2>/dev/null)
122+
123+
# Check if the any crashlooping pods found
124+
if [[ -n $crashlooping_pods ]]; then
125+
printf ", CrashLoopBackOff error in namespace: %s\n" "$ns"
126+
IFS=',' read -ra pods <<< "$crashlooping_pods"
127+
for pod in "${pods[@]}"; do
128+
kubectl get pod "$pod" -n "$ns"
129+
kubectl logs "$pod" -n "$ns"
130+
done
131+
exit 1
132+
else
133+
printf ", Running\n"
134+
fi
135+
}
136+
116137
check_statefulsets() {
117138
local ns="$1"
118139
shift

0 commit comments

Comments
 (0)