Azure-sdk-for-python: Node pool name convention

Created on 27 Feb 2019  路  5Comments  路  Source: Azure/azure-sdk-for-python

Hi, I try creating AKS cluster with azure.mgmt.containerservice.models.
I found hyphen ("-") was not allow for agent pool name.

$ python -V
Python 3.6.1
$ pip -V
pip 19.0.3 from /home/yuri/.anyenv/envs/pyenv/versions/3.6.1/lib/python3.6/site-packages/pip (python 3.6)
$ pip freeze | grep mgmt.containerservice
azure-mgmt-containerservice==4.4.0
agent_pool_profile = ManagedClusterAgentPoolProfile(
    name="node-pool",
    vm_size="Standard_E2s_v3",
    count=1
)

Debug log:

$ python createaks.py
DEBUG:cli.azure.cli.core:Current cloud config:
AzureCloud
DEBUG:cli.azure.cli.core:Current cloud config:
AzureCloud
DEBUG:msrest.universal_http.requests:Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
DEBUG:cli.azure.cli.core.util:attempting to read file /home/yuri/.azure/accessTokens.json as utf-8-sig
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - Authority:Performing instance discovery: ...
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - Authority:Performing static instance discovery
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - Authority:Authority validated via static instance discovery
INFO:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - TokenRequest:Getting token from cache with refresh if necessary.
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:finding with query keys: {'_clientId': '...', 'userId': '...'}
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Looking for potential cache entries: {'_clientId': '...', 'userId': '...'}
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Found 4 potential entries.
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Resource specific token found.
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Returning token from cache lookup, AccessTokenId: b'ApaS8CnhLheDyqOanivCOq95UvQIredtqnr2SMH61vI=', RefreshTokenId: b'UNPKAZuOLOJWFlRW7BYmQSYHMnOQtZDJ63U76OJsOWE='
INFO:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Cached token is expired at 2019-02-27 00:33:17.144335.  Refreshing
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - TokenRequest:called to refresh a token from the cache
INFO:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - TokenRequest:Getting a new token from a refresh token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): login.microsoftonline.com:443
DEBUG:urllib3.connectionpool:https://login.microsoftonline.com:443 "POST /72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/token HTTP/1.1" 200 3185
INFO:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - OAuth2Client:Get Token Server returned this correlation_id: 184d6f08-f8ec-469c-bee5-399f6b70b583
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Created new cache entry from refresh response.
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Removing entry.
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Adding entry AccessTokenId: b'091C1k9Wb3kz16YDHmEATAlxrOYS4mNv+FCet+vVkos=', RefreshTokenId: b'yXxIqKXtJDur7KEHHqU8R3osj88zTE4yU25HEYc48ro='
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Updating 3 cached refresh tokens
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Remove many: 3
DEBUG:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Add many: 3
INFO:adal-python:184d6f08-f8ec-469c-bee5-399f6b70b583 - CacheDriver:Returning token refreshed after expiry.
DEBUG:msrest.universal_http:Configuring redirects: allow=True, max=30
DEBUG:msrest.universal_http:Configuring request: timeout=100, verify=True, cert=None
DEBUG:msrest.universal_http:Configuring proxies: ''
DEBUG:msrest.universal_http:Evaluate proxies against ENV settings: True
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): management.azure.com:443
DEBUG:urllib3.connectionpool:https://management.azure.com:443 "PUT /subscriptions/93b7ca88-d2cc-4381-97ec-f99f3a702495/resourceGroups/lab119021326003980/providers/Microsoft.ContainerService/managedClusters/labaks?api-version=2018-03-31 HTTP/1.1" 400 143
DEBUG:msrest.exceptions:Operation failed with status: 'Bad Request'. Details: The value of parameter agentPoolProfile.name is invalid.
400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/93b7ca88-d2cc-4381-97ec-f99f3a702495/resourceGroups/lab119021326003980/providers/Microsoft.ContainerService/managedClusters/labaks?api-version=2018-03-31
AKS Mgmt Swagger

Most helpful comment

@lmazuel I'll make a Swagger PR after I verify what the server-side regex is.

All 5 comments

Thanks @yuriwoof for the report! Indeed the SDK should have caught the invalid name before doing the request.
@mboersma it should be a regexp check in the Swagger, do you want me to create a Swagger issue or you can do a PR real quick?
Thanks!

Thank you for checking this 馃槂

@lmazuel I'll make a Swagger PR after I verify what the server-side regex is.

Thanks update!
One more things I want to ask about pool name.

Should this name be uniqe under same subscription? I can create different (also same) name pool in different resorce group in the subscription.

But I see

"Required. Unique name of the agent pool profile in the context of the subscription and resource group."

https://docs.microsoft.com/ja-jp/python/api/azure-mgmt-containerservice/azure.mgmt.containerservice.v2018_03_31.models.managed_cluster_agent_pool_profile.managedclusteragentpoolprofile?view=azure-python#parameters

@yuriwoof the nodepool name only needs to be unique to a resource group, not subscription. You could use "nodepool1" in two different clusters under one subscription, but you couldn't have two nodepools named "nodepool1" in the same cluster.

Was this page helpful?
0 / 5 - 0 ratings