@@ -117,7 +117,7 @@ Documentation for other releases can be found at
...
@@ -117,7 +117,7 @@ Documentation for other releases can be found at
1. clients:
1. clients:
Currently we have structured (pkg/client/unversioned#ExperimentalClient, pkg/client/unversioned#Client) and unstructured (pkg/kubectl/resource#Helper) clients. The structured clients are not scalable because each of them implements specific interface, e.g., [here](../../pkg/client/unversioned/client.go#L32). Only the unstructured clients are scalable. We should either auto-generate the code for structured clients or migrate to use the unstructured clients as much as possible.
Currently we have structured (pkg/client/unversioned#ExperimentalClient, pkg/client/unversioned#Client) and unstructured (pkg/kubectl/resource#Helper) clients. The structured clients are not scalable because each of them implements specific interface, e.g., `[here]../../pkg/client/unversioned/client.go#L32`--fixed. Only the unstructured clients are scalable. We should either auto-generate the code for structured clients or migrate to use the unstructured clients as much as possible.
We should also move the unstructured client to pkg/client/.
We should also move the unstructured client to pkg/client/.
returnnil,fmt.Errorf("server does not support API version %q",preferredGV)
}
}
for_,clientGV:=rangeclientRegisteredGVs{
ifserverVersions.Has(clientGV.String()){
// Version was not explicitly requested in command config (--api-version).
// Ok to fall back to a supported version with a warning.
// TODO: caesarxuchao: enable the warning message when we have
// proper fix. Please refer to issue #14895.
// if len(version) != 0 {
// glog.Warningf("Server does not support API version '%s'. Falling back to '%s'.", version, clientVersion)
// }
t:=clientGV
return&t,nil
}
}
returnnil,fmt.Errorf("failed to negotiate an api version; server supports: %v, client supports: %v",
serverVersions,clientVersions)
}
// NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.
funcNewOrDie(c*restclient.Config)*Client{
client,err:=New(c)
iferr!=nil{
panic(err)
}
returnclient
}
// NewInCluster is a shortcut for calling InClusterConfig() and then New().
funcNewInCluster()(*Client,error){
cc,err:=restclient.InClusterConfig()
iferr!=nil{
returnnil,err
}
returnNew(cc)
}
// SetKubernetesDefaults sets default values on the provided client config for accessing the
// SetKubernetesDefaults sets default values on the provided client config for accessing the
// Kubernetes API or returns an error if any of the defaults are impossible or invalid.
// Kubernetes API or returns an error if any of the defaults are impossible or invalid.
// TODO: this method needs to be split into one that sets defaults per group, expected to be fix in PR "Refactoring clientcache.go and helper.go #14592"
// TODO: this method needs to be split into one that sets defaults per group, expected to be fix in PR "Refactoring clientcache.go and helper.go #14592"