diff --git a/scripts/shared/lib/clusters_kind b/scripts/shared/lib/clusters_kind index fa9b1509e..b21e06e3e 100755 --- a/scripts/shared/lib/clusters_kind +++ b/scripts/shared/lib/clusters_kind @@ -35,12 +35,20 @@ function generate_cluster_yaml() { local nodes for node in ${cluster_nodes[${cluster}]}; do nodes="${nodes}"$'\n'"- role: $node"; done + local config_file + config_file="${RESOURCES_DIR}/${cluster}-config.yaml" + if [[ "$DUAL_STACK" ]]; then service_cidr_ipv6="${service_IPv6_CIDRs[${cluster}]}" pod_cidr_ipv6="${cluster_IPv6_CIDRs[${cluster}]}" - render_template "${RESOURCES_DIR}/kind-cluster-dual-stack-config.yaml" > "${RESOURCES_DIR}/${cluster}-config.yaml" + render_template "${RESOURCES_DIR}/kind-cluster-dual-stack-config.yaml" > "$config_file" else - render_template "${RESOURCES_DIR}/kind-cluster-config.yaml" > "${RESOURCES_DIR}/${cluster}-config.yaml" + render_template "${RESOURCES_DIR}/kind-cluster-config.yaml" > "$config_file" + fi + + if [[ -n "${cluster_custom_config[$cluster]}" ]]; then + # shellcheck disable=SC2016 # We intentionally don't expand the argument to eval-all as it's using yq syntax, not sh + echo "${cluster_custom_config[$cluster]}" | yq -i eval-all '. as $item ireduce ({}; . * $item )' "$config_file" - fi } diff --git a/scripts/shared/lib/utils b/scripts/shared/lib/utils index be9ccd369..8e067cb67 100644 --- a/scripts/shared/lib/utils +++ b/scripts/shared/lib/utils @@ -220,7 +220,7 @@ function load_settings() { local DEBUG_PRINT=false expect_env SETTINGS "Deployment settings file" declare -ga clusters - declare -gA cluster_cni cluster_nodes cluster_subm cluster_gateways + declare -gA cluster_cni cluster_nodes cluster_subm cluster_gateways cluster_custom_config local cluster_count cluster_count=$(_yq ".cluster-count") @@ -242,6 +242,7 @@ function load_settings() { cluster_subm["${cluster}"]=$(_yq ".clusters.${cluster}.submariner") cluster_subm["${cluster}"]=$(_yq ".submariner") cluster_gateways["${cluster}"]=$(_yq ".clusters.${cluster}.gateways // .gateways") + cluster_custom_config["${cluster}"]=$(_yq ".clusters.${cluster}.customConfig // .customConfig") done cat << EOM @@ -252,6 +253,7 @@ Cluster settings:: nodes per cluster - $(typeset -p cluster_nodes | cut -f 2- -d=) install submariner - $(typeset -p cluster_subm | cut -f 2- -d=) label cluster gateways - $(typeset -p cluster_gateways | cut -f 2- -d=) + custom configuration - $(typeset -p cluster_custom_config | cut -f 2- -d=) EOM }