-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
- Loading branch information
1 parent
840f4e7
commit 701c15b
Showing
4 changed files
with
84 additions
and
462 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
function check_endpoints { | ||
endpoints=( $("${KUBECTL}" -n "${CROSSPLANE_NAMESPACE}" get endpoints --no-headers | grep '^provider-' | awk '{print $1}') ) | ||
for endpoint in ${endpoints[@]}; do | ||
port=$(${KUBECTL} -n "${CROSSPLANE_NAMESPACE}" get endpoints "$endpoint" -o jsonpath='{.subsets[*].ports[0].port}') | ||
if [[ -z "${port}" ]]; then | ||
echo "$endpoint - No served ports" | ||
return 1 | ||
else | ||
echo "$endpoint - Ports present" | ||
fi | ||
done | ||
} | ||
|
||
attempt=1 | ||
max_attempts=10 | ||
while [[ $attempt -le $max_attempts ]]; do | ||
if check_endpoints; then | ||
exit 0 | ||
else | ||
printf "Retrying... (%d/%d)\n" "$attempt" "$max_attempts" >&2 | ||
fi | ||
((attempt++)) | ||
sleep 5 | ||
done | ||
exit 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
function patch { | ||
kindgroup=$1; | ||
name=$2; | ||
if ${KUBECTL} --subresource=status patch "$kindgroup/$name" --type=merge -p '{"status":{"conditions":[]}}' ; then | ||
return 0; | ||
else | ||
return 1; | ||
fi; | ||
}; | ||
|
||
|
||
kindgroup=$1; | ||
name=$2; | ||
attempt=1; | ||
max_attempts=10; | ||
while [[ $attempt -le $max_attempts ]]; do | ||
if patch "$kindgroup" "$name"; then | ||
echo "Successfully patched $kindgroup/$name"; | ||
${KUBECTL} annotate "$kindgroup/$name" uptest-old-id=$(${KUBECTL} get "$kindgroup/$name" -o=jsonpath='{.status.atProvider.id}') --overwrite; | ||
break; | ||
else | ||
printf "Retrying... (%d/%d) for %s/%s\n" "$attempt" "$max_attempts" "$kindgroup" "$name" >&2; | ||
fi; | ||
((attempt++)); | ||
sleep 5; | ||
done; | ||
if [[ $attempt -gt $max_attempts ]]; then | ||
echo "Failed to patch $kindgroup/$name after $max_attempts attempts"; | ||
exit 1; | ||
fi; | ||
exit 0; |
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
Oops, something went wrong.