dynamic

package
v1.11.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package dynamic provides a client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentConfig

func ContentConfig() rest.ContentConfig

ContentConfig returns a rest.ContentConfig for dynamic types. Deprecated only used by test code and its wrong

func LegacyAPIPathResolverFunc

func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string

LegacyAPIPathResolverFunc can resolve paths properly with the legacy API.

func NewDiscoveryRESTMapper

func NewDiscoveryRESTMapper(resources []*metav1.APIResourceList) (*meta.DefaultRESTMapper, error)

NewDiscoveryRESTMapper returns a RESTMapper based on discovery information.

func NewObjectTyper

func NewObjectTyper(resources []*metav1.APIResourceList) (runtime.ObjectTyper, error)

NewObjectTyper constructs an ObjectTyper from discovery information.

Types

type APIPathResolverFunc

type APIPathResolverFunc func(kind schema.GroupVersionKind) string

APIPathResolverFunc knows how to convert a groupVersion to its API path. The Kind field is optional.

type Client

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

Client is a Kubernetes client that allows you to access metadata and manipulate metadata of a Kubernetes API group, and implements Interface.

func NewClient

func NewClient(conf *restclient.Config, version schema.GroupVersion) (*Client, error)

NewClient returns a new client based on the passed in config. The codec is ignored, as the dynamic client uses it's own codec.

func (*Client) Resource

func (c *Client) Resource(resource *metav1.APIResource, namespace string) ResourceInterface

Resource returns an API interface to the specified resource for this client's group and version. If resource is not a namespaced resource, then namespace is ignored. The ResourceInterface inherits the parameter codec of c.

type ClientPool

type ClientPool interface {
	// ClientForGroupVersionResource returns a client configured for the specified groupVersionResource.
	// Resource may be empty.
	ClientForGroupVersionResource(resource schema.GroupVersionResource) (Interface, error)
	// ClientForGroupVersionKind returns a client configured for the specified groupVersionKind.
	// Kind may be empty.
	ClientForGroupVersionKind(kind schema.GroupVersionKind) (Interface, error)
}

ClientPool manages a pool of dynamic clients.

func NewClientPool

func NewClientPool(config *restclient.Config, mapper meta.RESTMapper, apiPathResolverFunc APIPathResolverFunc) ClientPool

NewClientPool returns a ClientPool from the specified config. It reuses clients for the same group version. It is expected this type may be wrapped by specific logic that special cases certain resources or groups.

func NewDynamicClientPool added in v1.6.0

func NewDynamicClientPool(cfg *restclient.Config) ClientPool

Instantiates a new dynamic client pool with the given config.

type DynamicInterface

type DynamicInterface interface {
	Resource(resource schema.GroupVersionResource) NamespaceableDynamicResourceInterface

	// Deprecated, this isn't how we want to do it
	ClusterSubresource(resource schema.GroupVersionResource, subresource string) DynamicResourceInterface
	// Deprecated, this isn't how we want to do it
	NamespacedSubresource(resource schema.GroupVersionResource, subresource, namespace string) DynamicResourceInterface
}

func NewForConfig added in v1.11.0

func NewForConfig(inConfig *rest.Config) (DynamicInterface, error)

type DynamicResourceInterface

type DynamicResourceInterface interface {
	Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	UpdateStatus(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	Delete(name string, options *metav1.DeleteOptions) error
	DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
	Get(name string, options metav1.GetOptions) (*unstructured.Unstructured, error)
	List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
	Watch(opts metav1.ListOptions) (watch.Interface, error)
	Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*unstructured.Unstructured, error)
}

type Interface added in v1.8.0

type Interface interface {
	// Resource returns an API interface to the specified resource for this client's
	// group and version.  If resource is not a namespaced resource, then namespace
	// is ignored.  The ResourceInterface inherits the parameter codec of this client.
	Resource(resource *metav1.APIResource, namespace string) ResourceInterface
}

Interface is a Kubernetes client that allows you to access metadata and manipulate metadata of a Kubernetes API group.

type NamespaceableDynamicResourceInterface

type NamespaceableDynamicResourceInterface interface {
	Namespace(string) DynamicResourceInterface
	DynamicResourceInterface
}

type ObjectTyper

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

ObjectTyper provides an ObjectTyper implementation for unstructured.Unstructured object based on discovery information.

func (*ObjectTyper) ObjectKinds

func (ot *ObjectTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error)

ObjectKinds returns a slice of one element with the group,version,kind of the provided object, or an error if the object is not *unstructured.Unstructured or has no group,version,kind information.

func (*ObjectTyper) Recognizes

func (ot *ObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool

Recognizes returns true if the provided group,version,kind was in the discovery information.

type ResourceInterface added in v1.8.0

type ResourceInterface interface {
	// List returns a list of objects for this resource.
	List(opts metav1.ListOptions) (runtime.Object, error)
	// Get gets the resource with the specified name.
	Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)
	// Delete deletes the resource with the specified name.
	Delete(name string, opts *metav1.DeleteOptions) error
	// DeleteCollection deletes a collection of objects.
	DeleteCollection(deleteOptions *metav1.DeleteOptions, listOptions metav1.ListOptions) error
	// Create creates the provided resource.
	Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	// Update updates the provided resource.
	Update(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
	// Watch returns a watch.Interface that watches the resource.
	Watch(opts metav1.ListOptions) (watch.Interface, error)
	// Patch patches the provided resource.
	Patch(name string, pt types.PatchType, data []byte) (*unstructured.Unstructured, error)
}

ResourceInterface is an API interface to a specific resource under a dynamic client.

Directories

Path Synopsis
Package fake provides a fake client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.
Package fake provides a fake client interface to arbitrary Kubernetes APIs that exposes common high level operations and exposes common metadata.

Jump to

Keyboard shortcuts

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