diff --git a/test/resources/c2cc.resource b/test/resources/c2cc.resource index ac8d139e84..3ab62be9a9 100644 --- a/test/resources/c2cc.resource +++ b/test/resources/c2cc.resource @@ -22,6 +22,13 @@ ${HOST2_IP} ${EMPTY} ${HOST2_SSH_PORT} ${EMPTY} ${HOST2_API_PORT} ${EMPTY} ${KUBECONFIG_B} ${EMPTY} +${CLUSTER_C_POD_CIDR} ${EMPTY} +${CLUSTER_C_SVC_CIDR} ${EMPTY} +${CLUSTER_C_DOMAIN} ${EMPTY} +${HOST3_IP} ${EMPTY} +${HOST3_SSH_PORT} ${EMPTY} +${HOST3_API_PORT} ${EMPTY} +${KUBECONFIG_C} ${EMPTY} &{C2CC_KUBECONFIGS} &{EMPTY} &{C2CC_SSH_IDS} &{EMPTY} @{C2CC_REMOTE_ALIASES} @{EMPTY} diff --git a/test/scenarios-bootc/el10/presubmits/el102-src@c2cc.sh b/test/scenarios-bootc/el10/presubmits/el102-src@c2cc.sh index fd984d6bbf..1d4795b0f0 100644 --- a/test/scenarios-bootc/el10/presubmits/el102-src@c2cc.sh +++ b/test/scenarios-bootc/el10/presubmits/el102-src@c2cc.sh @@ -13,10 +13,15 @@ CLUSTER_B_POD_CIDR="10.45.0.0/16" CLUSTER_B_SVC_CIDR="10.46.0.0/16" CLUSTER_B_DOMAIN="cluster-b.remote" +# Cluster C (host3): non-overlapping CIDRs +CLUSTER_C_POD_CIDR="10.48.0.0/16" +CLUSTER_C_SVC_CIDR="10.49.0.0/16" +CLUSTER_C_DOMAIN="cluster-c.remote" + wait_for_greenboot_on_hosts() { local junit_label=$1 local host - for host in host1 host2; do + for host in host1 host2 host3; do local host_ip full_host host_ip=$(get_vm_property "${host}" ip) full_host=$(full_vm_name "${host}") @@ -29,36 +34,64 @@ wait_for_greenboot_on_hosts() { } configure_c2cc_host() { - local host=$1 remote_ip=$2 remote_pod_cidr=$3 remote_svc_cidr=$4 remote_domain=$5 + local host=$1 + shift + # Remaining args are sets of 4: remote_ip remote_pod_cidr remote_svc_cidr remote_domain (repeat) run_command_on_vm "${host}" "sudo mkdir -p /etc/microshift/config.d" - run_command_on_vm "${host}" "sudo tee /etc/microshift/config.d/50-c2cc.yaml > /dev/null << EOF -clusterToCluster: - remoteClusters: - - nextHop: ${remote_ip} - clusterNetwork: - - ${remote_pod_cidr} - serviceNetwork: - - ${remote_svc_cidr} - domain: ${remote_domain} + + # Build the YAML config with all remote clusters + local yaml_content + yaml_content="clusterToCluster:"$'\n'" remoteClusters:" + local firewall_cidrs=() + + while [ $# -gt 0 ]; do + local remote_ip=$1 + local remote_pod_cidr=$2 + local remote_svc_cidr=$3 + local remote_domain=$4 + shift 4 + + yaml_content+=$'\n'" - nextHop: ${remote_ip}" + yaml_content+=$'\n'" clusterNetwork:" + yaml_content+=$'\n'" - ${remote_pod_cidr}" + yaml_content+=$'\n'" serviceNetwork:" + yaml_content+=$'\n'" - ${remote_svc_cidr}" + yaml_content+=$'\n'" domain: ${remote_domain}" + + firewall_cidrs+=("${remote_pod_cidr}" "${remote_svc_cidr}") + done + + run_command_on_vm "${host}" "sudo tee /etc/microshift/config.d/50-c2cc.yaml > /dev/null <> "${host2_ks_dir}/post-microshift.cfg" <> "${host3_ks_dir}/post-microshift.cfg" <>/etc/microshift/config.yaml < /dev/null << EOF -clusterToCluster: - remoteClusters: - - nextHop: ${remote_ip} - clusterNetwork: - - ${remote_pod_cidr} - serviceNetwork: - - ${remote_svc_cidr} - domain: ${remote_domain} + + # Build the YAML config with all remote clusters + local yaml_content + yaml_content="clusterToCluster:"$'\n'" remoteClusters:" + local firewall_cidrs=() + + while [ $# -gt 0 ]; do + local remote_ip=$1 + local remote_pod_cidr=$2 + local remote_svc_cidr=$3 + local remote_domain=$4 + shift 4 + + yaml_content+=$'\n'" - nextHop: ${remote_ip}" + yaml_content+=$'\n'" clusterNetwork:" + yaml_content+=$'\n'" - ${remote_pod_cidr}" + yaml_content+=$'\n'" serviceNetwork:" + yaml_content+=$'\n'" - ${remote_svc_cidr}" + yaml_content+=$'\n'" domain: ${remote_domain}" + + firewall_cidrs+=("${remote_pod_cidr}" "${remote_svc_cidr}") + done + + run_command_on_vm "${host}" "sudo tee /etc/microshift/config.d/50-c2cc.yaml > /dev/null <> "${host2_ks_dir}/post-microshift.cfg" <> "${host3_ks_dir}/post-microshift.cfg" <>/etc/microshift/config.yaml <