1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-30 03:15:05 +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:
Charles-Edouard Brétéché 2023-03-15 12:36:44 +01:00 committed by GitHub
parent a7bebc20c1
commit 4bd2e42b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 12 deletions

View file

@ -12,7 +12,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/version"
"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
GetGVRFromGVK(schema.GroupVersionKind) (schema.GroupVersionResource, error)
GetGVKFromGVR(schema.GroupVersionResource) (schema.GroupVersionKind, error)
GetServerVersion() (*version.Info, error)
OpenAPISchema() (*openapiv2.Document, error)
DiscoveryCache() discovery.CachedDiscoveryInterface
DiscoveryInterface() discovery.DiscoveryInterface
@ -103,11 +101,6 @@ func (c serverResources) GetGVRFromGVK(gvk schema.GroupVersionKind) (schema.Grou
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
// 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) {

View file

@ -9,7 +9,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/version"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic/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")
}
func (c *fakeDiscoveryClient) GetServerVersion() (*version.Info, error) {
return nil, nil
}
func (c *fakeDiscoveryClient) GetGVKFromGVR(schema.GroupVersionResource) (schema.GroupVersionKind, error) {
return schema.GroupVersionKind{}, nil
}