// IsResourceEnabled queries the server to determine if the resource specified is present on the server. // This is particularly helpful when writing a controller or an e2e test that requires a particular resource to function. func IsResourceEnabled(client DiscoveryInterface, resourceToCheck schema.GroupVersionResource) (bool, error) { … } // MatchesServerVersion queries the server to compares the build version // (git hash) of the client with the server's build version. It returns an error // if it failed to contact the server or if the versions are not an exact match. func MatchesServerVersion(clientVersion apimachineryversion.Info, client DiscoveryInterface) error { … } // ServerSupportsVersion returns an error if the server doesn't have the required version func ServerSupportsVersion(client DiscoveryInterface, requiredGV schema.GroupVersion) error { … } // GroupVersionResources converts APIResourceLists to the GroupVersionResources. func GroupVersionResources(rls []*metav1.APIResourceList) (map[schema.GroupVersionResource]struct{ … } // FilteredBy filters by the given predicate. Empty APIResourceLists are dropped. func FilteredBy(pred ResourcePredicate, rls []*metav1.APIResourceList) []*metav1.APIResourceList { … } type ResourcePredicate … type ResourcePredicateFunc … // Match is a wrapper around ResourcePredicateFunc. func (fn ResourcePredicateFunc) Match(groupVersion string, r *metav1.APIResource) bool { … } type SupportsAllVerbs … // Match checks if a resource contains all the given verbs. func (p SupportsAllVerbs) Match(groupVersion string, r *metav1.APIResource) bool { … }