def clone_and_replace(src_dir, dest_dir, config):
    """Clone files from src_dir to dest_dir and replace {{replicas}} with 3."""
    replacements = flatten_dict(config)
    # Ensure the destination directory exists
    if not os.path.exists(dest_dir):
        os.makedirs(dest_dir)

    # Copy files
    for filename in os.listdir(src_dir):
        src_path = os.path.join(src_dir, filename)

        if os.path.isdir(src_path):
            clone_and_replace(src_path, os.path.join(dest_dir, filename), config)
            continue

        dest_path = os.path.join(dest_dir, filename)
        if os.path.isfile(src_path):
            shutil.copy2(src_path, dest_path)
            if filename == 'hosts.xml' or filename == 'services.xml':
                continue  # Don't modify these files

            replace_values(dest_path, replacements)
Clone files from src_dir to dest_dir and replace {{replicas}} with 3.
scripts/vespa_eks/vespa_cluster.py