azure-sdk-for-go icon indicating copy to clipboard operation
azure-sdk-for-go copied to clipboard

armcontainerservice/managedclusters - Get-Version function / method for AKS is missing

Open AdamRussak opened this issue 3 years ago • 17 comments
trafficstars

Bug Report

currently, there is no Function to receive the available AKS versions, a command that is available in a simple CLI command. az aks get-versions --location eastus --output table

i would expect to see a command (or set of them) that supports commands that are available in the CLI: https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli

this is not a feature nor a bug, but it's closer to a bug than a feature as it is something already supported by API and other Azure tools.

AdamRussak avatar Sep 24 '22 17:09 AdamRussak

Hi @AdamRussak. Thank you for your feedback and we will look into it soon. Meanwhile, feel free to share your experience using the Azure SDK in this survey.

ghost avatar Sep 24 '22 17:09 ghost

I believe this is the API you want.

https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2#ManagedClustersClient.Get

Part of the returned model is ManagedClusterProperties which has field KubernetesVersion

jhendrixMSFT avatar Sep 26 '22 15:09 jhendrixMSFT

Hi @AdamRussak. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

ghost avatar Sep 26 '22 15:09 ghost

/unresolve

I believe this is the API you want.

https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v2#ManagedClustersClient.Get

Part of the returned model is ManagedClusterProperties which has field KubernetesVersion

in this API you get the versions relative to your cluster's current version. here is an example: the output of the cluster that has version 1.22.4:

#next Versions
debug 1.22.6 1.22.11 1.23.5 1.23.8: 
#cluster Version
debug current Version is: 1.22.4

the output of the cluster that has version 1.22.6:

#next versions
debug 1.22.11 1.23.5 1.23.8: 
#cluster version
debug current Version is: 1.22.6

what I expect to receive is the versions that are supported (as if there is no version installed at the moment) the same output you would get from: az aks get-versions --location eastus --output table wich is not relative to any cluster, but a list of supported Versions.

AdamRussak avatar Sep 26 '22 16:09 AdamRussak

my code that was used to exctract the output i used above:

client, err := armcontainerservice.NewManagedClustersClient(subscription.Id, auth(id), nil)
	core.OnErrorFail(err, "failed to create client")
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		core.OnErrorFail(err, "failed to advance page")
		for _, v := range nextResult.Value {
			supportedAKS := findSupportedAksVersions(SplitAzIDAndGiveItem(*v.ID, "/", 4), *v.Name, subscription.Id, id)
			l := getAksConfig(supportedAKS)
			log.Debug("current Version is: " + *v.Properties.KubernetesVersion)
			r = append(r, Cluster{*v.Name, *v.Properties.KubernetesVersion, l, *v.Location, *v.ID, "", microsoftSupportedVersion(l, *v.Properties.KubernetesVersion)})
		}
	}

AdamRussak avatar Sep 26 '22 16:09 AdamRussak

Hi @AdamRussak I use the --debug flag to see which request the azure cli command line is sending while processing your argument (you could also have a try, just append --debug to your command line) It is using this API: https://github.com/Azure/azure-rest-api-specs/blob/41caa3033eefe466ee5254431ff586968f7e6841/specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-08-01/location.json#L37 And this API is not included in the our SDK. We will follow up with the container service team to include this API in the next version cc @lirenhe and @Alancere for awareness

ArcturusZhang avatar Oct 03 '22 03:10 ArcturusZhang

Hi @ArcturusZhang, first I appreciate you taking it forward! second, as I wrote in my ticket, it's not a bug or feature, but I opened the ticket because the API call was missing for the GO SDK. and again! thank you ! :)

AdamRussak avatar Oct 03 '22 06:10 AdamRussak

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Oct 10 '22 06:10 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @qike-ms, @jwilder, @thomas1206, @seanmck.

Issue Details

Bug Report

currently, there is no Function to receive the available AKS versions, a command that is available in a simple CLI command. az aks get-versions --location eastus --output table

i would expect to see a command (or set of them) that supports commands that are available in the CLI: https://learn.microsoft.com/en-us/azure/aks/supported-kubernetes-versions?tabs=azure-cli

this is not a feature nor a bug, but it's closer to a bug than a feature as it is something already supported by API and other Azure tools.

Author: AdamRussak
Assignees: Alancere
Labels:

question, Service Attention, Mgmt, customer-reported, needs-team-attention, Container Service

Milestone: -

ghost avatar Oct 11 '22 02:10 ghost

Adding service team to look into this.

@qike-ms, @jwilder, @thomas1206, @seanmck Could you please look into this once you get a chance ? Thanks in advance.

navba-MSFT avatar Oct 11 '22 02:10 navba-MSFT

hi, any update? or expected timeline?

AdamRussak avatar Nov 09 '22 21:11 AdamRussak

Is there a timeline when we can expect this to be available in Go Sdk?. Thank you

priyamshet avatar Feb 23 '23 01:02 priyamshet

@tadelesh, could you help to check?

lirenhe avatar Feb 23 '23 09:02 lirenhe

cc @Azure/aks-pm, @palma21

FumingZhang avatar Feb 28 '23 09:02 FumingZhang

my code that was used to exctract the output i used above:

client, err := armcontainerservice.NewManagedClustersClient(subscription.Id, auth(id), nil)
	core.OnErrorFail(err, "failed to create client")
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		core.OnErrorFail(err, "failed to advance page")
		for _, v := range nextResult.Value {
			supportedAKS := findSupportedAksVersions(SplitAzIDAndGiveItem(*v.ID, "/", 4), *v.Name, subscription.Id, id)
			l := getAksConfig(supportedAKS)
			log.Debug("current Version is: " + *v.Properties.KubernetesVersion)
			r = append(r, Cluster{*v.Name, *v.Properties.KubernetesVersion, l, *v.Location, *v.ID, "", microsoftSupportedVersion(l, *v.Properties.KubernetesVersion)})
		}
	}
{"error":{"code":"AuthorizationFailed","message":"The client '73e3d34d-ed62-4182-88e3-58fbf4734ddf' with object id '73e3d34d-ed62-4182-88e3-58fbf4734ddf' does not have authorization to perform action 'Microsoft.ContainerService/managedClusters/read' over scope '/subscriptions/f3c1e2e2-6a29-4071-b344-f14e93c36082' or the scope is invalid. If access was recently granted, please refresh your credentials."}}```
how to resolve this bro.i`ve added all I can do,

mingmingshiliyu avatar Sep 16 '23 16:09 mingmingshiliyu

Any updates on this ?

mjnovice avatar Feb 28 '24 21:02 mjnovice

There's a new API could be used to get/list supported k8s versions. The corresponding operation is ListKubernetesVersions in ManagedClustersClient.

BTW, the old API ListOrchestrators has been deprecated since API version stable/2024-01-01, preview/2024-01-02-preview.

FumingZhang avatar Feb 29 '24 07:02 FumingZhang