Skip to content

Commit

Permalink
chore: Add synchronization for CP4BA
Browse files Browse the repository at this point in the history
  • Loading branch information
nastacio committed Sep 8, 2021
1 parent 75fb468 commit d99ff96
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Ensuring all CSVs across all namespaces are ready
---
apiVersion: batch/v1
kind: Job
metadata:
name: check-cp4a-csvs
annotations:
argocd.argoproj.io/hook: PostSync
namespace: openshift-gitops
spec:
template:
spec:
containers:
- name: config
image: quay.io/openshift/origin-cli:latest
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
env:
- name: TARGET_NAMESPACE
value: "{{.Values.argocd_app_namespace}}"
- name: WAIT_TIME
value: "{{.Values.metadata.post_install_wait}}"
command:
- /bin/sh
- -c
- |
set -eo pipefail
set -x
result=0
current_seconds=0
operation_limit_seconds=$(( $(date +%s) + 2400 ))
csv_installing=0
while [ ${current_seconds} -lt ${operation_limit_seconds} ]; do
if [ $(oc get csv -n "${TARGET_NAMESPACE}" | grep -vc Succeeded) -gt 1 ] || \
[ $(oc get csv -n ibm-common-services | grep -vc Succeeded) -gt 1 ]; then
csv_installing=1
echo "INFO: CSVs still installing."
sleep 60
else
csv_installing=0
break
fi
current_seconds=$(( $(date +%s) ))
done
oc get csv -n "${TARGET_NAMESPACE}"
oc get csv -n ibm-common-services
if [ ${csv_installing} -eq 0 ]; then
echo "INFO: All CSVs are ready."
else
echo "ERROR: CSVs still not ready."
oc get csv -A | grep -v Succeeded
exit 1
fi
restartPolicy: Never
serviceAccountName: {{.Values.serviceaccount.argocd_application_controller}}
backoffLimit: 1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ spec:
echo "INFO: CSVs still installing."
sleep 60
else
csv_installing=0
break
fi
current_seconds=$(( $(date +%s) ))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ spec:
echo "INFO: CSVs still installing."
sleep 60
else
csv_installing=0
break
fi
current_seconds=$(( $(date +%s) ))
Expand Down

0 comments on commit d99ff96

Please sign in to comment.