Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

No way to install dapr on AKS without usser input, because it checks for piping #28823

Open GMihai00 opened 7 months ago

GMihai00 commented 7 months ago

Describe the bug

No way to install dapr on AKS without usser input, because it checks for piping

Related command

az k8s-extension create --resource-group $env:RESOURCE_GROUP --cluster-name $env:CLUSTER_NAME --cluster-type managedClusters --name dapr --extension-type Microsoft.Dapr --scope cluster --release-train stable --auto-upgrade-minor-version true --configuration-settings "global.mtls.enabled=false"

Errors

File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "C:\Users\mihaigh.azure\cliextensions\k8s-extension\azext_k8s_extension\custom.py", line 173, in create_k8s_extension extension_instance, name, create_identity = extension_class.Create( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mihaigh.azure\cliextensions\k8s-extension\azext_k8s_extension\partner_extensions\Dapr.py", line 122, in Create self._get_release_info(name, release_namespace, configuration_settings) File "C:\Users\mihaigh.azure\cliextensions\k8s-extension\azext_k8s_extension\partner_extensions\Dapr.py", line 93, in _get_release_info if prompt_y_n(self.MSG_IS_DAPR_INSTALLED, default='n'): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 71, in prompt_y_n File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 79, in _prompt_bool File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 28, in verify_is_a_tty knack.prompting.NoTTYException To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "C:\Users\mihaigh.azure\cliextensions\k8s-extension\azext_k8s_extension\custom.py", line 173, in create_k8s_extension extension_instance, name, create_identity = extension_class.Create( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mihaigh.azure\cliextensions\k8s-extension\azext_k8s_extension\partner_extensions\Dapr.py", line 122, in Create self._get_release_info(name, release_namespace, configuration_settings) File "C:\Users\mihaigh.azure\cliextensions\k8s-extension\azext_k8s_extension\partner_extensions\Dapr.py", line 93, in _get_release_info if prompt_y_n(self.MSG_IS_DAPR_INSTALLED, default='n'): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 71, in prompt_y_n File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 79, in _prompt_bool File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 28, in verify_is_a_tty knack.prompting.NoTTYException To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Expected behavior

There should be a way to automatically install DAPR on an AKS

Environment Summary

azure-cli 2.58.0 *

core 2.58.0 * telemetry 1.1.0

Extensions: aks-preview 2.0.0b6 azure-devops 1.0.0 front-door 1.0.17 k8s-extension 1.6.1

Dependencies: msal 1.26.0 azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe' Extensions directory 'C:\Users\mihaigh.azure\cliextensions'

Python (Windows) 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

azure-client-tools-bot-prd[bot] commented 7 months ago

Hi @GMihai00,

2.58.0 is not the latest Azure CLI(2.59.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 7 months ago

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

azure-client-tools-bot-prd[bot] commented 7 months ago
Hi @GMihai00 Find similar issue https://github.com/Azure/azure-cli/issues/26833.
Issue title Upgrade 2.50 CLI az aks upgrade --kubernetes-version 1.26.3 Fails
Create time 2023-07-06
Comment number 6

Possible solution: To automatically install DAPR on an AKS, you can try running the az k8s-extension create command with the --yes flag to bypass the prompt for user input. Here's an example command:

az k8s-extension create --resource-group $env:RESOURCE_GROUP `
        --cluster-name $env:CLUSTER_NAME `
        --cluster-type managedClusters `
        --name dapr `
        --extension-type Microsoft.Dapr `
        --scope cluster `
        --release-train stable `
        --auto-upgrade-minor-version true `
        --configuration-settings "global.mtls.enabled=false" --yes

Alternatively, you can try updating the AKS resource directly using the az resource update command. Here's an example command:

az resource update --ids <aks_resource_id> --set 'properties.kubernetesVersion=1.26.3 '--set 'properties.agentPoolProfiles[0].orchestratorVersion=1.26.3'

If you are still encountering issues, it might be best to open a Microsoft support ticket for further troubleshooting.


Please confirm if this resolves your issue.

psddp commented 1 month ago

@yonzhan Having the same issue.

The --yes option is not working

az k8s-extension create --resource-group $RESOURCE_GROUP \ --cluster-name $CLUSTER_NAME \ --cluster-type managedClusters \ --name dapr \ --extension-type Microsoft.Dapr \ --scope cluster \ --release-train stable \ --auto-upgrade-minor-version true \ --configuration-settings "global.mtls.enabled=false" --yes unrecognized arguments: --yes
Examples from AI knowledge base: https://aka.ms/cli_ref Read more about the command in reference docs

Hi @GMihai00 Find similar issue #26833.

Issue title Upgrade 2.50 CLI az aks upgrade --kubernetes-version 1.26.3 Fails Create time 2023-07-06 Comment number 6 Possible solution: To automatically install DAPR on an AKS, you can try running the az k8s-extension create command with the --yes flag to bypass the prompt for user input. Here's an example command:

az k8s-extension create --resource-group $env:RESOURCE_GROUP `
        --cluster-name $env:CLUSTER_NAME `
        --cluster-type managedClusters `
        --name dapr `
        --extension-type Microsoft.Dapr `
        --scope cluster `
        --release-train stable `
        --auto-upgrade-minor-version true `
        --configuration-settings "global.mtls.enabled=false" --yes

Alternatively, you can try updating the AKS resource directly using the az resource update command. Here's an example command:

az resource update --ids <aks_resource_id> --set 'properties.kubernetesVersion=1.26.3 '--set 'properties.agentPoolProfiles[0].orchestratorVersion=1.26.3'

If you are still encountering issues, it might be best to open a Microsoft support ticket for further troubleshooting.

Please confirm if this resolves your issue.