dclient

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeDiscoveryClient

func NewFakeDiscoveryClient(registeredResources []schema.GroupVersionResource) *fakeDiscoveryClient

NewFakeDiscoveryClient returns a fakediscovery client

Types

type IDiscovery

type IDiscovery interface {
	FindResource(groupVersion string, kind string) (apiResource, parentAPIResource *metav1.APIResource, gvr schema.GroupVersionResource, err error)
	GetGVRFromKind(kind string) (schema.GroupVersionResource, error)
	GetGVRFromAPIVersionKind(groupVersion string, kind string) schema.GroupVersionResource
	GetGVKFromGVR(apiVersion, resourceName string) (schema.GroupVersionKind, error)
	GetServerVersion() (*version.Info, error)
	OpenAPISchema() (*openapiv2.Document, error)
	DiscoveryCache() discovery.CachedDiscoveryInterface
	DiscoveryInterface() discovery.DiscoveryInterface
}

IDiscovery provides interface to mange Kind and GVR mapping

type Interface

type Interface interface {
	// GetKubeClient provides typed kube client
	GetKubeClient() kubernetes.Interface
	// GetEventsInterface provides typed interface for events
	GetEventsInterface() corev1.EventInterface
	// GetDynamicInterface fetches underlying dynamic interface
	GetDynamicInterface() dynamic.Interface
	// Discovery return the discovery client implementation
	Discovery() IDiscovery
	// SetDiscovery sets the discovery client implementation
	SetDiscovery(discoveryClient IDiscovery)
	// RawAbsPath performs a raw call to the kubernetes API
	RawAbsPath(ctx context.Context, path string) ([]byte, error)
	// GetResource returns the resource in unstructured/json format
	GetResource(ctx context.Context, apiVersion string, kind string, namespace string, name string, subresources ...string) (*unstructured.Unstructured, error)
	// PatchResource patches the resource
	PatchResource(ctx context.Context, apiVersion string, kind string, namespace string, name string, patch []byte) (*unstructured.Unstructured, error)
	// ListResource returns the list of resources in unstructured/json format
	// Access items using []Items
	ListResource(ctx context.Context, apiVersion string, kind string, namespace string, lselector *metav1.LabelSelector) (*unstructured.UnstructuredList, error)
	// DeleteResource deletes the specified resource
	DeleteResource(ctx context.Context, apiVersion string, kind string, namespace string, name string, dryRun bool) error
	// CreateResource creates object for the specified resource/namespace
	CreateResource(ctx context.Context, apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
	// UpdateResource updates object for the specified resource/namespace
	UpdateResource(ctx context.Context, apiVersion string, kind string, namespace string, obj interface{}, dryRun bool, subresources ...string) (*unstructured.Unstructured, error)
	// UpdateStatusResource updates the resource "status" subresource
	UpdateStatusResource(ctx context.Context, apiVersion string, kind string, namespace string, obj interface{}, dryRun bool) (*unstructured.Unstructured, error)
}

func NewClient

func NewClient(
	ctx context.Context,
	dyn dynamic.Interface,
	kube kubernetes.Interface,
	resync time.Duration,
) (Interface, error)

NewClient creates new instance of client

func NewEmptyFakeClient

func NewEmptyFakeClient() Interface

func NewFakeClient

func NewFakeClient(scheme *runtime.Scheme, gvrToListKind map[schema.GroupVersionResource]string, objects ...runtime.Object) (Interface, error)

NewFakeClient ---testing utilities

Jump to

Keyboard shortcuts

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