discoverymapper

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

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)
}

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