diff --git a/src/aks-preview/HISTORY.md b/src/aks-preview/HISTORY.md index ee5433537d4..3699629bf0c 100644 --- a/src/aks-preview/HISTORY.md +++ b/src/aks-preview/HISTORY.md @@ -3,6 +3,10 @@ Release History =============== +0.5.25 ++++++ +* Add support for http proxy + 0.5.24 +++++ * * Add "--aks-custom-headers" for "az aks nodepool upgrade" diff --git a/src/aks-preview/azext_aks_preview/_help.py b/src/aks-preview/azext_aks_preview/_help.py index a1da68dd275..c6a34bfb698 100644 --- a/src/aks-preview/azext_aks_preview/_help.py +++ b/src/aks-preview/azext_aks_preview/_help.py @@ -317,6 +317,9 @@ - name: --linux-os-config type: string short-summary: OS configurations for Linux agent nodes. + - name: --http-proxy-config + type: string + short-summary: Http Proxy configuration for this cluster. - name: --enable-pod-identity type: bool short-summary: (PREVIEW) Enable pod identity addon. diff --git a/src/aks-preview/azext_aks_preview/_params.py b/src/aks-preview/azext_aks_preview/_params.py index c4e0e1b3787..85813119af1 100644 --- a/src/aks-preview/azext_aks_preview/_params.py +++ b/src/aks-preview/azext_aks_preview/_params.py @@ -121,6 +121,7 @@ def load_arguments(self, _): c.argument('auto_upgrade_channel', arg_type=get_enum_type([CONST_RAPID_UPGRADE_CHANNEL, CONST_STABLE_UPGRADE_CHANNEL, CONST_PATCH_UPGRADE_CHANNEL, CONST_NODE_IMAGE_UPGRADE_CHANNEL, CONST_NONE_UPGRADE_CHANNEL])) c.argument('kubelet_config', type=str) c.argument('linux_os_config', type=str) + c.argument('http_proxy_config', options_list=['--http-proxy-config'], type=str) c.argument('enable_pod_identity', action='store_true') c.argument('appgw_name', options_list=['--appgw-name'], arg_group='Application Gateway') c.argument('appgw_subnet_prefix', options_list=['--appgw-subnet-prefix'], arg_group='Application Gateway', deprecate_info=c.deprecate(redirect='--appgw-subnet-cidr', hide=True)) diff --git a/src/aks-preview/azext_aks_preview/custom.py b/src/aks-preview/azext_aks_preview/custom.py index e7d1b560354..ff716640275 100644 --- a/src/aks-preview/azext_aks_preview/custom.py +++ b/src/aks-preview/azext_aks_preview/custom.py @@ -77,6 +77,7 @@ ManagedClusterAutoUpgradeProfile, KubeletConfig, LinuxOSConfig, + ManagedClusterHTTPProxyConfig, SysctlConfig, ManagedClusterPodIdentityProfile, ManagedClusterPodIdentity, @@ -1028,6 +1029,7 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to enable_sgxquotehelper=False, kubelet_config=None, linux_os_config=None, + http_proxy_config=None, assign_identity=None, auto_upgrade_channel=None, enable_pod_identity=False, @@ -1440,6 +1442,9 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to "--fqdn-subdomain should only be used for private cluster with custom private dns zone") mc.fqdn_subdomain = fqdn_subdomain + if http_proxy_config: + mc.http_proxy_config = _get_http_proxy_config(http_proxy_config) + if uptime_sla: mc.sku = ManagedClusterSKU( name="Basic", @@ -4072,6 +4077,8 @@ def _is_msi_cluster(managed_cluster): def _get_kubelet_config(file_path): + if not os.path.isfile(file_path): + raise CLIError("{} is not valid file, or not accessable.".format(file_path)) kubelet_config = get_file_json(file_path) if not isinstance(kubelet_config, dict): raise CLIError( @@ -4100,6 +4107,8 @@ def _get_kubelet_config(file_path): def _get_linux_os_config(file_path): + if not os.path.isfile(file_path): + raise CLIError("{} is not valid file, or not accessable.".format(file_path)) os_config = get_file_json(file_path) if not isinstance(os_config, dict): raise CLIError( @@ -4171,6 +4180,22 @@ def _get_linux_os_config(file_path): return config_object +def _get_http_proxy_config(file_path): + if not os.path.isfile(file_path): + raise CLIError("{} is not valid file, or not accessable.".format(file_path)) + hp_config = get_file_json(file_path) + if not isinstance(hp_config, dict): + raise CLIError( + "Error reading Http Proxy Config at {}. Please see https://aka.ms/HttpProxyConfig for correct format.".format(file_path)) + config_object = ManagedClusterHTTPProxyConfig() + config_object.http_proxy = hp_config.get("httpProxy", None) + config_object.https_proxy = hp_config.get("httpsProxy", None) + config_object.no_proxy = hp_config.get("noProxy", None) + config_object.trusted_ca = hp_config.get("trustedCa", None) + + return config_object + + def _is_pod_identity_addon_enabled(instance): if not instance: return False diff --git a/src/aks-preview/azext_aks_preview/tests/latest/data/httpproxyconfig.json b/src/aks-preview/azext_aks_preview/tests/latest/data/httpproxyconfig.json new file mode 100644 index 00000000000..9eb4224ce2f --- /dev/null +++ b/src/aks-preview/azext_aks_preview/tests/latest/data/httpproxyconfig.json @@ -0,0 +1,9 @@ +{ + "httpProxy": "http://myproxy.server.com:8080/", + "httpsProxy": "https://myproxy.server.com:8080/", + "noProxy": [ + "localhost", + "127.0.0.1" + ], + "trustedCa": "G9yR2xrQ29NRjNURHg4cm1wOURCaUIvCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0=" +} \ No newline at end of file diff --git a/src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_create_with_http_proxy_config.yaml b/src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_create_with_http_proxy_config.yaml new file mode 100644 index 00000000000..fdb981ba644 --- /dev/null +++ b/src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_create_with_http_proxy_config.yaml @@ -0,0 +1,606 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.8.10 (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2020-10-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001","name":"clitest000001","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"product":"azurecli","cause":"automation","date":"2021-07-22T19:14:11Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '313' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 22 Jul 2021 19:14:12 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: '{"identity": {"type": "SystemAssigned"}, "properties": {"kubernetesVersion": + "", "dnsPrefix": "cliakstest-clitestbqkgxci4l-79a739", "agentPoolProfiles": + [{"count": 3, "vmSize": "Standard_DS2_v2", "osType": "Linux", "type": "VirtualMachineScaleSets", + "mode": "System", "enableNodePublicIP": false, "scaleSetPriority": "Regular", + "scaleSetEvictionPolicy": "Delete", "spotMaxPrice": -1.0, "enableEncryptionAtHost": + false, "enableUltraSSD": false, "enableFIPS": false, "name": "nodepool1"}], + "linuxProfile": {"adminUsername": "azureuser", "ssh": {"publicKeys": [{"keyData": + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTvSGQzrsV75ga46AU3nXIbkZjijQ2DBT+lyixTM0ZTXzqYveVVBReV0N5+zO4IkJN6sDAEb+9tUvlFJSjjBhxoMHtBj3jUi8FrDchfJE65tO3+lXFGwJeZuaGZTp2VGm7utXofIxlaOFfSRWwpe5xsOZlLi2QoMPGrbvKasaBez8Qv4PLXOUXu4YXYH4sDx+37UXCvNuOWg9fRZAZIat7vffUeWvYr9g5dV/6yhWB9IwRzBv2kvT1urubaXdAgyohDtywnMQGhZDerk9KFT+voUSAaOafjYnLGjajS6zKYIs/QfIHxnslgevmCMOBex2r+qm39FKNSw/F9Nggl2Zn"}]}}, + "addonProfiles": {}, "enableRBAC": true, "enablePodSecurityPolicy": false, "networkProfile": + {"networkPlugin": "kubenet", "podCidr": "10.244.0.0/16", "serviceCidr": "10.0.0.0/16", + "dnsServiceIP": "10.0.0.10", "dockerBridgeCidr": "172.17.0.1/16", "outboundType": + "loadBalancer", "loadBalancerSku": "standard"}, "disableLocalAccounts": false, + "httpProxyConfig": {"httpProxy": "http://myproxy.server.com:8080/", "httpsProxy": + "https://myproxy.server.com:8080/", "noProxy": ["localhost", "127.0.0.1"], "trustedCa": + "G9yR2xrQ29NRjNURHg4cm1wOURCaUIvCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0="}}, "location": + "westus2"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + Content-Length: + - '1564' + Content-Type: + - application/json + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2021-05-01 + response: + body: + string: "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002\",\n + \ \"location\": \"westus2\",\n \"name\": \"cliakstest000002\",\n \"type\": + \"Microsoft.ContainerService/ManagedClusters\",\n \"properties\": {\n \"provisioningState\": + \"Creating\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"kubernetesVersion\": + \"1.19.11\",\n \"dnsPrefix\": \"cliakstest-clitestbqkgxci4l-79a739\",\n + \ \"fqdn\": \"cliakstest-clitestbqkgxci4l-79a739-4e07d4ec.hcp.westus2.azmk8s.io\",\n + \ \"azurePortalFQDN\": \"cliakstest-clitestbqkgxci4l-79a739-4e07d4ec.portal.hcp.westus2.azmk8s.io\",\n + \ \"agentPoolProfiles\": [\n {\n \"name\": \"nodepool1\",\n \"count\": + 3,\n \"vmSize\": \"Standard_DS2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": + \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n + \ \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Creating\",\n + \ \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": + \"1.19.11\",\n \"enableNodePublicIP\": false,\n \"nodeLabels\": {},\n + \ \"mode\": \"System\",\n \"enableEncryptionAtHost\": false,\n \"enableUltraSSD\": + false,\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": + \"AKSUbuntu-1804gen2containerd-2021.07.03\",\n \"enableFIPS\": false\n + \ }\n ],\n \"linuxProfile\": {\n \"adminUsername\": \"azureuser\",\n + \ \"ssh\": {\n \"publicKeys\": [\n {\n \"keyData\": \"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDTvSGQzrsV75ga46AU3nXIbkZjijQ2DBT+lyixTM0ZTXzqYveVVBReV0N5+zO4IkJN6sDAEb+9tUvlFJSjjBhxoMHtBj3jUi8FrDchfJE65tO3+lXFGwJeZuaGZTp2VGm7utXofIxlaOFfSRWwpe5xsOZlLi2QoMPGrbvKasaBez8Qv4PLXOUXu4YXYH4sDx+37UXCvNuOWg9fRZAZIat7vffUeWvYr9g5dV/6yhWB9IwRzBv2kvT1urubaXdAgyohDtywnMQGhZDerk9KFT+voUSAaOafjYnLGjajS6zKYIs/QfIHxnslgevmCMOBex2r+qm39FKNSw/F9Nggl2Zn\"\n + \ }\n ]\n }\n },\n \"servicePrincipalProfile\": {\n \"clientId\":\"00000000-0000-0000-0000-000000000001\"\n + \ },\n \"nodeResourceGroup\": \"MC_clitest000001_cliakstest000002_westus2\",\n + \ \"enableRBAC\": true,\n \"enablePodSecurityPolicy\": false,\n \"networkProfile\": + {\n \"networkPlugin\": \"kubenet\",\n \"loadBalancerSku\": \"standard\",\n + \ \"loadBalancerProfile\": {\n \"managedOutboundIPs\": {\n \"count\": + 1\n }\n },\n \"podCidr\": \"10.244.0.0/16\",\n \"serviceCidr\": + \"10.0.0.0/16\",\n \"dnsServiceIP\": \"10.0.0.10\",\n \"dockerBridgeCidr\": + \"172.17.0.1/16\",\n \"outboundType\": \"loadBalancer\"\n },\n \"maxAgentPools\": + 100,\n \"disableLocalAccounts\": false\n },\n \"identity\": {\n \"type\": + \"SystemAssigned\",\n \"principalId\":\"00000000-0000-0000-0000-000000000001\",\n + \ \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\n },\n \"sku\": + {\n \"name\": \"Basic\",\n \"tier\": \"Free\"\n }\n }" + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + cache-control: + - no-cache + content-length: + - '2692' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:14:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-ratelimit-remaining-subscription-writes: + - '1195' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:14:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:15:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:15:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:16:14 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:16:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:17:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"InProgress\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '126' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:17:44 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/operations/fb514742-4fde-480a-ae89-d8ce3761b9f2?api-version=2016-03-30 + response: + body: + string: "{\n \"name\": \"424751fb-de4f-0a48-ae89-d8ce3761b9f2\",\n \"status\": + \"Succeeded\",\n \"startTime\": \"2021-07-22T19:14:14.7633333Z\",\n \"endTime\": + \"2021-07-22T19:17:46.0331743Z\"\n }" + headers: + cache-control: + - no-cache + content-length: + - '170' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:18:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - aks create + Connection: + - keep-alive + ParameterSetName: + - --resource-group --name --generate-ssh-keys --http-proxy-config -o + User-Agent: + - AZURECLI/2.26.1 azsdk-python-azure-mgmt-containerservice/16.0.0 Python/3.8.10 + (Linux-5.4.0-1051-azure-x86_64-with-glibc2.27) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2021-05-01 + response: + body: + string: "{\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002\",\n + \ \"location\": \"westus2\",\n \"name\": \"cliakstest000002\",\n \"type\": + \"Microsoft.ContainerService/ManagedClusters\",\n \"properties\": {\n \"provisioningState\": + \"Succeeded\",\n \"powerState\": {\n \"code\": \"Running\"\n },\n \"kubernetesVersion\": + \"1.19.11\",\n \"dnsPrefix\": \"cliakstest-clitestbqkgxci4l-79a739\",\n + \ \"fqdn\": \"cliakstest-clitestbqkgxci4l-79a739-4e07d4ec.hcp.westus2.azmk8s.io\",\n + \ \"azurePortalFQDN\": \"cliakstest-clitestbqkgxci4l-79a739-4e07d4ec.portal.hcp.westus2.azmk8s.io\",\n + \ \"agentPoolProfiles\": [\n {\n \"name\": \"nodepool1\",\n \"count\": + 3,\n \"vmSize\": \"Standard_DS2_v2\",\n \"osDiskSizeGB\": 128,\n \"osDiskType\": + \"Managed\",\n \"kubeletDiskType\": \"OS\",\n \"maxPods\": 110,\n + \ \"type\": \"VirtualMachineScaleSets\",\n \"provisioningState\": \"Succeeded\",\n + \ \"powerState\": {\n \"code\": \"Running\"\n },\n \"orchestratorVersion\": + \"1.19.11\",\n \"enableNodePublicIP\": false,\n \"nodeLabels\": {},\n + \ \"mode\": \"System\",\n \"enableEncryptionAtHost\": false,\n \"enableUltraSSD\": + false,\n \"osType\": \"Linux\",\n \"osSKU\": \"Ubuntu\",\n \"nodeImageVersion\": + \"AKSUbuntu-1804gen2containerd-2021.07.03\",\n \"enableFIPS\": false\n + \ }\n ],\n \"linuxProfile\": {\n \"adminUsername\": \"azureuser\",\n + \ \"ssh\": {\n \"publicKeys\": [\n {\n \"keyData\": \"ssh-rsa + AAAAB3NzaC1yc2EAAAADAQABAAABAQDTvSGQzrsV75ga46AU3nXIbkZjijQ2DBT+lyixTM0ZTXzqYveVVBReV0N5+zO4IkJN6sDAEb+9tUvlFJSjjBhxoMHtBj3jUi8FrDchfJE65tO3+lXFGwJeZuaGZTp2VGm7utXofIxlaOFfSRWwpe5xsOZlLi2QoMPGrbvKasaBez8Qv4PLXOUXu4YXYH4sDx+37UXCvNuOWg9fRZAZIat7vffUeWvYr9g5dV/6yhWB9IwRzBv2kvT1urubaXdAgyohDtywnMQGhZDerk9KFT+voUSAaOafjYnLGjajS6zKYIs/QfIHxnslgevmCMOBex2r+qm39FKNSw/F9Nggl2Zn\"\n + \ }\n ]\n }\n },\n \"servicePrincipalProfile\": {\n \"clientId\":\"00000000-0000-0000-0000-000000000001\"\n + \ },\n \"nodeResourceGroup\": \"MC_clitest000001_cliakstest000002_westus2\",\n + \ \"enableRBAC\": true,\n \"enablePodSecurityPolicy\": false,\n \"networkProfile\": + {\n \"networkPlugin\": \"kubenet\",\n \"loadBalancerSku\": \"Standard\",\n + \ \"loadBalancerProfile\": {\n \"managedOutboundIPs\": {\n \"count\": + 1\n },\n \"effectiveOutboundIPs\": [\n {\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MC_clitest000001_cliakstest000002_westus2/providers/Microsoft.Network/publicIPAddresses/720193ef-9d38-4ae0-ac13-b48d244a29db\"\n + \ }\n ]\n },\n \"podCidr\": \"10.244.0.0/16\",\n \"serviceCidr\": + \"10.0.0.0/16\",\n \"dnsServiceIP\": \"10.0.0.10\",\n \"dockerBridgeCidr\": + \"172.17.0.1/16\",\n \"outboundType\": \"loadBalancer\"\n },\n \"maxAgentPools\": + 100,\n \"identityProfile\": {\n \"kubeletidentity\": {\n \"resourceId\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/MC_clitest000001_cliakstest000002_westus2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cliakstest000002-agentpool\",\n + \ \"clientId\":\"00000000-0000-0000-0000-000000000001\",\n \"objectId\":\"00000000-0000-0000-0000-000000000001\"\n + \ }\n },\n \"disableLocalAccounts\": false\n },\n \"identity\": {\n + \ \"type\": \"SystemAssigned\",\n \"principalId\":\"00000000-0000-0000-0000-000000000001\",\n + \ \"tenantId\": \"72f988bf-86f1-41af-91ab-2d7cd011db47\"\n },\n \"sku\": + {\n \"name\": \"Basic\",\n \"tier\": \"Free\"\n }\n }" + headers: + cache-control: + - no-cache + content-length: + - '3355' + content-type: + - application/json + date: + - Thu, 22 Jul 2021 19:18:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - nginx + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py b/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py index 6e47f910862..9db814e39aa 100644 --- a/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py +++ b/src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py @@ -1468,6 +1468,23 @@ def test_aks_create_with_node_config(self, resource_group, resource_group_locati self.check('linuxOsConfig.sysctls.netCoreSomaxconn', 163849) ]) + @AllowLargeResponse() + @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2') + def test_aks_create_with_http_proxy_config(self, resource_group, resource_group_location): + aks_name = self.create_random_name('cliakstest', 16) + self.kwargs.update({ + 'resource_group': resource_group, + 'name': aks_name, + 'http_proxy_path': _get_test_data_file('httpproxyconfig.json') + }) + + # use custom feature so it does not require subscription to regiter the feature + create_cmd = 'aks create --resource-group={resource_group} --name={name} --generate-ssh-keys --http-proxy-config={http_proxy_path} -o json' + self.cmd(create_cmd, checks=[ + self.check('provisioningState', 'Succeeded'), + self.check('httpProxyConfig', None), + ]) + @AllowLargeResponse() @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2') def test_aks_create_none_private_dns_zone(self, resource_group, resource_group_location):