Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

generating-ovn-topology

БесплатноЗапускает вложенные скриптыНе проверен

Generates and displays OVN-Kubernetes network topology diagrams showing logical switches, routers, ports with IP/MAC addresses in Mermaid format

openshift-engот openshift-eng★ 123 звезды на GitHub13 установок в других каталогах

Об этом скилле

Quick Start - OVN Topology Generation

IMMEDIATE ACTIONS (follow these steps in order):

  1. Detect Cluster: Find the OVN-Kubernetes cluster kubeconfig

    Run: scripts/detect-cluster.sh 2>/dev/null

    The script discovers OVN-Kubernetes clusters:

    • Scans all kubeconfig files: current KUBECONFIG env, ~/.kube/kind-config, ~/ovn.conf, ~/.kube/config
    • Tests ALL contexts in each kubeconfig (not just current-context)
    • Returns parseable list to stdout: index|kubeconfig|cluster_name|node_count|namespace
    • Diagnostics go to stderr
    • Exit code: 0=success, 1=no clusters found

    How to handle the output:

    The script returns pipe-delimited lines to stdout, one per cluster found, e.g.:

    1|/home/user/.kube/kind-config|kind-ovn|3|ovn-kubernetes
    2|/home/user/.kube/config|prod-cluster|12|openshift-ovn-kubernetes
    

    Decision logic:

    • If one cluster found → automatically use it (extract kubeconfig path from column 2)
    • If multiple clusters found → show the list to user and ask them to choose by number
    • After selection, extract the kubeconfig path from column 2 of the chosen line
    • Store the selected kubeconfig path in variable KC for use in subsequent steps

    Example output format parsing:

    • Column 1: Index number (for user selection)
    • Column 2: Kubeconfig file path (this is what you need for $KC)
    • Column 3: Cluster display name
    • Column 4: Number of nodes
    • Column 5: OVN namespace name

    Important: Parse the output using standard text processing. The exact implementation is up to you - use whatever approach works best (awk, Python, inline parsing, etc.).

  2. Check Permissions: Verify user's Kubernetes access level and inform about write permissions

    Run: scripts/check_permissions.py "$KC"

    The script returns:

    • Exit 0: Read-only access or user confirmed → proceed
    • Exit 1: Error or user cancelled → stop
    • Exit 2: Write permissions detected → AI must ask user for confirmation

    When exit code 2 is returned:

    1. Parse the stdout to get the list of write permissions
    2. Display the permissions clearly to the user using a formatted message
    3. Explain that:
      • This skill performs ONLY read-only operations
      • No cluster modifications will be made
      • The warning is for transparency about their access level
      • List read-only operations: kubectl get, kubectl exec (ovn-nbctl list), local file writes
      • List forbidden operations: kubectl create/delete/patch, ovn-nbctl modifications
    4. Ask the user explicitly: "You have cluster admin permissions. This command will only perform read-only operations. Do you want to proceed?"
    5. If user says yes → continue, if no → stop

    Example of proper user communication:

    ⚠️  WARNING: Write Permissions Detected
    
    Your kubeconfig has cluster admin permissions:
      • Delete pods, deployments, services
      • Create and modify resources
      • Full cluster access
    
    📋 IMPORTANT:
    This command will ONLY perform read-only operations:
      ✅ kubectl get (pods, nodes)
      ✅ kubectl exec (to run read-only ovn-nbctl list commands)
      ✅ Local file writes (topology diagram)
    
    Operations that will NEVER be performed:
      ❌ kubectl create/delete/patch/apply
      ❌ ovn-nbctl modifications
      ❌ Any cluster state changes
    
    Do you want to proceed with read-only topology generation?
    

    Security Note: This step ensures informed consent. The user must be explicitly aware that their cluster admin credentials are accessible to the AI agent (acting on their behalf), even though only read-only operations will be performed. This transparency is critical for security and trust.

  3. Check Output File: Ask user if ovn-topology-diagram.md exists:

    • (1) Overwrite, (2) Custom path, (3) Timestamp, (4) Cancel
  4. Create Private Temp Directory: Create a private temporary directory using mkdtemp and use it for all temporary files.

    TMPDIR=$(mktemp -d)
    
  5. Collect OVN Data: Get full topology data from the cluster

    Run: scripts/collect_ovn_data.py "$KC" "$TMPDIR"

    Detail files written to $TMPDIR:

    • ovn_switches_detail.txt - node|uuid|name|other_config
    • ovn_routers_detail.txt - node|uuid|name|external_ids|options
    • ovn_lsps_detail.txt - node|name|addresses|type|options
    • ovn_lrps_detail.txt - node|name|mac|networks|options
    • ovn_pods_detail.txt - namespace|name|ip|node
  6. Analyze Placement: Determine per-node vs cluster-wide components

    Run: scripts/analyze_placement.py "$TMPDIR"

    Placement results written to $TMPDIR:

    • ovn_switch_placement.txt - name|placement (per-node|cluster-wide|cluster-wide-visual)
    • ovn_router_placement.txt - name|placement (per-node|cluster-wide|cluster-wide-visual)
  7. Generate Diagram: Create Mermaid graph BT diagram

    • Read $TMPDIR/ovn_switch_placement.txt
Полный SKILL.md на GitHub

Установить generating-ovn-topology в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash
Read
Write

Вложенные файлы

README.mdscripts/analyze_placement.pyscripts/check_permissions.pyscripts/collect_ovn_data.pyscripts/detect-cluster.shscripts/ovn_utils.py

FAQ

Что делает скилл generating-ovn-topology?

Generates and displays OVN-Kubernetes network topology diagrams showing logical switches, routers, ports with IP/MAC addresses in Mermaid format

Как установить скилл generating-ovn-topology?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл generating-ovn-topology запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить generating-ovn-topology с