-
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.
Merge pull request #14 from sergenyalcin/change-sync-point-to-svc-end…
…points Add a endpoint based sync point after scaling up the pods in import step
- Loading branch information
Showing
4 changed files
with
84 additions
and
18 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
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