Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
381 stars 1.2k forks source link

az k8s-extension extension-types InvalidResourceType error #7069

Open willie-yao opened 9 months ago

willie-yao commented 9 months ago

Describe the bug

There seems to be an error with the ASO api version being used in this command. Microsoft.KubernetesConfiguration is present in api version 2023-05-01, not 2023-05-01-preview like what the command is using.

ASO Reference: https://azure.github.io/azure-service-operator/reference/kubernetesconfiguration/

Related command

az k8s-extension extension-types list-by-location

Errors

(InvalidResourceType) The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'. Code: InvalidResourceType Message: The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'.

Issue script & Debug output

cli.knack.cli: Command arguments: ['k8s-extension', 'extension-types', 'list-by-location', '-l', 'eastus', '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f3bb5bad3a0>, <function OutputProducer.on_global_arguments at 0x7f3bb594dda0>, <function CLIQuery.on_global_arguments at 0x7f3bb5987880>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'k8s-extension': ['azext_k8s_extension'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: Total (0) 0.000 0 0 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: k8s-extension 0.127 2 16 /home/willie/.azure/cliextensions/k8s-extension cli.azure.cli.core: Total (1) 0.127 2 16
cli.azure.cli.core: Loaded 2 groups, 16 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : k8s-extension extension-types list-by-location cli.azure.cli.core: Command table: k8s-extension extension-types list-by-location cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f3bb1c50c20>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/willie/.azure/commands/2023-12-08.19-37-07.k8s-extension_extension-types_list-by-location.87848.log'. az_command_data_logger: command args: k8s-extension extension-types list-by-location -l {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f3bb1813100>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f3bb1890ea0>, <function register_cache_arguments..add_cache_arguments at 0x7f3bb1890fe0>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f3bb594de40>, <function CLIQuery.handle_query_parameter at 0x7f3bb5987920>, <function register_ids_argument..parse_ids_arguments at 0x7f3bb1890f40>] az_command_data_logger: extension name: k8s-extension az_command_data_logger: extension version: 1.5.2 Command group 'k8s-extension extension-types' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus cli.azure.cli.core.commands.client_factory: Getting management service client client_type=SourceControlConfigurationClient cli.azure.cli.core.auth.persistence: build_persistence: location='/home/willie/.azure/msal_token_cache.json', encrypt=False cli.azure.cli.core.auth.binary_cache: load: /home/willie/.azure/msal_http_cache.bin urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None) msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/tokenid/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/tokenid/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/tokenid/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/tokenid/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/tokenid/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/tokenid/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/tokenid/kerberos', 'tenant_region_scope': 'WW', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'} msal.application: Broker enabled? False cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={} cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={} msal.application: Cache hit an AT msal.telemetry: Generate or reuse correlation_id: 7a1b3e8c-04e5-46db-a7ff-1a36a678a300 cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/subid/providers/Microsoft.KubernetesConfiguration/locations/eastus/extensionTypes?api-version=2023-05-01-preview' cli.azure.cli.core.sdk.policies: Request method: 'GET' cli.azure.cli.core.sdk.policies: Request headers: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json' cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '2bf2c26b-9601-11ee-abd1-000d3aeb2644' cli.azure.cli.core.sdk.policies: 'CommandName': 'k8s-extension extension-types list-by-location' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-l --debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.55.0 (DEB) azsdk-python-azure-mgmt-kubernetesconfiguration/0.1.0 Python/3.11.5 (Linux-5.4.0-1109-azure-x86_64-with-glibc2.27)' cli.azure.cli.core.sdk.policies: 'Authorization': '*****' cli.azure.cli.core.sdk.policies: Request body: cli.azure.cli.core.sdk.policies: This request has no body urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443 urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/subid/providers/Microsoft.KubernetesConfiguration/locations/eastus/extensionTypes?api-version=2023-05-01-preview HTTP/1.1" 404 180 cli.azure.cli.core.sdk.policies: Response status: 404 cli.azure.cli.core.sdk.policies: Response headers: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache' cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache' cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8' cli.azure.cli.core.sdk.policies: 'Expires': '-1' cli.azure.cli.core.sdk.policies: 'x-ms-failure-cause': 'gateway' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '4edceeee-6b43-4f3d-b606-feb533979bbb' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '4edceeee-6b43-4f3d-b606-feb533979bbb' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'SOUTHCENTRALUS:20231208T193707Z:4edceeee-6b43-4f3d-b606-feb533979bbb' cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff' cli.azure.cli.core.sdk.policies: 'Date': 'Fri, 08 Dec 2023 19:37:07 GMT' cli.azure.cli.core.sdk.policies: 'Content-Length': '180' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {"error":{"code":"InvalidResourceType","message":"The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'."}} cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 710, in _run_job result = list(result) ^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/core/paging.py", line 128, in next return next(self._page_iterator) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/core/paging.py", line 76, in next self._response = self._get_next(self.continuation_token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/willie/.azure/cliextensions/k8s-extension/azext_k8s_extension/vendored_sdks/v2023_05_01_preview/operations/_extension_types_operations.py", line 517, in get_next map_error(status_code=response.status_code, response=response, error_map=error_map) File "/opt/az/lib/python3.11/site-packages/azure/core/exceptions.py", line 107, in map_error raise error azure.core.exceptions.ResourceNotFoundError: (InvalidResourceType) The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'. Code: InvalidResourceType Message: The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'.

cli.azure.cli.core.azclierror: (InvalidResourceType) The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'. Code: InvalidResourceType Message: The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'. az_command_data_logger: (InvalidResourceType) The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'. Code: InvalidResourceType Message: The resource type could not be found in the namespace 'Microsoft.KubernetesConfiguration' for api version '2023-05-01-preview'. cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f3bb1c50ea0>] az_command_data_logger: exit code: 3 cli.main: Command ran in 0.781 seconds (init: 0.238, invoke: 0.543) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3998 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/init.py /home/willie/.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.

Expected behavior

It should list the extension types instead of returning an error

Environment Summary

azure-cli 2.55.0

core 2.55.0 telemetry 1.1.0

Extensions: fleet 1.0.1 k8s-extension 1.5.2

Dependencies: msal 1.24.0b2 azure-mgmt-resource 23.1.0b2

Python location '/opt/az/bin/python3' Extensions directory '/home/willie/.azure/cliextensions'

Python (Linux) 3.11.5 (main, Nov 29 2023, 03:41:30) [GCC 7.5.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 9 months ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 9 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dyu1208, @FumingZhang, @andyliuliming.

bavneetsingh16 commented 6 months ago

@Arif-lakhani, can you please take a look?

dtzar commented 5 months ago

Is someone looking into this? It prevents people being able to figure out values they need to specify for CAPZ provisioning these extensions.

vlardn commented 4 months ago

Duplicate of https://github.com/Azure/azure-cli/issues/26491

Solution: