Documentation ¶
Overview ¶
Package client provides a mock Kubernetes client for use in testing controllers.
Index ¶
- type MockClient
- func (client *MockClient) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventType string, ...)
- func (client *MockClient) Clear()
- func (client *MockClient) Create(context ctx.Context, object ctrlClient.Object, ...) error
- func (client *MockClient) Delete(context ctx.Context, object ctrlClient.Object, ...) error
- func (client *MockClient) DeleteAllOf(context ctx.Context, object ctrlClient.Object, ...) error
- func (client *MockClient) Event(object runtime.Object, eventType string, reason string, message string)
- func (client *MockClient) Eventf(object runtime.Object, eventType string, reason string, messageFormat string, ...)
- func (client *MockClient) Get(context ctx.Context, key ctrlClient.ObjectKey, object ctrlClient.Object) error
- func (client *MockClient) List(context ctx.Context, list ctrlClient.ObjectList, ...) error
- func (client *MockClient) MockStuckTermination(object ctrlClient.Object, terminating bool) error
- func (client *MockClient) PastEventf(object runtime.Object, timestamp metav1.Time, eventType string, reason string, ...)
- func (client *MockClient) Patch(context ctx.Context, object ctrlClient.Object, patch ctrlClient.Patch, ...) error
- func (client *MockClient) RESTMapper() meta.RESTMapper
- func (client *MockClient) RemovePodIP(pod *corev1.Pod) error
- func (client *MockClient) Scheme() *runtime.Scheme
- func (client *MockClient) SetPodIntoFailed(context ctx.Context, object ctrlClient.Object, reason string) error
- func (client *MockClient) Status() ctrlClient.StatusWriter
- func (client *MockClient) Update(context ctx.Context, object ctrlClient.Object, ...) error
- type MockStatusClient
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) 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 returns the RESTMapper
func (*MockClient) RemovePodIP ¶ added in v0.36.0
func (client *MockClient) RemovePodIP(pod *corev1.Pod) error
RemovePodIP sets the IP address of the Pod to an empty string
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.