forked from keycloak/keycloak-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create unique machine CIDR per ROSA cluster (keycloak#478)
Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
- Loading branch information
1 parent
34d9891
commit e5e3354
Showing
4 changed files
with
27 additions
and
9 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
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,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [[ "$RUNNER_DEBUG" == "1" ]]; then | ||
set -x | ||
fi | ||
|
||
# https://access.redhat.com/documentation/en-us/red_hat_openshift_service_on_aws/4/html/networking/cidr-range-definitions | ||
# Must not overlap with Pod CDR: 10.128.0.0/14 | ||
# Must not overlap with OVN Kubernetes: 100.64.0.0/16 | ||
|
||
EXISTING_MACHINE_CIDRS=$(rosa list clusters -o json | jq -r ".[].network.machine_cidr" | sort -u) | ||
|
||
if (( $(echo ${EXISTING_MACHINE_CIDRS} | wc -l) > 63 )); then | ||
echo "Maximum number of unique machine CIDRS reached" | ||
echo ${EXISTING_MACHINE_CIDRS} | ||
exit 1 | ||
fi | ||
|
||
while true; do | ||
CIDR="10.0.$(shuf -i 0-63 -n 1).0/24" | ||
if [[ "${EXISTING_MACHINE_CIDRS}" != *"${CIDR}"* ]]; then | ||
break | ||
fi | ||
done | ||
echo ${CIDR} |