remove redundant fake discovery code

Kubernetes-commit: 38243460fa272a5503b7c1b43655d09caa65dd1c
This commit is contained in:
yue9944882 2018-02-27 17:34:08 +08:00 committed by Kubernetes Publisher
parent 484f278924
commit d89f1e4c08

View File

@ -22,10 +22,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
kubeversion "k8s.io/client-go/pkg/version"
restclient "k8s.io/client-go/rest" restclient "k8s.io/client-go/rest"
) )
@ -214,46 +211,3 @@ func (c *Fake) Actions() []Action {
copy(fa, c.actions) copy(fa, c.actions)
return fa return fa
} }
// TODO: this probably should be moved to somewhere else.
type FakeDiscovery struct {
*Fake
}
func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error) {
action := ActionImpl{
Verb: "get",
Resource: schema.GroupVersionResource{Resource: "resource"},
}
c.Invokes(action, nil)
for _, rl := range c.Resources {
if rl.GroupVersion == groupVersion {
return rl, nil
}
}
return nil, fmt.Errorf("GroupVersion %q not found", groupVersion)
}
func (c *FakeDiscovery) ServerResources() ([]*metav1.APIResourceList, error) {
action := ActionImpl{
Verb: "get",
Resource: schema.GroupVersionResource{Resource: "resource"},
}
c.Invokes(action, nil)
return c.Resources, nil
}
func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error) {
return nil, nil
}
func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
action := ActionImpl{}
action.Verb = "get"
action.Resource = schema.GroupVersionResource{Resource: "version"}
c.Invokes(action, nil)
versionInfo := kubeversion.Get()
return &versionInfo, nil
}