diff --git a/docs/install-olm.md b/docs/install-olm.md index a2132e09..8b22cbcc 100644 --- a/docs/install-olm.md +++ b/docs/install-olm.md @@ -604,7 +604,7 @@ kubectl apply -k config/observability/openshift/grafana Create the example dashboards in Grafana ```bash -kubectl apply -k https://github.com/Kuadrant/kuadrant-operator//examples/dashboards?ref=v1.0.1 +kubectl apply -k https://github.com/Kuadrant/kuadrant-operator/examples/dashboards?ref=v1.0.1 ``` Access the Grafana UI, using the default user/pass of root/secret. diff --git a/mkdocs.yml b/mkdocs.yml index d499f6df..18b96aae 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -52,59 +52,52 @@ plugins: css_dir: css javascript_dir: js - search + # Note: please do not use globs for `imports`. Be explicit about imports, so we can avoid having + # published dangling docs with no routes to them from the nav/other pages - these will go stale quickly. - multirepo: cleanup: true keep_docs_dir: true nav_repos: - name: kuadrant-operator - import_url: 'https://github.com/kuadrant/kuadrant-operator?edit_uri=/blob/main/&branch=main' + import_url: https://github.com/kuadrant/kuadrant-operator?edit_uri=/blob/main/&branch=main imports: - - /README.md - - /doc/* - - /config/samples/* - - /examples/* + - /doc/install/mtls-configuration.md + - /doc/observability/examples.md + - /doc/observability/metrics.md + - /doc/observability/tracing.md + - /doc/overviews/auth.md + - /doc/overviews/dns.md + - /doc/overviews/rate-limiting.md + - /doc/overviews/tls.md + - /doc/reference/authpolicy.md + - /doc/reference/dnspolicy.md + - /doc/reference/kuadrant.md + - /doc/reference/ratelimitpolicy.md + - /doc/reference/tlspolicy.md + - /doc/user-guides/auth/auth-for-app-devs-and-platform-engineers.md + - /doc/user-guides/dns/basic-dns-configuration.md + - /doc/user-guides/dns/dnshealthchecks.md + - /doc/user-guides/dns/gateway-dns.md + - /doc/user-guides/dns/load-balanced-dns.md + - /doc/user-guides/full-walkthrough/secure-protect-connect.md + - /doc/user-guides/ratelimiting/authenticated-rl-for-app-developers.md + - /doc/user-guides/ratelimiting/authenticated-rl-with-jwt-and-k8s-authnz.md + - /doc/user-guides/ratelimiting/gateway-rl-for-cluster-operators.md + - /doc/user-guides/ratelimiting/multi-auth-rlp-diff-section.md + - /doc/user-guides/ratelimiting/multi-auth-rlp-same-section.md + - /doc/user-guides/tls/gateway-tls.md - name: authorino - import_url: 'https://github.com/kuadrant/authorino?edit_uri=/blob/main/&branch=main' + import_url: https://github.com/kuadrant/authorino?edit_uri=/blob/main/&branch=main imports: - - /README.md - - /docs/* - - /docs/user-guides/* - - /install/crd/* - - name: authorino-operator - import_url: 'https://github.com/kuadrant/authorino-operator?edit_uri=/blob/main/&branch=main' - imports: - - /README.md - - name: limitador - import_url: 'https://github.com/kuadrant/limitador?edit_uri=/blob/main/&branch=main' - imports: - - /README.md - - /doc/* - - /limitador-server/README.md - - /limitador-server/docs/* - - /limitador/README.md - - /limitador-server/kubernetes/* - - /limitador-server/sandbox/* - - /LICENSE - - name: limitador-operator - import_url: 'https://github.com/kuadrant/limitador-operator?edit_uri=/blob/main/&branch=main' - imports: - - /README.md - - /doc/* + - /docs/user-guides/observability.md - name: architecture - import_url: 'https://github.com/kuadrant/architecture?edit_uri=/blob/main/&branch=main' - imports: - - /docs/design/* - - name: kuadrantctl - import_url: 'https://github.com/kuadrant/kuadrantctl?edit_uri=/blob/main/&branch=main' + import_url: https://github.com/kuadrant/architecture?edit_uri=/blob/main/&branch=main imports: - - /README.md - - /doc/* + - /docs/design/architectural-overview-v1.md - name: dns-operator - import_url: 'https://github.com/kuadrant/dns-operator?edit_uri=/blob/main/&branch=main' + import_url: https://github.com/kuadrant/dns-operator?edit_uri=/blob/main/&branch=main imports: - - /README.md - - /docs/* - - /config/samples/* + - /docs/provider.md - redirects: redirect_maps: 'getting-started-single-cluster.md': 'getting-started.md' diff --git a/validate_imports.py b/validate_imports.py new file mode 100644 index 00000000..184538e4 --- /dev/null +++ b/validate_imports.py @@ -0,0 +1,84 @@ +import yaml + +def generate_explicit_nav_repos(mkdocs_file): + with open(mkdocs_file, 'r') as f: + raw_content = f.read() + + # Preprocess to remove problematic syntax (e.g., !!python/name) + sanitized_content = clean(raw_content) + config = yaml.safe_load(sanitized_content) + + # Extract files from nav + nav_files = set(extract_files_from_nav(config['nav'])) + + # Build new multirepo imports + explicit_imports = generate_imports(config['plugins'], nav_files) + + print("Updated nav_repos:") + print(yaml.dump(explicit_imports, default_flow_style=False, sort_keys=False)) + +def clean(content): + return "\n".join([line for line in content.splitlines() if '!!python/name:' not in line]) + +def extract_files_from_nav(nav): + files = [] + for item in nav: + if isinstance(item, dict): + for key, value in item.items(): + if isinstance(value, list): + files.extend(extract_files_from_nav(value)) + else: + files.append(value) + else: + files.append(item) + return files + +def generate_imports(plugins, nav_files): + new_imports = [] + for plugin in plugins: + if isinstance(plugin, dict) and 'multirepo' in plugin: + for repo in plugin['multirepo']['nav_repos']: + repo_name = repo['name'] + repo_import_url = repo['import_url'] + repo_explicit_imports = [] + + for pattern in repo['imports']: + matching_files = match_files_to_pattern(nav_files, pattern, repo_name) + + repo_explicit_imports.extend( + add_leading_slash(remove_repo_name_prefix(matching_files, repo_name)) + ) + + # Deduplicate imports (may be used multiple times in nav) + repo_explicit_imports = sorted(set(repo_explicit_imports)) + + new_imports.append({ + 'name': repo_name, + 'import_url': repo_import_url, + 'imports': repo_explicit_imports, + }) + return new_imports + +def match_files_to_pattern(nav_files, pattern, repo_name): + base_path = f"{repo_name}/" + if pattern.startswith('/'): + pattern = pattern[1:] # Remove leading slash + if '*' in pattern or '?' in pattern: + # Handle glob patterns + prefix = base_path + pattern.split('*')[0] + return {file for file in nav_files if file.startswith(prefix)} + else: + # Handle exact matches + expected_path = base_path + pattern.lstrip('/') + return {file for file in nav_files if file == expected_path} + +def remove_repo_name_prefix(files, repo_name): + # Remove the repo name prefix from file paths + prefix = f"{repo_name}/" + return [file[len(prefix):] for file in files if file.startswith(prefix)] + +def add_leading_slash(files): + return [f"/{file}" if not file.startswith("/") else file for file in files] + +# Run +generate_explicit_nav_repos('mkdocs.yml')