-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parametrize gateway topology deployment
Add "gateways: 2" parameter to ".shipyard*" file in order to parametrize the amount of nodes that should be labeld as gateway nodes. In case of the label missing, both on the cluster or global level, the GW node label will be applied automatically on single node. Example of configuration: --- submariner: true nodes: control-plane worker clusters: cluster1: cluster2: nodes: control-plane worker worker gateways: 2 In the above example, the first cluster will get 1 gw node applied and second cluster will have 2 gw nodes applied. Signed-off-by: Maxim Babushkin <[email protected]>
- Loading branch information
Showing
6 changed files
with
102 additions
and
10 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,20 @@ | ||
--- | ||
name: Verify | ||
|
||
on: | ||
pull_request: | ||
|
||
permissions: {} | ||
|
||
env: | ||
DEBUG_PRINT: true | ||
jobs: | ||
verify: | ||
name: Verify gateway nodes | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
|
||
- name: Deploy and validate gateways custom topology | ||
run: make script-test SCRIPT_TEST_ARGS="test/scripts/validation/test.sh" |
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,6 @@ | ||
--- | ||
submariner: true | ||
nodes: control-plane worker | ||
clusters: | ||
cluster1: | ||
nodes: control-plane worker worker |
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,7 @@ | ||
--- | ||
submariner: true | ||
nodes: control-plane worker | ||
clusters: | ||
cluster1: | ||
nodes: control-plane worker worker | ||
gateways: 2 |
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,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
source ${SCRIPTS_DIR}/lib/debug_functions | ||
source ${SCRIPTS_DIR}/lib/utils | ||
# source ${SCRIPTS_DIR}/cloud-prepare.sh | ||
|
||
function verify_gw_topology() { | ||
local gateways_count | ||
gateways="${cluster_gateways[$cluster]:-1}" | ||
|
||
echo "Verify gateway nodes" | ||
gateways_count=$(kubectl get nodes -l=submariner.io/gateway=true \ | ||
--no-headers=true -o custom-columns=NAME:.metadata.name | wc -l) | ||
|
||
if [[ "$gateways" -ne "$gateways_count" ]]; then | ||
echo "Expect $gateways gateways nodes but detected $gateways_count" | ||
return 1 | ||
else | ||
echo "Found expected number of gateways - $gateways" | ||
fi | ||
} | ||
|
||
function remove_gw_labels() { | ||
local gw_nodes | ||
|
||
echo "Reset gateway nodes (unlabel)" | ||
readarray -t gw_nodes < <(kubectl get nodes -l=submariner.io/gateway=true \ | ||
--no-headers=true -o custom-columns=NAME:.metadata.name) | ||
|
||
for node in "${gw_nodes[@]}"; do | ||
kubectl label --overwrite nodes "$node" submariner.io/gateway- | ||
done | ||
} | ||
|
||
echo "Prepare cluster" | ||
make clusters SETTINGS=test/scripts/validation/scenario_config1 | ||
|
||
for scenario in scenario_config1 scenario_config2 scenario_config3; do | ||
export SETTINGS="test/scripts/validation/$scenario" | ||
echo "Set gateway nodes according to $scenario scenario" | ||
make cloud-prepare | ||
|
||
declare_kubeconfig | ||
load_settings | ||
clusters=($(kind get clusters)) | ||
run_parallel "${clusters[*]}" verify_gw_topology | ||
run_parallel "${clusters[*]}" remove_gw_labels | ||
done | ||
|
||
echo "Perform cleanup" | ||
make cleanup SETTINGS=test/scripts/validation/scenario_config1 |