Merge pull request #59042 from soltysh/issue25442

Automatic merge from submit-queue (batch tested with PRs 60302, 57921, 59042, 60126, 59561). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove pkg/client/unversioned

**What this PR does / why we need it**:
This is removing unused package, and moves the used bits into appropriate placeholders. 

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #25442

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```

/assign @deads2k 
/assign @sttts
This commit is contained in:
Kubernetes Submit Queue
2018-02-23 14:01:44 -08:00
committed by GitHub
18 changed files with 33 additions and 639 deletions

View File

@@ -24,8 +24,8 @@ import (
"k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
oldclient "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/version"
)
@@ -150,7 +150,7 @@ func (c *ClientCache) clientConfigForVersion(requiredVersion *schema.GroupVersio
}
// TODO this isn't what we want. Each clientset should be setting defaults as it sees fit.
oldclient.SetKubernetesDefaults(&config)
setKubernetesDefaults(&config)
if requiredVersion != nil {
c.configs[*requiredVersion] = copyConfig(&config)
@@ -165,6 +165,22 @@ func (c *ClientCache) clientConfigForVersion(requiredVersion *schema.GroupVersio
return copyConfig(&config), nil
}
// 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.
func setKubernetesDefaults(config *restclient.Config) error {
if config.APIPath == "" {
config.APIPath = "/api"
}
// TODO chase down uses and tolerate nil
if config.GroupVersion == nil {
config.GroupVersion = &schema.GroupVersion{}
}
if config.NegotiatedSerializer == nil {
config.NegotiatedSerializer = legacyscheme.Codecs
}
return restclient.SetKubernetesDefaults(config)
}
func copyConfig(in *restclient.Config) *restclient.Config {
configCopy := *in
copyGroupVersion := *configCopy.GroupVersion