Skip to content

Commit 29693ba

Browse files
committed
remove user msi from aks-agent
1 parent 6aa6500 commit 29693ba

File tree

3 files changed

+10
-70
lines changed

3 files changed

+10
-70
lines changed

src/aks-agent/HISTORY.rst

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

15+
1.0.0b17
16+
++++++++
17+
Fix: remove the prompt to user about managed identity client id during `az aks agent-init``
18+
1519
1.0.0b16
1620
++++++++
1721
* Fix: client mode use AzureCLICredential to authenticate with Azure

src/aks-agent/azext_aks_agent/agent/k8s/aks_agent_manager.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ def __init__(self, resource_group_name: str, cluster_name: str,
131131
self.chart_version = "0.2.0"
132132

133133
# credentials for aks-mcp
134-
# Managed identity client ID for accessing Azure resources
135-
self.managed_identity_client_id: str = ""
136134
# Default empty customized cluster role name means using default cluster role
137135
self.customized_cluster_role_name: str = ""
138136
# When aks mcp service account is set, helm charts wont create rbac for aks mcp
@@ -202,16 +200,8 @@ def _load_existing_helm_release_config(self):
202200
# Read API keys from Kubernetes secret and populate model_list
203201
self._populate_api_keys_from_secret()
204202

205-
# Load managed identity client ID if present
206203
mcp_addons = helm_values.get("mcpAddons", {})
207204
aks_config = mcp_addons.get("aks", {})
208-
azure_config = aks_config.get("azure", {})
209-
self.managed_identity_client_id = azure_config.get("clientId")
210-
211-
if self.managed_identity_client_id:
212-
logger.debug("Managed identity client ID loaded: %s", self.managed_identity_client_id)
213-
else:
214-
logger.debug("No managed identity client ID found in Helm values")
215205

216206
service_account_config = aks_config.get("serviceAccount", {})
217207
self.customized_cluster_role_name = service_account_config.get("customClusterRoleName", "")
@@ -936,13 +926,6 @@ def _create_helm_values(self):
936926
"create": False,
937927
}
938928

939-
helm_values["mcpAddons"]["aks"]["workloadIdentity"] = {
940-
"enabled": bool(self.managed_identity_client_id)
941-
}
942-
helm_values["mcpAddons"]["aks"]["azure"] = {
943-
"clientId": self.managed_identity_client_id
944-
}
945-
946929
return helm_values
947930

948931
def save_llm_config(self, provider: LLMProvider, params: dict) -> None:

src/aks-agent/azext_aks_agent/custom.py

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _setup_llm_configuration(console, aks_agent_manager: AKSAgentManagerLLMConfi
163163

164164

165165
def _setup_helm_deployment(console, aks_agent_manager: AKSAgentManager):
166-
"""Setup and deploy helm chart with service account and managed identity configuration."""
166+
"""Setup and deploy helm chart with service account configuration."""
167167
console.print("\n🚀 Phase 2: Helm Deployment", style=f"bold {HELP_COLOR}")
168168

169169
# Check current helm deployment status
@@ -179,22 +179,6 @@ def _setup_helm_deployment(console, aks_agent_manager: AKSAgentManager):
179179
f"\n👤 Current service account in namespace '{aks_agent_manager.namespace}': {service_account_name}",
180180
style="cyan")
181181

182-
# Prompt for managed identity client ID update
183-
existing_client_id = aks_agent_manager.managed_identity_client_id
184-
if existing_client_id:
185-
console.print(
186-
f"\n🔑 Current workload identity (managed identity) client ID: {existing_client_id}", style="cyan")
187-
change_client_id = console.input(
188-
f"[{HELP_COLOR}]Do you want to change the workload identity client ID? (y/N): [/]").strip().lower()
189-
190-
if change_client_id in ['y', 'yes']:
191-
managed_identity_client_id = _prompt_managed_identity_configuration(console)
192-
aks_agent_manager.managed_identity_client_id = managed_identity_client_id
193-
else:
194-
console.print("\n🔑 No workload identity (managed identity) currently configured.", style="cyan")
195-
managed_identity_client_id = _prompt_managed_identity_configuration(console)
196-
if managed_identity_client_id:
197-
aks_agent_manager.managed_identity_client_id = managed_identity_client_id
198182
elif helm_status == "not_found":
199183
console.print(
200184
f"Helm chart not deployed (status: {helm_status}). Setting up deployment...",
@@ -203,11 +187,15 @@ def _setup_helm_deployment(console, aks_agent_manager: AKSAgentManager):
203187
# Prompt for service account configuration
204188
console.print("\n👤 Service Account Configuration", style=f"bold {HELP_COLOR}")
205189
console.print(
206-
f"The AKS agent requires a service account with appropriate permissions in the '{aks_agent_manager.namespace}' namespace.",
190+
f"The AKS agent requires a service account with appropriate Azure and Kubernetes permissions in the '{aks_agent_manager.namespace}' namespace.",
207191
style=INFO_COLOR)
208192
console.print(
209193
"Please ensure you have created the necessary Role and RoleBinding in your namespace for this service account.",
210194
style=WARNING_COLOR)
195+
console.print(
196+
"If the AKS agent requires access to Azure resources, the service account should be annotated with "
197+
"'azure.workload.identity/client-id: <managed-identity-client-id>'.",
198+
style=INFO_COLOR)
211199

212200
# Prompt user for service account name (required)
213201
while True:
@@ -220,10 +208,6 @@ def _setup_helm_deployment(console, aks_agent_manager: AKSAgentManager):
220208
console.print(
221209
"Service account name cannot be empty. Please enter a valid service account name.", style=WARNING_COLOR)
222210

223-
# Prompt for managed identity client ID
224-
managed_identity_client_id = _prompt_managed_identity_configuration(console)
225-
if managed_identity_client_id:
226-
aks_agent_manager.managed_identity_client_id = managed_identity_client_id
227211
else:
228212
# Handle non-standard helm status (failed, pending-install, pending-upgrade, etc.)
229213
cmd_flags = aks_agent_manager.command_flags()
@@ -269,37 +253,6 @@ def _setup_helm_deployment(console, aks_agent_manager: AKSAgentManager):
269253
f"You can check the status later using 'az aks agent --status {cmd_flags}'", style="cyan")
270254

271255

272-
def _prompt_managed_identity_configuration(console):
273-
"""Prompt user for managed identity client ID configuration."""
274-
console.print("\n🔑 Managed Identity Configuration", style=f"bold {HELP_COLOR}")
275-
276-
console.print(
277-
"To access Azure resources using workload identity, you need to provide the managed identity client ID.",
278-
style=INFO_COLOR)
279-
280-
configure = console.input(
281-
f"[{HELP_COLOR}]Do you want to configure managed identity client ID? (Y/n): [/]").strip().lower()
282-
283-
if configure in ['n', 'no']:
284-
console.print(
285-
"⚠️ Skipping managed identity configuration. Workload identity will not be configured.",
286-
style=WARNING_COLOR
287-
)
288-
return ""
289-
290-
while True:
291-
client_id = console.input(
292-
f"[{HELP_COLOR}]Please enter your managed identity client ID: [/]").strip()
293-
294-
if client_id:
295-
console.print(f"✅ Using managed identity client ID: {client_id}", style=SUCCESS_COLOR)
296-
return client_id
297-
console.print(
298-
"❌ Client ID cannot be empty. Please provide a valid client ID or answer 'N' to skip.",
299-
style=ERROR_COLOR
300-
)
301-
302-
303256
def _setup_and_create_llm_config(console, aks_agent_manager: AKSAgentManagerLLMConfigBase):
304257
"""Setup and create LLM configuration with user input.
305258

0 commit comments

Comments
 (0)