From 52e3225dad05272b46ebb9ddbb91aba2f8c5b3f4 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Mon, 23 Sep 2024 12:14:21 -0400 Subject: [PATCH] Add clusterset-ip deploy option Signed-off-by: Tom Pantelis --- .github/workflows/testing.yml | 2 ++ Makefile.inc | 6 +++++- scripts/shared/deploy.sh | 12 +++++++++++- scripts/shared/lib/deploy_helm | 2 ++ scripts/shared/lib/deploy_operator | 1 + scripts/shared/resources/bundle/broker.yaml | 1 + scripts/shared/resources/bundle/submariner.yaml | 2 ++ 7 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 7a735cc3e..84eee7573 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -129,6 +129,8 @@ jobs: extra-toggles: lighthouse - extra-toggles: load-balancer - extra-toggles: prometheus + - deploytool: operator + extra-toggles: lighthouse clusterset-ip steps: - name: Reclaim space on GHA host (if the job needs it) if: ${{ contains('ovn', matrix.extra-toggles) }} diff --git a/Makefile.inc b/Makefile.inc index 45413c6c7..aa03dfe14 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -9,7 +9,7 @@ DEBUG_PRINT ?= true PARALLEL ?= true PROVIDER ?= kind TIMEOUT ?= 5m -export AIR_GAPPED DEBUG_PRINT OVERLAPPING PARALLEL PLUGIN PRELOAD_IMAGES PROVIDER SETTINGS TEST_ARGS TIMEOUT +export AIR_GAPPED DEBUG_PRINT OVERLAPPING PARALLEL PLUGIN PRELOAD_IMAGES PROVIDER SETTINGS TEST_ARGS TIMEOUT USE_CLUSTERSET_IP # Specific to `deploy` CABLE_DRIVER ?= libreswan @@ -98,6 +98,10 @@ DEPLOYTOOL = ocm LIGHTHOUSE = true endif +ifneq (,$(filter clusterset-ip,$(_using))) +USE_CLUSTERSET_IP = true +endif + # Force running E2E with `subctl verify` ifneq (,$(filter subctl-verify,$(_using))) TESTDIR = non-existent-dir diff --git a/scripts/shared/deploy.sh b/scripts/shared/deploy.sh index 294855cd1..247c44283 100755 --- a/scripts/shared/deploy.sh +++ b/scripts/shared/deploy.sh @@ -3,7 +3,7 @@ set -em source "${SCRIPTS_DIR}/lib/utils" -print_env CABLE_DRIVER DEPLOYTOOL OVERLAPPING IMAGE_TAG LIGHTHOUSE PARALLEL PLUGIN PRELOAD_IMAGES SETTINGS TIMEOUT +print_env CABLE_DRIVER DEPLOYTOOL OVERLAPPING IMAGE_TAG LIGHTHOUSE PARALLEL PLUGIN PRELOAD_IMAGES SETTINGS TIMEOUT USE_CLUSTERSET_IP source "${SCRIPTS_DIR}/lib/debug_functions" source "${SCRIPTS_DIR}/lib/deploy_funcs" @@ -108,6 +108,15 @@ function declare_global_cidrs() { done } +function declare_clusterset_ip_cidrs() { + declare -gA clusterset_ip_CIDRs + + for cluster in "${clusters[@]}"; do + # shellcheck disable=SC2034 + clusterset_ip_CIDRs[$cluster]="243.254.${cluster_number[$cluster]}.0/24" + done +} + # This is a workaround and can be removed once we switch the CNI from kindnet to a different one. # In order to support health-check and hostNetwork use-cases, submariner requires an IPaddress from the podCIDR # for each node in the cluster. Normally, most of the CNIs create a cniInterface on the host and assign an IP @@ -132,6 +141,7 @@ function schedule_dummy_pod() { load_settings declare_cidrs [[ "$OVERLAPPING" != "true" ]] || declare_global_cidrs +[[ "$USE_CLUSTERSET_IP" != "true" ]] || declare_clusterset_ip_cidrs declare_kubeconfig # Always import nettest image on kind, to be able to test connectivity and other things diff --git a/scripts/shared/lib/deploy_helm b/scripts/shared/lib/deploy_helm index 4066237af..0e1d458ae 100644 --- a/scripts/shared/lib/deploy_helm +++ b/scripts/shared/lib/deploy_helm @@ -77,6 +77,8 @@ function helm_install_subm() { --set submariner.clusterCidr="${cluster_CIDRs[$cluster]}" \ --set submariner.serviceCidr="${service_CIDRs[$cluster]}" \ --set submariner.globalCidr="${global_CIDRs[$cluster]}" \ + --set submariner.clustersetIpCidr="${clusterset_ip_CIDRs[$cluster]}" \ + --set submariner.clustersetIpEnabled="${USE_CLUSTERSET_IP}" \ --set serviceAccounts.globalnet.create="${OVERLAPPING}" \ --set serviceAccounts.lighthouseAgent.create="${LIGHTHOUSE}" \ --set serviceAccounts.lighthouseCoreDns.create="${LIGHTHOUSE}" \ diff --git a/scripts/shared/lib/deploy_operator b/scripts/shared/lib/deploy_operator index 58845df1e..a411cb963 100644 --- a/scripts/shared/lib/deploy_operator +++ b/scripts/shared/lib/deploy_operator @@ -29,6 +29,7 @@ function deploytool_prereqs() { function setup_broker() { local extra_flags=() [[ "${OVERLAPPING}" = true ]] && extra_flags+=(--globalnet) + [[ "${USE_CLUSTERSET_IP}" = true ]] && extra_flags+=(--enable-clusterset-ip) if [[ "${LIGHTHOUSE}" == true ]]; then extra_flags+=(--components 'service-discovery,connectivity') else diff --git a/scripts/shared/resources/bundle/broker.yaml b/scripts/shared/resources/bundle/broker.yaml index 532263c44..6bc61ebe3 100644 --- a/scripts/shared/resources/bundle/broker.yaml +++ b/scripts/shared/resources/bundle/broker.yaml @@ -9,3 +9,4 @@ spec: defaultGlobalnetClusterSize: 8192 globalnetEnabled: ${OVERLAPPING} globalnetCIDRRange: 169.254.0.0/16 + clustersetIPEnabled: ${USE_CLUSTERSET_IP} diff --git a/scripts/shared/resources/bundle/submariner.yaml b/scripts/shared/resources/bundle/submariner.yaml index b636e60ec..7ceee758e 100644 --- a/scripts/shared/resources/bundle/submariner.yaml +++ b/scripts/shared/resources/bundle/submariner.yaml @@ -8,6 +8,8 @@ spec: serviceCIDR: "${service_CIDRs[$cluster]}" clusterCIDR: "${cluster_CIDRs[$cluster]}" globalCIDR: "${global_CIDRs[$cluster]}" + clustersetIPEnabled: ${USE_CLUSTERSET_IP} + clustersetIPCIDR: "${clusterset_ip_CIDRs[$cluster]}" clusterID: "${cluster}" debug: false natEnabled: false