Allow the api-version on the command to override the client builder

This commit is contained in:
Clayton Coleman
2014-12-12 17:53:33 -05:00
parent 158f322301
commit 203246b7e0
3 changed files with 70 additions and 7 deletions

View File

@@ -64,7 +64,9 @@ func NewFactory(clientBuilder clientcmd.Builder) *Factory {
}
},
Client: func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.RESTClient, error) {
return clientBuilder.Client()
return clientBuilder.Override(func(c *client.Config) {
c.Version = mapping.APIVersion
}).Client()
},
Describer: func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.Describer, error) {
client, err := clientBuilder.Client()