azure-sdk-for-go
azure-sdk-for-go copied to clipboard
armcontainerservice/managedclusters - Get-Version function / method for AKS is missing
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.
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.
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
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.
/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
ManagedClusterPropertieswhich has fieldKubernetesVersion
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.
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)})
}
}
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
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 ! :)
Thank you for your feedback. This has been routed to the support team for assistance.
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: |
|
| Milestone: | - |
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.
hi, any update? or expected timeline?
Is there a timeline when we can expect this to be available in Go Sdk?. Thank you
@tadelesh, could you help to check?
cc @Azure/aks-pm, @palma21
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,
Any updates on this ?
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.