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.Context, object ctrlClient.Object, _ ...ctrlClient.CreateOption) error
- func (client *MockClient) Delete(_ context.Context, object ctrlClient.Object, _ ...ctrlClient.DeleteOption) error
- func (client *MockClient) DeleteAllOf(_ context.Context, _ ctrlClient.Object, _ ...ctrlClient.DeleteAllOfOption) 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.Context, key ctrlClient.ObjectKey, object ctrlClient.Object) error
- func (client *MockClient) List(_ context.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.Context, _ ctrlClient.Object, _ 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(ctx context.Context, object ctrlClient.Object, reason string) error
- func (client *MockClient) Status() ctrlClient.StatusWriter
- func (client *MockClient) Update(_ context.Context, object ctrlClient.Object, _ ...ctrlClient.UpdateOption) 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.Context, object ctrlClient.Object, _ ...ctrlClient.CreateOption) error
Create creates a new object
func (*MockClient) Delete ¶
func (client *MockClient) Delete(_ context.Context, object ctrlClient.Object, _ ...ctrlClient.DeleteOption) error
Delete deletes an object. This does not support the options argument yet.
func (*MockClient) DeleteAllOf ¶
func (client *MockClient) DeleteAllOf(_ context.Context, _ ctrlClient.Object, _ ...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.Context, key ctrlClient.ObjectKey, object ctrlClient.Object) error
Get retrieves an object.
func (*MockClient) List ¶
func (client *MockClient) List(_ context.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.Context, _ ctrlClient.Object, _ ctrlClient.Patch, _ ...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(ctx context.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.Context, object ctrlClient.Object, _ ...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.Context, _ ctrlClient.Object, _ ctrlClient.Patch, _ ...ctrlClient.PatchOption) error
Patch patches an object's status. This is not yet implemented.
func (MockStatusClient) Update ¶
func (client MockStatusClient) Update(_ context.Context, object ctrlClient.Object, _ ...ctrlClient.UpdateOption) error
Update updates an object. This does not support the options argument yet.