diff --git a/docs/conf.py b/docs/conf.py index 85997cc8..7f0888e2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,6 +5,8 @@ author = "Shrey Ajmera, Akhila Yeruva" import os +from pathlib import Path +import shutil html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "instinct.docs.amd.com") html_context = {} if os.environ.get("READTHEDOCS", "") == "True": @@ -20,6 +22,7 @@ html_theme_options = { "flavor": "instinct", "link_main_doc": True, + "use_download_button": True, # Add any additional theme options here } extensions = [ @@ -41,3 +44,226 @@ tags_intro_text = "" tags_page_title = "Tag page" tags_page_header = "Pages with this tag" + +import re + +EXCLUDED_DIRS = { + "_build", + "_templates", + "_static", + ".git", + ".venv", +} + +MARKUP_PREFIXES = ( + ":::", + "```{", + "```", + ":img-top:", + ":class", + ":link:", + ":link-type:", + ":shadow:", + ":columns:", + ":padding:", + ":gutter:", + ":open:", + ":name:", + ":header-rows:", + ":alt:", + "+++", + "-->", + "{bdg-", +) + +# Matches lines like "align: center", "alt:", "name: foo" (directive options +# not starting with a colon, common in MyST figure/table fences) +_BARE_DIRECTIVE_RE = re.compile(r"^[a-z][a-z_-]*:\s*\S*$") + +# Matches MyST/RST anchor labels like "(some-label)=" +_ANCHOR_LABEL_RE = re.compile(r"^\(\w[\w-]*\)=$") + +# Matches RST section underlines (e.g. "====", "----", "~~~~") +_RST_UNDERLINE_RE = re.compile(r"^[=\-~^\"\'#*+]{3,}$") + +# Matches RST code block directives (e.g. ".. code-block:: cpp", ".. code:: sh") +_RST_CODE_BLOCK_RE = re.compile(r"^\.\.\s+(code-block|code|sourcecode)::") + +# Matches markdown table separator rows (e.g. "|---|---|", "| :--- | ---: |"). +_MD_TABLE_SEP_RE = re.compile(r"^\|[\s|:\-]+\|$") + +# Matches RST directives whose indented body should be discarded (e.g. raw HTML). +_RST_SKIP_BLOCK_RE = re.compile(r"^\.\.\s+raw::") + +# Matches HTML tags (e.g. "
", "

", " block + in_html_open_tag = False # inside a multi-line HTML opening tag + kept = [] + for line in lines: + stripped = line.strip() + # Backtick fences (MyST/Markdown) + if stripped.startswith("```"): + in_backtick_fence = not in_backtick_fence + kept.append(line) + continue + if in_backtick_fence: + kept.append(line) + continue + # HTML comment block (): discard all content until --> + if in_html_comment: + if "-->" in stripped: + in_html_comment = False + continue + # RST skip block (e.g. .. raw::): discard all indented content + if in_rst_skip_block: + if not stripped or line[0] in (" ", "\t"): + continue + in_rst_skip_block = False + # RST code block: exit when a non-blank, non-indented line appears + if in_rst_code_block: + if not stripped or line[0] in (" ", "\t"): + kept.append(line) + continue + in_rst_code_block = False + # RST raw block: enter and discard both the directive and its body + if _RST_SKIP_BLOCK_RE.match(stripped): + in_rst_skip_block = True + continue + # RST code block: enter on directive line (directive itself is dropped) + if _RST_CODE_BLOCK_RE.match(stripped): + in_rst_code_block = True + continue + # HTML comment open (): discard opener and enter state + if stripped.startswith("" not in stripped: + in_html_comment = True + continue + # Multi-line HTML opening tag: skip continuation lines until > + if in_html_open_tag: + if ">" in stripped: + in_html_open_tag = False + continue + # Detect HTML opening tags that wrap across lines (no > on this line) + if _HTML_TAG_RE.match(stripped) and ">" not in stripped: + in_html_open_tag = True + continue + if not stripped: + kept.append(line) + elif is_prose_line(line): + # Strip trailing HTML close tags (e.g. "See the guide.

") + cleaned = _TRAILING_HTML_CLOSE_RE.sub("", line).rstrip() + cleaned_stripped = cleaned.strip() + if not cleaned_stripped: + # Entire line was HTML close tags — keep original (shouldn't + # normally reach here since _is_prose_line filters HTML). + kept.append(line) + elif re.search(r"\w", cleaned_stripped): + # Line has real word content after stripping close tags. + kept.append(cleaned) + # else: only punctuation remains (e.g. bare ".") — discard. + cleaned = "\n".join(kept) + + combined.append(f"\n\n---\n\n# {relative}\n") + combined.append(cleaned.strip()) + + output_file.write_text( + "\n".join(combined) + "\n", + encoding="utf-8", + ) + +def setup(app): + app.connect("build-finished", generate_combined_markdown) diff --git a/docs/llms.txt b/docs/llms.txt new file mode 100644 index 00000000..939ae5c3 --- /dev/null +++ b/docs/llms.txt @@ -0,0 +1,53 @@ +# AMD Network Operator + +> Deploy and manage AMD AINICs in Kubernetes environments. The AMD Network Operator manages all networking components required to enable RDMA workloads within a Kubernetes cluster, including NIC driver management, device plugin configuration, secondary network CNI plugins, and metrics collection. + +## Overview + +- [Network Operator overview](https://instinct.docs.amd.com/projects/network-operator/en/main/overview.html): Components of the AMD Network Operator and their roles in managing AMD NICs in Kubernetes clusters. +- [Release notes](https://instinct.docs.amd.com/projects/network-operator/en/main/releasenotes.html): Release history and changelog for the AMD Network Operator. + +## Installation + +- [Install with Helm](https://instinct.docs.amd.com/projects/network-operator/en/main/installation/kubernetes-helm.html): Install the AMD Network Operator on a Kubernetes cluster using Helm. +- [Install with GPU Operator and Network Operator together](https://instinct.docs.amd.com/projects/network-operator/en/main/installation/kubernetes-helm-operators.html): Install AMD GPU Operator and AMD Network Operator together in the same Kubernetes cluster. +- [Custom Resource guide](https://instinct.docs.amd.com/projects/network-operator/en/main/installation/networkconfig.html): Configure the NetworkConfig Custom Resource, including driver management, device plugin, and secondary network settings. +- [NetworkConfig full reference](https://instinct.docs.amd.com/projects/network-operator/en/main/installation/networkconfig-full.html): Comprehensive list of NetworkConfig CR configuration options. +- [Deploy a workload with a network device](https://instinct.docs.amd.com/projects/network-operator/en/main/installation/workload.html): Create a NetworkAttachmentDefinition and deploy a workload with an assigned network device. + +## Driver management + +- [Driver management](https://instinct.docs.amd.com/projects/network-operator/en/main/drivers/drivers.html): Manage AMD AI NIC drivers using the AMD Network Operator on Kubernetes clusters. +- [Driver upgrades](https://instinct.docs.amd.com/projects/network-operator/en/main/drivers/upgrading.html): Upgrade AMD Network drivers on worker nodes. + +## Device plugin + +- [Device Plugin and Node Labeller](https://instinct.docs.amd.com/projects/network-operator/en/main/device_plugin/deviceplugin.html): Configure the Device Plugin and Node Labeller via the NetworkConfig Custom Resource. +- [Resource health monitoring](https://instinct.docs.amd.com/projects/network-operator/en/main/device_plugin/resource-health.html): Real-time monitoring and reporting of network device health status integrated with Kubernetes pod scheduling. + +## Secondary networks + +- [Kubernetes integration flow](https://instinct.docs.amd.com/projects/network-operator/en/main/secondary_network/integration-flow.html): How pod network attachment annotations trigger CNI plugins through the Kubernetes networking stack. +- [AMD Host Device CNI plugin](https://instinct.docs.amd.com/projects/network-operator/en/main/secondary_network/amd-host-device-cni.html): Move PF or VF network interfaces from host into pod network namespaces with IP address preservation. +- [Alternative CNI plugins](https://instinct.docs.amd.com/projects/network-operator/en/main/secondary_network/other-cnis.html): Alternative CNI plugins tested with AMD Network Operator via NetworkAttachmentDefinition. + +## Metrics + +- [Metrics Exporter](https://instinct.docs.amd.com/projects/network-operator/en/main/metrics/exporter.html): Configure the Metrics Exporter via the NetworkConfig Custom Resource. +- [Prometheus integration](https://instinct.docs.amd.com/projects/network-operator/en/main/metrics/prometheus.html): Integrate the AMD Network Operator with Prometheus using ServiceMonitor for automatic metrics scraping. +- [Grafana dashboard](https://instinct.docs.amd.com/projects/network-operator/en/main/metrics/grafana_dashboard.html): AINIC System Grafana dashboard for visualizing network metrics. +- [Health checks](https://instinct.docs.amd.com/projects/network-operator/en/main/metrics/health.html): Health monitoring via the metrics exporter gRPC socket for Kubernetes device availability decisions. +- [Kube-RBAC-Proxy](https://instinct.docs.amd.com/projects/network-operator/en/main/metrics/kube-rbac-proxy.html): Secure the metrics endpoint with RBAC or static authorization using the kube-rbac-proxy sidecar. + +## Upgrades + +- [Upgrade](https://instinct.docs.amd.com/projects/network-operator/en/main/upgrades/upgrade.html): Verify cluster readiness and upgrade the AMD Network Operator. +- [Component upgrades](https://instinct.docs.amd.com/projects/network-operator/en/main/upgrades/componentupgrades.html): Upgrade Device Plugin, Node Labeller, Metrics Exporter, and CNI Plugin daemonsets. + +## Operations + +- [Troubleshooting](https://instinct.docs.amd.com/projects/network-operator/en/main/troubleshooting.html): Diagnose and resolve common issues with the AMD Network Operator. +- [Uninstall](https://instinct.docs.amd.com/projects/network-operator/en/main/uninstallation/uninstallation.html): Remove the operator and related resources in the correct sequence. +- [Cluster Validation and Job Scheduling Framework](https://instinct.docs.amd.com/projects/network-operator/en/main/cluster_validation_framework/README.html): Periodically verify worker node health and readiness before scheduling distributed AI and HPC workloads. + +---