...

Package platform

Overview ▾

Package platform provides a generic interface to abstract operations that can be performed anywhere. Its goal is to make odo not too tied to a specific platform like Kubernetes, but be able to work on other platforms like Podman.

Package platform is a generated GoMock package.

Index ▾

type Client
type MockClient
    func NewMockClient(ctrl *gomock.Controller) *MockClient
    func (m *MockClient) EXPECT() *MockClientMockRecorder
    func (m *MockClient) ExecCMDInContainer(ctx context.Context, containerName, podName string, cmd []string, stdout, stderr io.Writer, stdin io.Reader, tty bool) error
    func (m *MockClient) GetAllPodsInNamespaceMatchingSelector(selector, ns string) (*v1.PodList, error)
    func (m *MockClient) GetAllResourcesFromSelector(selector, ns string) ([]unstructured.Unstructured, error)
    func (m *MockClient) GetPodLogs(podName, containerName string, followLog bool) (io.ReadCloser, error)
    func (m *MockClient) GetPodUsingComponentName(componentName string) (*v1.Pod, error)
    func (m *MockClient) GetPodsMatchingSelector(selector string) (*v1.PodList, error)
    func (m *MockClient) GetRunningPodFromSelector(selector string) (*v1.Pod, error)
    func (m *MockClient) PodWatcher(ctx context.Context, selector string) (watch.Interface, error)
type MockClientMockRecorder
    func (mr *MockClientMockRecorder) ExecCMDInContainer(ctx, containerName, podName, cmd, stdout, stderr, stdin, tty interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetAllPodsInNamespaceMatchingSelector(selector, ns interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetAllResourcesFromSelector(selector, ns interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetPodLogs(podName, containerName, followLog interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetPodUsingComponentName(componentName interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetPodsMatchingSelector(selector interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetRunningPodFromSelector(selector interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) PodWatcher(ctx, selector interface{}) *gomock.Call
type PodNotFoundError
    func (e *PodNotFoundError) Error() string

Package files

doc.go errors.go interface.go mock.go

type Client

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)
}

type MockClient

MockClient is a mock of Client interface.

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

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) ExecCMDInContainer

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 (*MockClient) GetAllPodsInNamespaceMatchingSelector

func (m *MockClient) GetAllPodsInNamespaceMatchingSelector(selector, ns string) (*v1.PodList, error)

GetAllPodsInNamespaceMatchingSelector mocks base method.

func (*MockClient) GetAllResourcesFromSelector

func (m *MockClient) GetAllResourcesFromSelector(selector, ns string) ([]unstructured.Unstructured, error)

GetAllResourcesFromSelector mocks base method.

func (*MockClient) GetPodLogs

func (m *MockClient) GetPodLogs(podName, containerName string, followLog bool) (io.ReadCloser, error)

GetPodLogs mocks base method.

func (*MockClient) GetPodUsingComponentName

func (m *MockClient) GetPodUsingComponentName(componentName string) (*v1.Pod, error)

GetPodUsingComponentName mocks base method.

func (*MockClient) GetPodsMatchingSelector

func (m *MockClient) GetPodsMatchingSelector(selector string) (*v1.PodList, error)

GetPodsMatchingSelector mocks base method.

func (*MockClient) GetRunningPodFromSelector

func (m *MockClient) GetRunningPodFromSelector(selector string) (*v1.Pod, error)

GetRunningPodFromSelector mocks base method.

func (*MockClient) PodWatcher

func (m *MockClient) PodWatcher(ctx context.Context, selector string) (watch.Interface, error)

PodWatcher mocks base method.

type MockClientMockRecorder

MockClientMockRecorder is the mock recorder for MockClient.

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

func (*MockClientMockRecorder) ExecCMDInContainer

func (mr *MockClientMockRecorder) ExecCMDInContainer(ctx, containerName, podName, cmd, stdout, stderr, stdin, tty interface{}) *gomock.Call

ExecCMDInContainer indicates an expected call of ExecCMDInContainer.

func (*MockClientMockRecorder) GetAllPodsInNamespaceMatchingSelector

func (mr *MockClientMockRecorder) GetAllPodsInNamespaceMatchingSelector(selector, ns interface{}) *gomock.Call

GetAllPodsInNamespaceMatchingSelector indicates an expected call of GetAllPodsInNamespaceMatchingSelector.

func (*MockClientMockRecorder) GetAllResourcesFromSelector

func (mr *MockClientMockRecorder) GetAllResourcesFromSelector(selector, ns interface{}) *gomock.Call

GetAllResourcesFromSelector indicates an expected call of GetAllResourcesFromSelector.

func (*MockClientMockRecorder) GetPodLogs

func (mr *MockClientMockRecorder) GetPodLogs(podName, containerName, followLog interface{}) *gomock.Call

GetPodLogs indicates an expected call of GetPodLogs.

func (*MockClientMockRecorder) GetPodUsingComponentName

func (mr *MockClientMockRecorder) GetPodUsingComponentName(componentName interface{}) *gomock.Call

GetPodUsingComponentName indicates an expected call of GetPodUsingComponentName.

func (*MockClientMockRecorder) GetPodsMatchingSelector

func (mr *MockClientMockRecorder) GetPodsMatchingSelector(selector interface{}) *gomock.Call

GetPodsMatchingSelector indicates an expected call of GetPodsMatchingSelector.

func (*MockClientMockRecorder) GetRunningPodFromSelector

func (mr *MockClientMockRecorder) GetRunningPodFromSelector(selector interface{}) *gomock.Call

GetRunningPodFromSelector indicates an expected call of GetRunningPodFromSelector.

func (*MockClientMockRecorder) PodWatcher

func (mr *MockClientMockRecorder) PodWatcher(ctx, selector interface{}) *gomock.Call

PodWatcher indicates an expected call of PodWatcher.

type PodNotFoundError

PodNotFoundError returns an error if no pod is found with the selector

type PodNotFoundError struct {
    Selector string
}

func (*PodNotFoundError) Error

func (e *PodNotFoundError) Error() string