clientset

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: Apache-2.0 Imports: 9 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clientset

type Clientset struct {
	// contains filtered or unexported fields
}

func New

func New(config *rest.Config, resources *dynamicdiscovery.ResourceMap) (*Clientset, error)

func (*Clientset) HasSynced

func (cs *Clientset) HasSynced() bool

func (*Clientset) Kind

func (cs *Clientset) Kind(apiVersion, kind string) (*ResourceClient, error)

func (*Clientset) Resource

func (cs *Clientset) Resource(apiVersion, resource string) (*ResourceClient, error)

type ResourceClient

type ResourceClient struct {
	dynamic.ResourceInterface
	*dynamicdiscovery.APIResource
	// contains filtered or unexported fields
}

ResourceClient is a combination of APIResource and a dynamic Client.

Passing this around makes it easier to write code that deals with arbitrary resource types and often needs to know the API discovery details. This wrapper also adds convenience functions that are useful for any client.

It can be used on either namespaced or cluster-scoped resources. Call Namespace() to return a client that's scoped down to a given namespace.

func (*ResourceClient) AddFinalizer added in v0.3.0

func (rc *ResourceClient) AddFinalizer(orig *unstructured.Unstructured, name string) (*unstructured.Unstructured, error)

AddFinalizer adds the given finalizer to the list, if it isn't there already.

func (*ResourceClient) AtomicStatusUpdate added in v0.3.0

func (rc *ResourceClient) AtomicStatusUpdate(orig *unstructured.Unstructured, update func(obj *unstructured.Unstructured) bool) (result *unstructured.Unstructured, err error)

AtomicStatusUpdate is similar to AtomicUpdate, except that it updates status.

func (*ResourceClient) AtomicUpdate added in v0.3.0

func (rc *ResourceClient) AtomicUpdate(orig *unstructured.Unstructured, update func(obj *unstructured.Unstructured) bool) (result *unstructured.Unstructured, err error)

AtomicUpdate performs an atomic read-modify-write loop, retrying on optimistic concurrency conflicts.

It only uses the identity (name/namespace/uid) of the provided 'orig' object, not the contents. The object passed to the update() func will be from a live GET against the API server.

This should only be used for unconditional writes, as in, "I want to make this change right now regardless of what else may have changed since I last read the object."

The update() func should modify the passed object and return true to go ahead with the update, or false if no update is required.

func (*ResourceClient) Namespace added in v0.3.0

func (rc *ResourceClient) Namespace(namespace string) *ResourceClient

Namespace returns a copy of the ResourceClient with the client namespace set.

This can be chained to set the namespace to something else. Pass "" to return a client with the namespace cleared. If the resource is cluster-scoped, this is a no-op.

func (*ResourceClient) RemoveFinalizer added in v0.3.0

func (rc *ResourceClient) RemoveFinalizer(orig *unstructured.Unstructured, name string) (*unstructured.Unstructured, error)

RemoveFinalizer removes the given finalizer from the list, if it's there.

Jump to

Keyboard shortcuts

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