mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Create client from API version passed in config or use default
When creating a client read the GroupVersion value passed in the restclient.Config. If the passed GroupVersion does not match current group or is not enabled fallback to default GroupVersion for that group.
This commit is contained in:
@@ -76,12 +76,12 @@ func (c *ClientCache) ClientConfigForVersion(version *unversioned.GroupVersion)
|
||||
preferredGV = &versionCopy
|
||||
}
|
||||
|
||||
client.SetKubernetesDefaults(&config)
|
||||
negotiatedVersion, err := client.NegotiateVersion(c.defaultClient, &config, preferredGV, registered.EnabledVersions())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.GroupVersion = negotiatedVersion
|
||||
client.SetKubernetesDefaults(&config)
|
||||
|
||||
if version != nil {
|
||||
c.configs[*version] = &config
|
||||
|
||||
Reference in New Issue
Block a user