fakeclient

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 15 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 struct {
	Objects map[storageKey]runtime.Object

	SubResourceClient
	// contains filtered or unexported fields
}

Client is a fake k8s client

func NewFakeClient

func NewFakeClient(initialObjects []runtime.Object, errorInjector errorInjector) (*Client, error)

NewFakeClient initializes and returns new fake k8s client

func (Client) Create

func (f Client) Create(_ context.Context, obj client.Object, _ ...client.CreateOption) error

Create creates new object in fake cluster by putting it in map

func (Client) Delete

func (f Client) Delete(_ context.Context, obj client.Object, opts ...client.DeleteOption) error

Delete deletes existing object in fake cluster by removing it from map

func (Client) DeleteAllOf

func (f Client) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error

DeleteAllOf deletes all objects of the given type matching the given options

func (Client) Get

Get finds object and puts it in client.Object obj argument

func (Client) List

func (f Client) List(_ context.Context, list client.ObjectList, opts ...client.ListOption) error

List list all requested items in fake cluster

func (Client) Patch

Patch patches the given obj in the Kubernetes cluster

func (Client) RESTMapper

func (f Client) RESTMapper() meta.RESTMapper

RESTMapper returns the rest this client is using

func (Client) Scheme

func (f Client) Scheme() *runtime.Scheme

Scheme returns the scheme this client is using

func (Client) Status

func (f Client) Status() client.StatusWriter

Status knows how to create a client which can update status subresource for kubernetes objects

func (Client) SubResource added in v1.5.0

func (f Client) SubResource(_ string) client.SubResourceClient

SubResource returns a subresource client for the named subResource. TODO: Implement

func (Client) Update

func (f Client) Update(_ context.Context, obj client.Object, _ ...client.UpdateOption) error

Update updates object in fake k8s cluster

type SubResourceClient added in v1.5.0

type SubResourceClient struct{}

SubResourceClient is a fake k8s subresource client

func (SubResourceClient) Create added in v1.5.0

Create saves the subResource object in the Kubernetes cluster. TODO: Implement

func (SubResourceClient) Get added in v1.5.0

Get retrieves a subResource for the given obj object from the Kubernetes Cluster. TODO: Implement

func (SubResourceClient) Patch added in v1.5.0

Patch patches the given object's subresource. TODO: Implement

func (SubResourceClient) Update added in v1.5.0

Update updates the fields corresponding to the status subresource for the given obj. TODO: Implement

Jump to

Keyboard shortcuts

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