Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of ContainerServiceManagedCluster failed because the SDK client replaces the api-version in LRO #2571

Closed
fengzhou-msft opened this issue Aug 12, 2022 · 8 comments · Fixed by #2725 or Azure/azure-sdk-for-net#30671

Comments

@fengzhou-msft
Copy link
Member

fengzhou-msft commented Aug 12, 2022

With this PR: #1841 (required by Azure/azure-sdk#3817), the SDK client replaces the api-version for nextRequestUri even if service returns the api-version in it.

This caused a failure when creating the ContainerServiceManagedClusterResource: The resource type 'locations/operations' could not be found in the namespace 'Microsoft.ContainerService' for api version '2022-04-01'. The supported api-versions are '2016-03-30,2017-08-31'.

The nextRequestUri returned from service looks like this: https://management.azure.com/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/providers/Microsoft.ContainerService/locations/westus2/operations/6112cdd3-47cb-4b46-9d7c-7531b9fe64b5?api-version=2016-03-30

There's a similar issue in JS SDK: Azure/azure-sdk-for-js#22522

@m-nash
Copy link
Member

m-nash commented Aug 16, 2022

Lets first discover where those versions are coming from. Is there a model that is defined in those versions that is returned as the interim status payload for the LRO? If so I would like to discover how we can represent that as this would affect the rehydration case as well.

@jallirs
Copy link

jallirs commented Aug 17, 2022

Hitting the same issue. Exact same error. In my case, I'm passing in location using:
static readonly AzureLocation s_resourceRegion = new AzureLocation("southcentralus");,

Setting up a bunch of managed cluster parameters into this data instance:
var cluster = resourceGroup.GetManagedClusters(); ManagedClusterData data = new ManagedClusterData(s_resourceRegion);
and then doing:

await cluster.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, data);

.
Nothing special AFAICT. My package list.
image

@jallirs
Copy link

jallirs commented Aug 17, 2022

2022-08-17T00:34:24.8494453Z Request failed! The resource type 'locations/operations' could not be found in the namespace 'Microsoft.ContainerService' for api version '2022-04-01'. The supported api-versions are '2016-03-30,2017-08-31'.
2022-08-17T00:34:24.8495746Z Status: 404 (Not Found)
2022-08-17T00:34:24.8496610Z ErrorCode: InvalidResourceType
2022-08-17T00:34:24.8496922Z
2022-08-17T00:34:24.8497408Z Content:
2022-08-17T00:34:24.8504594Z {"error":{"code":"InvalidResourceType","message":"The resource type 'locations/operations' could not be found in the namespace 'Microsoft.ContainerService' for api version '2022-04-01'. The supported api-versions are '2016-03-30,2017-08-31'."}}
2022-08-17T00:34:24.8505157Z
2022-08-17T00:34:24.8505468Z Headers:
2022-08-17T00:34:24.8505928Z Cache-Control: no-cache
2022-08-17T00:34:24.8506394Z Pragma: no-cache
2022-08-17T00:34:24.8506898Z x-ms-failure-cause: REDACTED
2022-08-17T00:34:24.8507490Z x-ms-request-id: ba37c5ed-4fea-49a9-941b-11d86691e99f
2022-08-17T00:34:24.8508048Z x-ms-correlation-request-id: REDACTED
2022-08-17T00:34:24.8508580Z x-ms-routing-request-id: REDACTED
2022-08-17T00:34:24.8509110Z Strict-Transport-Security: REDACTED
2022-08-17T00:34:24.8509635Z X-Content-Type-Options: REDACTED
2022-08-17T00:34:24.8510058Z Date: Wed, 17 Aug 2022 00:34:24 GMT
2022-08-17T00:34:24.8510609Z Content-Type: application/json; charset=utf-8
2022-08-17T00:34:24.8511094Z Expires: -1
2022-08-17T00:34:24.8511554Z Content-Length: 244
2022-08-17T00:34:24.8512013Z at Azure.Core.OperationInternal1.GetResponseFromState(OperationState1 state)
2022-08-17T00:34:24.8512597Z at Azure.Core.OperationInternal1.UpdateStatusAsync(Boolean async, CancellationToken cancellationToken) 2022-08-17T00:34:24.8513217Z at Azure.Core.OperationInternalBase.UpdateStatusAsync(CancellationToken cancellationToken) 2022-08-17T00:34:24.8513945Z at Azure.Core.OperationPoller.WaitForCompletionAsync(Boolean async, OperationInternalBase operation, Nullable1 suggestedInterval, CancellationToken cancellationToken)
2022-08-17T00:34:24.8514800Z at Azure.Core.OperationInternalBase.WaitForCompletionResponseAsync(Boolean async, Nullable1 pollingInterval, String scopeName, CancellationToken cancellationToken) 2022-08-17T00:34:24.8515597Z at Azure.Core.OperationInternal1.WaitForCompletionAsync(Boolean async, Nullable1 pollingInterval, CancellationToken cancellationToken) 2022-08-17T00:34:24.8516275Z at Azure.Core.OperationInternal1.WaitForCompletionAsync(CancellationToken cancellationToken)
2022-08-17T00:34:24.8517053Z at Azure.ResourceManager.ContainerService.ManagedClusterCollection.CreateOrUpdateAsync(WaitUntil waitUntil, String resourceName, ManagedClusterData data, CancellationToken cancellationToken)

@fengzhou-msft
Copy link
Member Author

Service Team wants to work on a fix with no ETA: Azure/azure-sdk-for-js#22423 (comment)

The Microsoft.ContainerService/locations/operations API is not defined in swagger and its supported version is set in ARM manifest. The error is thrown by ARM.

@jallirs
Copy link

jallirs commented Aug 19, 2022

I'm using the dotnet sdk. Is there a workaround I can use?
For reference:
I tried overriding some of the classes/methods, but I'm running into protection violations because the classes are marked "internal" with the relevant properties _apiversion of the properties marked "private".

How is this working in the JS SDK? Are they simply not passing the api version?

@fengzhou-msft
Copy link
Member Author

@jallirs
Copy link

jallirs commented Aug 22, 2022

Tried the above workaround, it works :). Thanks everyone!

@fengzhou-msft
Copy link
Member Author

Issue fixed and the custom policy is no longer needed with Azure.ResourceManager.ContainerService 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants