Commit 095f4ef6 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #40967 from pwittrock/discovery-client

Automatic merge from submit-queue (batch tested with PRs 40943, 40967) Switch kubectl version and api-versions to create a discovery client … …directly. The clientset will throw an error for aggregated apiservers because the clientset looks for specific versions of apis that are compiled into the client. These will be missing from aggregated apiservers. The discoveryclient is fully dynamic and does not rely on compiled in apiversions. ```release-note NONE ```
parents b87adb21 9abd2756
...@@ -56,12 +56,12 @@ func RunApiVersions(f cmdutil.Factory, w io.Writer) error { ...@@ -56,12 +56,12 @@ func RunApiVersions(f cmdutil.Factory, w io.Writer) error {
printDeprecationWarning("api-versions", "apiversions") printDeprecationWarning("api-versions", "apiversions")
} }
clientset, err := f.ClientSet() discoveryclient, err := f.DiscoveryClient()
if err != nil { if err != nil {
return err return err
} }
groupList, err := clientset.Discovery().ServerGroups() groupList, err := discoveryclient.ServerGroups()
if err != nil { if err != nil {
return fmt.Errorf("Couldn't get available api versions from server: %v\n", err) return fmt.Errorf("Couldn't get available api versions from server: %v\n", err)
} }
......
...@@ -61,12 +61,12 @@ func RunVersion(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error { ...@@ -61,12 +61,12 @@ func RunVersion(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
return nil return nil
} }
clientset, err := f.ClientSet() discoveryclient, err := f.DiscoveryClient()
if err != nil { if err != nil {
return err return err
} }
serverVersion, err := clientset.Discovery().ServerVersion() serverVersion, err := discoveryclient.ServerVersion()
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment