-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(secret-gen): replace missing node by openssl + k8s-wait-job (#914)
* feat(create-db-secret): ensure random and secured * Update azure-db/bin/create-db-secret Co-authored-by: Julien Bouquillon <contact@revolunet.com> * Update azure-db/bin/create-db-secret Co-authored-by: Julien Bouquillon <contact@revolunet.com> * feat(secret-gen): replace missing node by openssl * feat(wait-job): add k8s wait job Co-authored-by: Julien Bouquillon <contact@revolunet.com>
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
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
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,34 @@ | ||
#!/bin/sh | ||
|
||
K8S_NAMESPACE=${1} | ||
JOB_NAME=${2} | ||
|
||
if [ -z "$K8S_NAMESPACE" ]; then | ||
echo "missing required argument #1: namespace" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$JOB_NAME" ]; then | ||
echo "missing required argument #2: job name" | ||
exit 1 | ||
fi | ||
|
||
JOB="job/$JOB_NAME" | ||
|
||
retval_complete=1 | ||
retval_failed=1 | ||
while [[ $retval_complete -ne 0 ]] && [[ $retval_failed -ne 0 ]]; do | ||
sleep 2 | ||
output=$(timeout 2s kubectl -n $K8S_NAMESPACE wait --for=condition=complete $JOB --timeout=0 2>&1) | ||
retval_complete=$? | ||
output=$(timeout 2s kubectl -n $K8S_NAMESPACE wait --for=condition=failed $JOB --timeout=0 2>&1) | ||
retval_failed=$? | ||
wait | ||
done | ||
|
||
if [ $retval_failed -eq 0 ]; then | ||
echo "$JOB failed" | ||
exit 1 | ||
else | ||
echo "$JOB complete" | ||
fi |