client

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package client provides a mock Kubernetes client for use in testing controllers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

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

MockClient provides a mock Kubernetes client.

func (*MockClient) AnnotatedEventf

func (client *MockClient) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventType string, reason string, messageFormat string, args ...interface{})

AnnotatedEventf is just like eventf, but with annotations attached

func (*MockClient) Clear

func (client *MockClient) Clear()

Clear erases any mock data.

func (*MockClient) Create

func (client *MockClient) Create(context ctx.Context, object ctrlClient.Object, options ...ctrlClient.CreateOption) error

Create creates a new object

func (*MockClient) Delete

func (client *MockClient) Delete(context ctx.Context, object ctrlClient.Object, options ...ctrlClient.DeleteOption) error

Delete deletes an object. This does not support the options argument yet.

func (*MockClient) DeleteAllOf

func (client *MockClient) DeleteAllOf(context ctx.Context, object ctrlClient.Object, options ...ctrlClient.DeleteAllOfOption) error

DeleteAllOf deletes all objects of the given type matching the given options. This is not yet implemented.

func (*MockClient) Event

func (client *MockClient) Event(object runtime.Object, eventType string, reason string, message string)

Event sends an event

func (*MockClient) Eventf

func (client *MockClient) Eventf(object runtime.Object, eventType string, reason string, messageFormat string, args ...interface{})

Eventf is just like Event, but with Sprintf for the message field.

func (*MockClient) Get

func (client *MockClient) Get(context ctx.Context, key ctrlClient.ObjectKey, object ctrlClient.Object) error

Get retrieves an object.

func (*MockClient) List

func (client *MockClient) List(context ctx.Context, list ctrlClient.ObjectList, options ...ctrlClient.ListOption) error

List lists objects.

func (*MockClient) MockStuckTermination added in v0.31.0

func (client *MockClient) MockStuckTermination(object ctrlClient.Object, terminating bool) error

MockStuckTermination sets a flag determining whether an object should get stuck in terminating when it is deleted.

func (*MockClient) PastEventf

func (client *MockClient) PastEventf(object runtime.Object, timestamp metav1.Time, eventType string, reason string, messageFormat string, args ...interface{})

PastEventf is just like Eventf, but with an option to specify the event's 'timestamp' field.

func (*MockClient) Patch

func (client *MockClient) Patch(context ctx.Context, object ctrlClient.Object, patch ctrlClient.Patch, options ...ctrlClient.PatchOption) error

Patch patches an object. This is not yet implemented.

func (*MockClient) RESTMapper added in v0.29.0

func (client *MockClient) RESTMapper() meta.RESTMapper

RESTMapper retruns the RESTMapper

func (*MockClient) Scheme added in v0.29.0

func (client *MockClient) Scheme() *runtime.Scheme

Scheme returns the runtime Scheme

func (*MockClient) SetPodIntoFailed added in v0.32.0

func (client *MockClient) SetPodIntoFailed(context ctx.Context, object ctrlClient.Object, reason string) error

SetPodIntoFailed sets a Pod into a failed status with the given reason

func (*MockClient) Status

func (client *MockClient) Status() ctrlClient.StatusWriter

Status returns a writer for updating status.

func (*MockClient) Update

func (client *MockClient) Update(context ctx.Context, object ctrlClient.Object, options ...ctrlClient.UpdateOption) error

Update updates an object. This does not support the options argument yet.

type MockStatusClient

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

MockStatusClient wraps a client to provide specialized operations for updating status.

func (MockStatusClient) Patch

func (client MockStatusClient) Patch(context ctx.Context, object ctrlClient.Object, patch ctrlClient.Patch, options ...ctrlClient.PatchOption) error

Patch patches an object's status. This is not yet implemented.

func (MockStatusClient) Update

func (client MockStatusClient) Update(context ctx.Context, object ctrlClient.Object, options ...ctrlClient.UpdateOption) error

Update updates an object. This does not support the options argument yet.

Jump to

Keyboard shortcuts

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