mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
chore: remove unused discovery method GetServerVersion (#6577)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
parent
a7bebc20c1
commit
4bd2e42b96
2 changed files with 0 additions and 12 deletions
|
@ -12,7 +12,6 @@ import (
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/version"
|
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ type IDiscovery interface {
|
||||||
// TODO: there's no mapping from GVK to GVR, this is very error prone
|
// TODO: there's no mapping from GVK to GVR, this is very error prone
|
||||||
GetGVRFromGVK(schema.GroupVersionKind) (schema.GroupVersionResource, error)
|
GetGVRFromGVK(schema.GroupVersionKind) (schema.GroupVersionResource, error)
|
||||||
GetGVKFromGVR(schema.GroupVersionResource) (schema.GroupVersionKind, error)
|
GetGVKFromGVR(schema.GroupVersionResource) (schema.GroupVersionKind, error)
|
||||||
GetServerVersion() (*version.Info, error)
|
|
||||||
OpenAPISchema() (*openapiv2.Document, error)
|
OpenAPISchema() (*openapiv2.Document, error)
|
||||||
DiscoveryCache() discovery.CachedDiscoveryInterface
|
DiscoveryCache() discovery.CachedDiscoveryInterface
|
||||||
DiscoveryInterface() discovery.DiscoveryInterface
|
DiscoveryInterface() discovery.DiscoveryInterface
|
||||||
|
@ -103,11 +101,6 @@ func (c serverResources) GetGVRFromGVK(gvk schema.GroupVersionKind) (schema.Grou
|
||||||
return gvr, nil
|
return gvr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetServerVersion returns the server version of the cluster
|
|
||||||
func (c serverResources) GetServerVersion() (*version.Info, error) {
|
|
||||||
return c.cachedClient.ServerVersion()
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetGVKFromGVR returns the Group Version Kind from Group Version Resource. The groupVersion has to be specified properly
|
// GetGVKFromGVR returns the Group Version Kind from Group Version Resource. The groupVersion has to be specified properly
|
||||||
// for example, for corev1.Pod, the groupVersion has to be specified as `v1`, specifying empty groupVersion won't work.
|
// for example, for corev1.Pod, the groupVersion has to be specified as `v1`, specifying empty groupVersion won't work.
|
||||||
func (c serverResources) GetGVKFromGVR(gvr schema.GroupVersionResource) (schema.GroupVersionKind, error) {
|
func (c serverResources) GetGVKFromGVR(gvr schema.GroupVersionResource) (schema.GroupVersionKind, error) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ 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/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/version"
|
|
||||||
"k8s.io/client-go/discovery"
|
"k8s.io/client-go/discovery"
|
||||||
"k8s.io/client-go/dynamic/fake"
|
"k8s.io/client-go/dynamic/fake"
|
||||||
kubefake "k8s.io/client-go/kubernetes/fake"
|
kubefake "k8s.io/client-go/kubernetes/fake"
|
||||||
|
@ -69,10 +68,6 @@ func (c *fakeDiscoveryClient) getGVR(resource string) (schema.GroupVersionResour
|
||||||
return schema.GroupVersionResource{}, errors.New("no found")
|
return schema.GroupVersionResource{}, errors.New("no found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *fakeDiscoveryClient) GetServerVersion() (*version.Info, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *fakeDiscoveryClient) GetGVKFromGVR(schema.GroupVersionResource) (schema.GroupVersionKind, error) {
|
func (c *fakeDiscoveryClient) GetGVKFromGVR(schema.GroupVersionResource) (schema.GroupVersionKind, error) {
|
||||||
return schema.GroupVersionKind{}, nil
|
return schema.GroupVersionKind{}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue