Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.59k stars 821 forks source link

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

Open AdamRussak opened 1 year ago

AdamRussak commented 1 year ago

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.

ghost commented 1 year ago

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.

jhendrixMSFT commented 1 year ago

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

ghost commented 1 year ago

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.

AdamRussak commented 1 year ago

/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 commented 1 year ago

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)})
        }
    }
ArcturusZhang commented 1 year ago

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

AdamRussak commented 1 year ago

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 ! :)

ghost commented 1 year ago

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

ghost commented 1 year ago

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: -
navba-MSFT commented 1 year ago

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.

AdamRussak commented 1 year ago

hi, any update? or expected timeline?

priyamshet commented 1 year ago

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

lirenhe commented 1 year ago

@tadelesh, could you help to check?

FumingZhang commented 1 year ago

cc @Azure/aks-pm, @palma21

mingmingshiliyu commented 1 year ago

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,
mjnovice commented 6 months ago

Any updates on this ?

FumingZhang commented 6 months ago

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.