client

package
v0.0.0-...-445da97 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Reader
	Writer
	StatusWriter
}

Client knows how to perform CRUD operations on Kubernetes objects.

func NewForConfig

func NewForConfig(dynamicClient dynamic.Interface, mapper meta.RESTMapper) (Client, error)

NewForConfig returns a new Client using the provided config and Options. The returned client reads *and* writes directly from the server (it doesn't use object caches). It understands how to work with normal types (both custom resources and aggregated/built-in resources), as well as unstructured types.

In the case of normal types, the scheme will be used to look up the corresponding group, version, and kind for the given type. In the case of unstrctured types, the group, version, and kind will be extracted from the corresponding fields on the object.

type Reader

type Reader interface {
	// Get retrieves an obj for the given object key from the Kubernetes Cluster.
	// obj must be a struct pointer so that obj can be updated with the response
	// returned by the Server.
	Get(ctx context.Context, key types.NamespacedName, obj runtime.Object) error

	// List retrieves list of objects for a given namespace and list options. On a
	// successful call, Items field in the list will be populated with the
	// result returned from the server.
	List(ctx context.Context, list runtime.Object, namespace string, options *metav1.ListOptions) error
}

Reader knows how to read and list Kubernetes objects.

type StatusWriter

type StatusWriter interface {
	// UpdateStatus updates the fields corresponding to the status subresource for the
	// given obj. obj must be a struct pointer so that obj can be updated
	// with the content returned by the Server.
	UpdateStatus(ctx context.Context, obj runtime.Object) error
}

StatusWriter knows how to update status subresource of a Kubernetes object.

type Writer

type Writer interface {
	// Create saves the object obj in the Kubernetes cluster.
	Create(ctx context.Context, obj runtime.Object, options *metav1.CreateOptions) error

	// Delete deletes the given obj from Kubernetes cluster.
	Delete(ctx context.Context, obj runtime.Object, options *metav1.DeleteOptions) error

	// Update updates the given obj in the Kubernetes cluster. obj must be a
	// struct pointer so that obj can be updated with the content returned by the Server.
	Update(ctx context.Context, obj runtime.Object, options *metav1.UpdateOptions) error

	// Apply generates a merge patch and patches the object.
	// TODO - annotate the object with patch
	// If not found the object is created
	Apply(ctx context.Context, obj runtime.Object) error

	// Patch patches the given obj in the Kubernetes cluster. obj must be a
	// struct pointer so that obj can be updated with the content returned by the Server.
	Patch(ctx context.Context, obj runtime.Object, patch patch.Patch, options *metav1.PatchOptions) error
}

Writer knows how to create, delete, and update Kubernetes objects.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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