Skip to content

Commit c9aac19

Browse files
committed
Merge remote-tracking branch 'upstream/main' into aks-preview-remove-storage-track1
# Conflicts: # src/aks-preview/HISTORY.rst
2 parents d163984 + 2e86209 commit c9aac19

File tree

15 files changed

+50
-1106
lines changed

15 files changed

+50
-1106
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15-
18.0.0b30
15+
18.0.0b31
1616
+++++++
1717
* Remove DATA_STORAGE references
1818

19+
18.0.0b30
20+
+++++++
21+
* Remove interactive AI-powered debugging tool `az aks agent`. To use the debugging tool, please enable it in the aks-agent extension by running `az extension add --name aks-agent`.
22+
1923
18.0.0b29
2024
+++++++
2125
* Refactor code to suppress ssh access warning message when creating an automatic cluster.

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,3 @@
373373
CONST_K8S_EXTENSION_NAME = "k8s-extension"
374374
CONST_K8S_EXTENSION_ACTION_MOD_NAME = "azext_k8s_extension.action"
375375
CONST_K8S_EXTENSION_FORMAT_MOD_NAME = "azext_k8s_extension._format"
376-
377-
# aks agent constants
378-
CONST_AGENT_CONFIG_PATH_DIR_ENV_KEY = "HOLMES_CONFIGPATH_DIR"
379-
CONST_AGENT_NAME = "AKS AGENT"
380-
CONST_AGENT_NAME_ENV_KEY = "AGENT_NAME"
381-
CONST_AGENT_CONFIG_FILE_NAME = "aksAgent.yaml"

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,99 +3952,3 @@
39523952
type: string
39533953
short-summary: Name of the identity binding to show.
39543954
"""
3955-
3956-
helps[
3957-
"aks agent"
3958-
] = """
3959-
type: command
3960-
short-summary: Run AI assistant to analyze and troubleshoot Kubernetes clusters.
3961-
long-summary: |-
3962-
This command allows you to ask questions about your Azure Kubernetes cluster and get answers using AI models.
3963-
Environment variables must be set to use the AI model, please refer to https://docs.litellm.ai/docs/providers to learn more about supported AI providers and models and required environment variables.
3964-
parameters:
3965-
- name: --name -n
3966-
type: string
3967-
short-summary: Name of the managed cluster.
3968-
- name: --resource-group -g
3969-
type: string
3970-
short-summary: Name of the resource group.
3971-
- name: --model
3972-
type: string
3973-
short-summary: Model to use for the LLM.
3974-
- name: --api-key
3975-
type: string
3976-
short-summary: API key to use for the LLM (if not given, uses environment variables AZURE_API_KEY, OPENAI_API_KEY).
3977-
- name: --config-file
3978-
type: string
3979-
short-summary: Path to configuration file.
3980-
- name: --max-steps
3981-
type: int
3982-
short-summary: Maximum number of steps the LLM can take to investigate the issue.
3983-
- name: --no-interactive
3984-
type: bool
3985-
short-summary: Disable interactive mode. When set, the agent will not prompt for input and will run in batch mode.
3986-
- name: --no-echo-request
3987-
type: bool
3988-
short-summary: Disable echoing back the question provided to AKS Agent in the output.
3989-
- name: --show-tool-output
3990-
type: bool
3991-
short-summary: Show the output of each tool that was called during the analysis.
3992-
- name: --refresh-toolsets
3993-
type: bool
3994-
short-summary: Refresh the toolsets status.
3995-
3996-
examples:
3997-
- name: Ask about pod issues in the cluster with Azure OpenAI
3998-
text: |-
3999-
export AZURE_API_BASE="https://my-azureopenai-service.openai.azure.com/"
4000-
export AZURE_API_VERSION="2025-01-01-preview"
4001-
export AZURE_API_KEY="sk-xxx"
4002-
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model azure/my-gpt4.1-deployment
4003-
- name: Ask about pod issues in the cluster with OpenAI
4004-
text: |-
4005-
export OPENAI_API_KEY="sk-xxx"
4006-
az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model gpt-4o
4007-
- name: Run in interactive mode without a question
4008-
text: az aks agent "Check the pod status in my cluster" --name MyManagedCluster --resource-group MyResourceGroup --model azure/my-gpt4.1-deployment --api-key "sk-xxx"
4009-
- name: Run in non-interactive batch mode
4010-
text: az aks agent "Diagnose networking issues" --no-interactive --max-steps 15 --model azure/my-gpt4.1-deployment
4011-
- name: Show detailed tool output during analysis
4012-
text: az aks agent "Why is my service workload unavailable in namespace workload-ns?" --show-tool-output --model azure/my-gpt4.1-deployment
4013-
- name: Use custom configuration file
4014-
text: az aks agent "Check kubernetes pod resource usage" --config-file /path/to/custom.yaml --model azure/my-gpt4.1-deployment
4015-
- name: Run agent with no echo of the original question
4016-
text: az aks agent "What is the status of my cluster?" --no-echo-request --model azure/my-gpt4.1-deployment
4017-
- name: Refresh toolsets to get the latest available tools
4018-
text: az aks agent "What is the status of my cluster?" --refresh-toolsets --model azure/my-gpt4.1-deployment
4019-
- name: Run agent with config file
4020-
text: |
4021-
az aks agent "Check kubernetes pod resource usage" --config-file /path/to/custom.yaml
4022-
Here is an example of config file:
4023-
```json
4024-
model: "gpt-4o"
4025-
api_key: "..."
4026-
# define a list of mcp servers, mcp server can be defined
4027-
mcp_servers:
4028-
aks_mcp:
4029-
description: "The AKS-MCP is a Model Context Protocol (MCP) server that enables AI assistants to interact with Azure Kubernetes Service (AKS) clusters"
4030-
url: "http://localhost:8003/sse"
4031-
4032-
# try adding your own tools or toggle the built-in toolsets here
4033-
# e.g. query company-specific data, fetch logs from your existing observability tools, etc
4034-
# To check how to add a customized toolset, please refer to https://docs.robusta.dev/master/configuration/holmesgpt/custom_toolsets.html#custom-toolsets
4035-
# To find all built-in toolsets, please refer to https://docs.robusta.dev/master/configuration/holmesgpt/builtin_toolsets.html
4036-
toolsets:
4037-
# add a new json processor toolset
4038-
json_processor:
4039-
description: "A toolset for processing JSON data using jq"
4040-
prerequisites:
4041-
- command: "jq --version" # Ensure jq is installed
4042-
tools:
4043-
- name: "process_json"
4044-
description: "A tool that uses jq to process JSON input"
4045-
command: "echo '{{ json_input }}' | jq '.'" # Example jq command to format JSON
4046-
# disable a built-in toolsets
4047-
aks/core:
4048-
enabled: false
4049-
```
4050-
"""

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
validate_nat_gateway_idle_timeout,
2424
validate_nat_gateway_managed_outbound_ip_count,
2525
)
26-
from azure.cli.core.api import get_config_dir
2726
from azure.cli.core.commands.parameters import (
2827
edge_zone_type,
2928
file_type,
@@ -151,7 +150,6 @@
151150
CONST_ADVANCED_NETWORKPOLICIES_L7,
152151
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
153152
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
154-
CONST_AGENT_CONFIG_FILE_NAME,
155153
)
156154

157155
from azext_aks_preview._validators import (
@@ -225,7 +223,6 @@
225223
validate_max_blocked_nodes,
226224
validate_resource_group_parameter,
227225
validate_location_resource_group_cluster_parameters,
228-
validate_agent_config_file,
229226
)
230227
from azext_aks_preview.azurecontainerstorage._consts import (
231228
CONST_ACSTOR_ALL,
@@ -2781,70 +2778,6 @@ def load_arguments(self, _):
27812778
action="store_true",
27822779
)
27832780

2784-
with self.argument_context("aks agent") as c:
2785-
c.positional(
2786-
"prompt",
2787-
help="Ask any question and answer using available tools.",
2788-
)
2789-
c.argument(
2790-
"resource_group_name",
2791-
options_list=["--resource-group", "-g"],
2792-
help="Name of resource group.",
2793-
required=False,
2794-
)
2795-
c.argument(
2796-
"name",
2797-
options_list=["--name", "-n"],
2798-
help="Name of the managed cluster.",
2799-
required=False,
2800-
)
2801-
c.argument(
2802-
"max_steps",
2803-
type=int,
2804-
default=10,
2805-
required=False,
2806-
help="Maximum number of steps the LLM can take to investigate the issue.",
2807-
)
2808-
c.argument(
2809-
"config_file",
2810-
default=os.path.join(get_config_dir(), CONST_AGENT_CONFIG_FILE_NAME),
2811-
validator=validate_agent_config_file,
2812-
required=False,
2813-
help="Path to the config file.",
2814-
)
2815-
c.argument(
2816-
"model",
2817-
help="The model to use for the LLM.",
2818-
required=False,
2819-
type=str,
2820-
)
2821-
c.argument(
2822-
"api-key",
2823-
help="API key to use for the LLM (if not given, uses environment variables AZURE_API_KEY, OPENAI_API_KEY)",
2824-
required=False,
2825-
type=str,
2826-
)
2827-
c.argument(
2828-
"no_interactive",
2829-
help="Disable interactive mode. When set, the agent will not prompt for input and will run in batch mode.",
2830-
action="store_true",
2831-
)
2832-
c.argument(
2833-
"no_echo_request",
2834-
help="Disable echoing back the question provided to AKS Agent in the output.",
2835-
action="store_true",
2836-
)
2837-
c.argument(
2838-
"show_tool_output",
2839-
help="Show the output of each tool that was called.",
2840-
action="store_true",
2841-
)
2842-
c.argument(
2843-
"refresh_toolsets",
2844-
help="Refresh the toolsets status.",
2845-
action="store_true",
2846-
)
2847-
28482781

28492782
def _get_default_install_location(exe_name):
28502783
system = platform.system()

src/aks-preview/azext_aks_preview/_validators.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
from ipaddress import ip_network
1212
from math import isclose, isnan
1313

14-
import yaml
1514
from azext_aks_preview._consts import (
16-
ADDONS, CONST_AGENT_CONFIG_FILE_NAME,
15+
ADDONS,
1716
CONST_AZURE_SERVICE_MESH_MAX_EGRESS_NAME_LENGTH,
1817
CONST_LOAD_BALANCER_BACKEND_POOL_TYPE_NODE_IP,
1918
CONST_LOAD_BALANCER_BACKEND_POOL_TYPE_NODE_IPCONFIGURATION,
@@ -26,7 +25,6 @@
2625
CONST_OS_SKU_CBLMARINER, CONST_OS_SKU_MARINER)
2726
from azext_aks_preview._helpers import _fuzzy_match
2827
from azure.cli.core import keys
29-
from azure.cli.core.api import get_config_dir
3028
from azure.cli.core.azclierror import (ArgumentUsageError,
3129
InvalidArgumentValueError,
3230
MutuallyExclusiveArgumentError,
@@ -974,39 +972,3 @@ def validate_location_resource_group_cluster_parameters(namespace):
974972
raise MutuallyExclusiveArgumentError(
975973
"Cannot specify --location and --resource-group and --cluster at the same time."
976974
)
977-
978-
979-
def _validate_param_yaml_file(yaml_path, param_name):
980-
if not yaml_path:
981-
return
982-
if not os.path.exists(yaml_path):
983-
raise InvalidArgumentValueError(
984-
f"--{param_name}={yaml_path}: file is not found."
985-
)
986-
if not os.access(yaml_path, os.R_OK):
987-
raise InvalidArgumentValueError(
988-
f"--{param_name}={yaml_path}: file is not readable."
989-
)
990-
try:
991-
with open(yaml_path, "r") as file:
992-
yaml.safe_load(file)
993-
except yaml.YAMLError as e:
994-
raise InvalidArgumentValueError(
995-
f"--{param_name}={yaml_path}: file is not a valid YAML file: {e}"
996-
)
997-
except Exception as e:
998-
raise InvalidArgumentValueError(
999-
f"--{param_name}={yaml_path}: An error occurred while reading the config file: {e}"
1000-
)
1001-
1002-
1003-
def validate_agent_config_file(namespace):
1004-
config_file = namespace.config_file
1005-
if not config_file:
1006-
return
1007-
# default config file path can be empty
1008-
default_config_path = os.path.join(get_config_dir(), CONST_AGENT_CONFIG_FILE_NAME)
1009-
if config_file == default_config_path and not os.path.exists(config_file):
1010-
return
1011-
1012-
_validate_param_yaml_file(config_file, "config-file")

src/aks-preview/azext_aks_preview/agent/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)