discoverymapper

package
v1.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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

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

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.

func New

func New(c *rest.Config) (DiscoveryMapper, error)

New will create a new DefaultDiscoveryMapper by giving a K8s rest config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL