Documentation ¶
Index ¶
- func IsNamespacedScope(dm DiscoveryMapper, gk schema.GroupKind) (bool, error)
- type DefaultDiscoveryMapper
- func (d *DefaultDiscoveryMapper) GetMapper() (meta.RESTMapper, error)
- func (d *DefaultDiscoveryMapper) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
- func (d *DefaultDiscoveryMapper) RESTMapping(gk schema.GroupKind, version ...string) (*meta.RESTMapping, error)
- func (d *DefaultDiscoveryMapper) Refresh() (meta.RESTMapper, error)
- func (d *DefaultDiscoveryMapper) ResourcesFor(input schema.GroupVersionKind) (schema.GroupVersionResource, error)
- type DiscoveryMapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNamespacedScope ¶ added in v1.0.5
func IsNamespacedScope(dm DiscoveryMapper, gk schema.GroupKind) (bool, error)
IsNamespacedScope discover the resources supported by API server and check whether a resource is namespaced-scope.
Types ¶
type DefaultDiscoveryMapper ¶
type DefaultDiscoveryMapper struct {
// contains filtered or unexported fields
}
DefaultDiscoveryMapper is a K8s resource mapper for discovery, it will cache the result
func (*DefaultDiscoveryMapper) GetMapper ¶
func (d *DefaultDiscoveryMapper) GetMapper() (meta.RESTMapper, error)
GetMapper will get the cached restmapper, if nil, it will create one by refresh Prefer lazy discovery, because resources created after refresh can not be found
func (*DefaultDiscoveryMapper) KindsFor ¶
func (d *DefaultDiscoveryMapper) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
KindsFor will get kinds from GroupVersionResource, if version not set, all resources matched will be returned.
func (*DefaultDiscoveryMapper) RESTMapping ¶
func (d *DefaultDiscoveryMapper) RESTMapping(gk schema.GroupKind, version ...string) (*meta.RESTMapping, error)
RESTMapping will mapping resources from GVK, if not found, it will refresh from APIServer and try once again
func (*DefaultDiscoveryMapper) Refresh ¶
func (d *DefaultDiscoveryMapper) Refresh() (meta.RESTMapper, error)
Refresh will re-create the mapper by getting the new resource from K8s API by using discovery client
func (*DefaultDiscoveryMapper) ResourcesFor ¶ added in v1.0.0
func (d *DefaultDiscoveryMapper) ResourcesFor(input schema.GroupVersionKind) (schema.GroupVersionResource, error)
ResourcesFor will get a resource from GroupVersionKind
type DiscoveryMapper ¶
type DiscoveryMapper interface { GetMapper() (meta.RESTMapper, error) Refresh() (meta.RESTMapper, error) RESTMapping(gk schema.GroupKind, version ...string) (*meta.RESTMapping, error) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error) ResourcesFor(input schema.GroupVersionKind) (schema.GroupVersionResource, error) }
DiscoveryMapper is a interface for refresh and discovery resources from GVK.