Client is the interface that wraps operations that can be performed on any supported platform.
type Client interface { // ExecCMDInContainer executes the specified command in the container of a pod. // If an empty string is passed as container name, the command will be executed in the first container found in the pod. ExecCMDInContainer(ctx context.Context, containerName, podName string, cmd []string, stdout, stderr io.Writer, stdin io.Reader, tty bool) error // GetPodLogs returns the logs of the specified pod container. // All logs for all containers part of the pod are returned if an empty string is provided as container name. GetPodLogs(podName, containerName string, followLog bool) (io.ReadCloser, error) // GetPodsMatchingSelector returns all pods matching the given label selector. GetPodsMatchingSelector(selector string) (*corev1.PodList, error) // GetAllResourcesFromSelector returns all resources of any kind matching the given label selector. GetAllResourcesFromSelector(selector string, ns string) ([]unstructured.Unstructured, error) // GetAllPodsInNamespaceMatchingSelector returns all pods matching the given label selector and in the specified namespace. GetAllPodsInNamespaceMatchingSelector(selector string, ns string) (*corev1.PodList, error) // GetRunningPodFromSelector returns any pod matching the given label selector. // If multiple pods are found, implementations might have different behavior, by either returning an error or returning any element. GetRunningPodFromSelector(selector string) (*corev1.Pod, error) GetPodUsingComponentName(componentName string) (*corev1.Pod, error) PodWatcher(ctx context.Context, selector string) (watch.Interface, error) }
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) ExecCMDInContainer(ctx context.Context, containerName, podName string, cmd []string, stdout, stderr io.Writer, stdin io.Reader, tty bool) error
ExecCMDInContainer mocks base method.
func (m *MockClient) GetAllPodsInNamespaceMatchingSelector(selector, ns string) (*v1.PodList, error)
GetAllPodsInNamespaceMatchingSelector mocks base method.
func (m *MockClient) GetAllResourcesFromSelector(selector, ns string) ([]unstructured.Unstructured, error)
GetAllResourcesFromSelector mocks base method.
func (m *MockClient) GetPodLogs(podName, containerName string, followLog bool) (io.ReadCloser, error)
GetPodLogs mocks base method.
func (m *MockClient) GetPodUsingComponentName(componentName string) (*v1.Pod, error)
GetPodUsingComponentName mocks base method.
func (m *MockClient) GetPodsMatchingSelector(selector string) (*v1.PodList, error)
GetPodsMatchingSelector mocks base method.
func (m *MockClient) GetRunningPodFromSelector(selector string) (*v1.Pod, error)
GetRunningPodFromSelector mocks base method.
func (m *MockClient) PodWatcher(ctx context.Context, selector string) (watch.Interface, error)
PodWatcher mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) ExecCMDInContainer(ctx, containerName, podName, cmd, stdout, stderr, stdin, tty interface{}) *gomock.Call
ExecCMDInContainer indicates an expected call of ExecCMDInContainer.
func (mr *MockClientMockRecorder) GetAllPodsInNamespaceMatchingSelector(selector, ns interface{}) *gomock.Call
GetAllPodsInNamespaceMatchingSelector indicates an expected call of GetAllPodsInNamespaceMatchingSelector.
func (mr *MockClientMockRecorder) GetAllResourcesFromSelector(selector, ns interface{}) *gomock.Call
GetAllResourcesFromSelector indicates an expected call of GetAllResourcesFromSelector.
func (mr *MockClientMockRecorder) GetPodLogs(podName, containerName, followLog interface{}) *gomock.Call
GetPodLogs indicates an expected call of GetPodLogs.
func (mr *MockClientMockRecorder) GetPodUsingComponentName(componentName interface{}) *gomock.Call
GetPodUsingComponentName indicates an expected call of GetPodUsingComponentName.
func (mr *MockClientMockRecorder) GetPodsMatchingSelector(selector interface{}) *gomock.Call
GetPodsMatchingSelector indicates an expected call of GetPodsMatchingSelector.
func (mr *MockClientMockRecorder) GetRunningPodFromSelector(selector interface{}) *gomock.Call
GetRunningPodFromSelector indicates an expected call of GetRunningPodFromSelector.
func (mr *MockClientMockRecorder) PodWatcher(ctx, selector interface{}) *gomock.Call
PodWatcher indicates an expected call of PodWatcher.
PodNotFoundError returns an error if no pod is found with the selector
type PodNotFoundError struct { Selector string }
func (e *PodNotFoundError) Error() string