diff --git a/test/resources/c2cc.resource b/test/resources/c2cc.resource index badd015f7e..0cc408bc8e 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} @@ -249,9 +256,9 @@ Verify Corefile Does Not Contain C2CC Server Block Should Not Contain ${stdout} ${domain}:5353 Deploy Test Workloads - [Documentation] Create namespace and deploy hello-microshift + curl-pod on both clusters. + [Documentation] Create namespace and deploy hello-microshift + curl-pod on all clusters. VAR ${assets}= ${EXECDIR}/assets/c2cc - FOR ${alias} IN cluster-a cluster-b + FOR ${alias} IN cluster-a cluster-b cluster-c ${ns}= Create Unique Namespace On Cluster ${alias} Set To Dictionary ${NAMESPACES} ${alias} ${ns} Oc On Cluster ${alias} oc apply -n ${ns} -f ${assets}/hello-microshift.yaml @@ -261,17 +268,17 @@ Deploy Test Workloads Wait For Service Endpoints Wait For Test Pods - [Documentation] Wait for all test pods to be Ready on both clusters. - FOR ${alias} IN cluster-a cluster-b + [Documentation] Wait for all test pods to be Ready on all clusters. + FOR ${alias} IN cluster-a cluster-b cluster-c Oc On Cluster ... ${alias} ... oc wait pod/hello-microshift pod/curl-pod -n ${NAMESPACES}[${alias}] --for=condition=Ready --timeout=120s END Wait For Service Endpoints - [Documentation] Wait for hello-microshift service to have endpoints on both clusters. + [Documentation] Wait for hello-microshift service to have endpoints on all clusters. ... Ensures OVN-K has synced the EndpointSlice and programmed the OVN load balancer. - FOR ${alias} IN cluster-a cluster-b + FOR ${alias} IN cluster-a cluster-b cluster-c Wait Until Keyword Succeeds 120s 5s ... Service Endpoints Should Exist ${alias} ${NAMESPACES}[${alias}] END @@ -284,7 +291,7 @@ Service Endpoints Should Exist Should Not Be Empty ${stdout} Cleanup Test Workloads - [Documentation] Delete test namespace on both clusters. Ignores errors. - FOR ${alias} IN cluster-a cluster-b + [Documentation] Delete test namespace on all clusters. Ignores errors. + FOR ${alias} IN cluster-a cluster-b cluster-c Oc On Cluster ${alias} oc delete namespace ${NAMESPACES}[${alias}] --timeout=60s END diff --git a/test/scenarios-bootc/el10/presubmits/el102-src@c2cc.sh b/test/scenarios-bootc/el10/presubmits/el102-src@c2cc.sh index 19705d8ce7..e80fdf5c9a 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 <