crdClient

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fake bool
View Source
var Registry = make(map[string]RegistryType)

Functions

func AddToRegistry

func AddToRegistry(api string, singular, plural runtime.Object, keyer KeyerFunc, resource schema.GroupResource)

func NewFakeCustomInformer

func NewFakeCustomInformer(handlers cache.ResourceEventHandlerFuncs,
	keyer KeyerFunc,
	groupResource schema.GroupResource) (cache.Store, chan struct{})

NewFakeCustomInformer creates a new FakeCustomInformer, registers the callbacks and start the watching routine that implements the caching functionality and the callbak notifications

func NewKubeconfig

func NewKubeconfig(configPath string, gv *schema.GroupVersion, configOptions func(config *rest.Config)) (*rest.Config, error)

func NewKubeconfigFromSecret

func NewKubeconfigFromSecret(secret *v1.Secret, gv *schema.GroupVersion) (*rest.Config, error)

func WatchRealResources

func WatchRealResources(clientSet NamespacedCRDClientInterface,
	resource, namespace string,
	resyncPeriod time.Duration,
	handlers cache.ResourceEventHandlerFuncs,
	lo metav1.ListOptions) (cache.Store, chan struct{}, error)

Watch RealResources creates

func WatchResources

func WatchResources(clientSet NamespacedCRDClientInterface,
	resource, namespace string,
	resyncPeriod time.Duration,
	handlers cache.ResourceEventHandlerFuncs,
	lo metav1.ListOptions) (cache.Store, chan struct{}, error)

WatchResources is a wrapper cache function that allows to create either a real cache or a fake one, depending on the global variable Fake

func WatchfakeResources

func WatchfakeResources(resource string, handlers cache.ResourceEventHandlerFuncs) (cache.Store, chan struct{}, error)

WatchfakeResources creates a Fake custom informer, useful for testing purposes TODO: to implement all the caching functionality, such as resync, filtering, etc.

Types

type CRDClient

type CRDClient struct {
	Store cache.Store
	Stop  chan struct{}
	// contains filtered or unexported fields
}

func NewFromConfig

func NewFromConfig(config *rest.Config) (*CRDClient, error)

func (*CRDClient) Client

func (c *CRDClient) Client() kubernetes.Interface

func (*CRDClient) Config

func (c *CRDClient) Config() *rest.Config

func (*CRDClient) Resource

func (c *CRDClient) Resource(api string) CrdClientInterface

type Client

type Client struct {
	Client rest.Interface
	// contains filtered or unexported fields
}

func (*Client) Create

func (c *Client) Create(obj runtime.Object, opts metav1.CreateOptions) (runtime.Object, error)

func (*Client) Delete

func (c *Client) Delete(name string, opts metav1.DeleteOptions) error

func (*Client) Get

func (c *Client) Get(name string, opts metav1.GetOptions) (runtime.Object, error)

func (*Client) List

func (c *Client) List(opts metav1.ListOptions) (runtime.Object, error)

func (*Client) Namespace

func (c *Client) Namespace(namespace string) CrdClientInterface

func (*Client) Update

func (c *Client) Update(name string, obj runtime.Object, opts metav1.UpdateOptions) (runtime.Object, error)

func (*Client) UpdateStatus

func (c *Client) UpdateStatus(name string, obj runtime.Object, opts metav1.UpdateOptions) (runtime.Object, error)

func (*Client) Watch

func (c *Client) Watch(opts metav1.ListOptions) (watch.Interface, error)

type CrdClientInterface

type CrdClientInterface interface {
	Namespace(namespace string) CrdClientInterface
	List(opts metav1.ListOptions) (runtime.Object, error)
	Get(name string, opts metav1.GetOptions) (runtime.Object, error)
	Create(obj runtime.Object, opts metav1.CreateOptions) (runtime.Object, error)
	Watch(opts metav1.ListOptions) (watch.Interface, error)
	Update(name string, obj runtime.Object, opts metav1.UpdateOptions) (runtime.Object, error)
	UpdateStatus(name string, obj runtime.Object, opts metav1.UpdateOptions) (runtime.Object, error)
	Delete(name string, opts metav1.DeleteOptions) error
}

type FakeClient

type FakeClient struct {
	Client rest.Interface
	// contains filtered or unexported fields
}

func (*FakeClient) Create

func (*FakeClient) Delete

func (c *FakeClient) Delete(name string, opts metav1.DeleteOptions) error

func (*FakeClient) Get

func (c *FakeClient) Get(name string, _ metav1.GetOptions) (runtime.Object, error)

func (*FakeClient) List

func (*FakeClient) Namespace

func (c *FakeClient) Namespace(namespace string) CrdClientInterface

func (*FakeClient) Update

func (c *FakeClient) Update(name string, obj runtime.Object, _ metav1.UpdateOptions) (runtime.Object, error)

func (*FakeClient) UpdateStatus

func (c *FakeClient) UpdateStatus(name string, obj runtime.Object, opts metav1.UpdateOptions) (runtime.Object, error)

func (*FakeClient) Watch

type KeyerFunc

type KeyerFunc func(obj runtime.Object) (string, error)

type NamespacedCRDClientInterface

type NamespacedCRDClientInterface interface {
	Resource(resource string) CrdClientInterface
}

type RegistryType

type RegistryType struct {
	SingularType reflect.Type
	PluralType   reflect.Type

	Keyer    KeyerFunc
	Resource schema.GroupResource
}

Jump to

Keyboard shortcuts

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