ako_restart
Restart AKO pod by deleting it for automatic recreation. Solves stuck states or applies config changes. Confirmation required.
Instructions
[WRITE] Restart AKO pod by deleting it (K8s recreates automatically).
Use when AKO is stuck or after config changes. Brief traffic disruption possible during restart.
SAFETY: Requires confirmed=True to execute. Default False returns a preview message describing the intended action.
Args: context: K8s context name (optional). confirmed: Must be True to actually restart the AKO pod. Default False returns a preview-only message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | ||
| confirmed | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- mcp_server/server.py:285-308 (handler)MCP tool handler that exposes ako_restart. Requires confirmed=True to execute; otherwise returns a preview message. Delegates to vmware_avi.ops.ako_pod.restart_ako with skip_prompt=True.
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": True, "idempotentHint": False, "openWorldHint": True}) @vmware_tool(risk_level="high") def ako_restart(context: str | None = None, confirmed: bool = False) -> str: """[WRITE] Restart AKO pod by deleting it (K8s recreates automatically). Use when AKO is stuck or after config changes. Brief traffic disruption possible during restart. SAFETY: Requires confirmed=True to execute. Default False returns a preview message describing the intended action. Args: context: K8s context name (optional). confirmed: Must be True to actually restart the AKO pod. Default False returns a preview-only message. """ if not confirmed: ctx_hint = f" in context '{context}'" if context else "" return ( f"[preview] Would delete the AKO pod{ctx_hint} — K8s will recreate it automatically. " "Brief traffic disruption is possible during restart. " "Re-invoke with confirmed=True to execute." ) from vmware_avi.ops.ako_pod import restart_ako return _capture_output(restart_ako, context, skip_prompt=True) - vmware_avi/ops/ako_pod.py:89-112 (helper)Core helper function that finds the AKO pod via label selector and deletes it using the Kubernetes API. When called from the MCP tool, skip_prompt=True skips the double-confirm prompt.
def restart_ako(context: str | None = None, *, skip_prompt: bool = False) -> None: """Restart AKO pod by deleting it (deployment recreates it). Args: context: K8s context name (optional, uses current context). skip_prompt: When True, bypass the interactive double-confirm prompt. Used by MCP callers that enforce confirmation via the ``confirmed`` parameter before reaching this function. """ if not skip_prompt: from vmware_avi._safety import double_confirm if not double_confirm("Restart AKO pod"): console.print("[yellow]Cancelled.[/yellow]") return cfg = load_config() k8s = K8sConnectionManager(cfg) v1 = k8s.core_v1(context) ns = k8s.namespace pod_name = _get_ako_pod_name(v1, ns) v1.delete_namespaced_pod(pod_name, ns) console.print(f"[green]AKO pod '{pod_name}' deleted. Deployment will recreate it.[/green]") - mcp_server/server.py:285-287 (registration)MCP tool registration via @mcp.tool decorator with annotations marking it as destructive, non-read-only, and non-idempotent.
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": True, "idempotentHint": False, "openWorldHint": True}) @vmware_tool(risk_level="high") def ako_restart(context: str | None = None, confirmed: bool = False) -> str: - mcp_server/server.py:295-298 (schema)Input schema: context (optional str) and confirmed (bool, default False) as the two parameters.
Args: context: K8s context name (optional). confirmed: Must be True to actually restart the AKO pod. Default False returns a preview-only message. - vmware_avi/cli.py:280-287 (registration)CLI registration of ako_restart as a Typer subcommand under the 'ako' app group.
@ako_app.command("restart") def ako_restart( context: str | None = typer.Option(None, help="K8s context"), ) -> None: """Restart AKO pod (requires confirmation).""" from vmware_avi.ops.ako_pod import restart_ako restart_ako(context)