-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add synchronization for CP4BA
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
config/cloudpaks/cp4a/operators/templates/07-operators/99-postsync-check-all-csvs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters