Documentation ¶
Index ¶
- func DecodeAndLoadKubeConfig(encodedKubeConfig string) (*clientcmdapi.Config, error)
- func GetKubeConfigPath(kubeConfigPath string) (string, error)
- func NewMockGetLogsFunc(logs []byte) func(ctx context.Context, req GetPodLogsRequest) (*GetPodLogsResponse, error)
- type Client
- type ClientCfg
- type ExecRequestOpts
- type GetPodInfoRequest
- type GetPodLogsRequest
- type GetPodLogsResponse
- type ListPodsRequest
- type ListPodsRequestOpt
- func WithListPodsRequestFieldSelectors(selectors []string) ListPodsRequestOpt
- func WithListPodsRequestLabelSelectors(selectors []string) ListPodsRequestOpt
- func WithListPodsRequestNamespace(name string) ListPodsRequestOpt
- func WithListPodsRequestRetryOpts(opts ...retry.RetrierOpt) ListPodsRequestOpt
- type ListPodsResponse
- type MockClient
- func (m *MockClient) GetLogs(ctx context.Context, req GetPodLogsRequest) (*GetPodLogsResponse, error)
- func (m *MockClient) GetPodInfo(ctx context.Context, req GetPodInfoRequest) (*PodInfo, error)
- func (m *MockClient) ListPods(ctx context.Context, req *ListPodsRequest) (*ListPodsResponse, error)
- func (m *MockClient) NewExecRequest(opts ExecRequestOpts) it.ExecRequest
- func (m *MockClient) QueryPodInfos(ctx context.Context, req QueryPodInfosRequest) ([]PodInfo, error)
- type PodInfo
- type Pods
- type QueryPodInfosRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeAndLoadKubeConfig ¶
func DecodeAndLoadKubeConfig(encodedKubeConfig string) (*clientcmdapi.Config, error)
DecodeAndLoadKubeConfig decodes a base64 encoded kubeconfig and attempts to load the Config.
func GetKubeConfigPath ¶
GetKubeConfigPath given a kubeConfigPath that might be empty gets a kubeconfig path, by returning the provided value if is not empty, or the value of the kubeConfigEnv if set, or the default kubeconfig path in the users' home dir (~/.kube/config).
func NewMockGetLogsFunc ¶
func NewMockGetLogsFunc(logs []byte) func(ctx context.Context, req GetPodLogsRequest) (*GetPodLogsResponse, error)
NewMockGetLogsFunc creates a GetLogsFunc that returns the provided logs when called.
Types ¶
type Client ¶
type Client interface { // NewExecRequest creates a new exec request for the given opts NewExecRequest(opts ExecRequestOpts) it.ExecRequest // QueryPodInfos gets a slice of all the pods that match the QueryPodInfosRequest. If the namespace // is not provided in the request it will be defaulted to 'default'. QueryPodInfos(ctx context.Context, req QueryPodInfosRequest) ([]PodInfo, error) // GetPodInfo get pod info for the pod that matches the request. If the namespace is not provided // in the request it will be defaulted to 'default'. GetPodInfo(ctx context.Context, req GetPodInfoRequest) (*PodInfo, error) // GetLogs gets the logs for the provided QueryPodInfosRequest GetLogs(ctx context.Context, req GetPodLogsRequest) (*GetPodLogsResponse, error) // ListPods returns all pods matching the given request ListPods(ctx context.Context, req *ListPodsRequest) (*ListPodsResponse, error) }
Client A wrapper around the k8s clientset that provides an api that the provider can use.
type ExecRequestOpts ¶
type GetPodInfoRequest ¶
type GetPodInfoRequest struct { // Namespace the namespace that the pod is in Namespace string // Name the name of the pod Name string }
GetPodInfoRequest a request for getting pod info.
type GetPodLogsRequest ¶
type GetPodLogsResponse ¶
type GetPodLogsResponse struct { ContextName string Namespace string Pod string Container string Logs []byte }
func (GetPodLogsResponse) GetAppName ¶
func (p GetPodLogsResponse) GetAppName() string
GetAppName implements remoteflight.GetLogsResponse.GetAppName.
func (GetPodLogsResponse) GetLogFileName ¶
func (p GetPodLogsResponse) GetLogFileName() string
func (GetPodLogsResponse) GetLogs ¶
func (p GetPodLogsResponse) GetLogs() []byte
type ListPodsRequest ¶
type ListPodsRequest struct { // The kubernetes namespace to query Namespace string // Label selectors to filter by LabelSelectors []string // Field selectors to filter by FieldSelectors []string // How we'll retry the request *retry.Retrier // Options we'll apply to the retrier RetryOpts []retry.RetrierOpt }
ListPodsRequest is a request to list the pods matching the search criteria.
func NewListPodsRequest ¶
func NewListPodsRequest(opts ...ListPodsRequestOpt) *ListPodsRequest
NewListPodsRequest takes NewListPodsRequestOpt's and returns a new instance of ListPodsRequest.
type ListPodsRequestOpt ¶
type ListPodsRequestOpt func(*ListPodsRequest)
ListPodsRequestOpt is a functional option for NewListPodsRequest.
func WithListPodsRequestFieldSelectors ¶
func WithListPodsRequestFieldSelectors(selectors []string) ListPodsRequestOpt
WithListPodsRequestFieldSelectors allows the caller to define field selectors for the ListPods request.
func WithListPodsRequestLabelSelectors ¶
func WithListPodsRequestLabelSelectors(selectors []string) ListPodsRequestOpt
WithListPodsRequestLabelSelectors allows the caller to define label selectors for the ListPods request.
func WithListPodsRequestNamespace ¶
func WithListPodsRequestNamespace(name string) ListPodsRequestOpt
WithListPodsRequestNamespace allows the caller to define namespace for the ListPods request.
func WithListPodsRequestRetryOpts ¶
func WithListPodsRequestRetryOpts(opts ...retry.RetrierOpt) ListPodsRequestOpt
WithListPodsRequestRetryOpts allows the caller to define retry options for the ListPods request.
type ListPodsResponse ¶
type ListPodsResponse struct {
Pods *Pods
}
ListPodsResponse is ListPods response.
func (*ListPodsResponse) String ¶
func (r *ListPodsResponse) String() string
String returns the list of pods as a string.
type MockClient ¶
type MockClient struct { NewExecRequestFunc func(opts ExecRequestOpts) it.ExecRequest QueryPodInfosFunc func(ctx context.Context, req QueryPodInfosRequest) ([]PodInfo, error) GetPodInfoFunc func(ctx context.Context, req GetPodInfoRequest) (*PodInfo, error) GetLogsFunc func(ctx context.Context, req GetPodLogsRequest) (*GetPodLogsResponse, error) ListPodsFunc func(ctx context.Context, req *ListPodsRequest) (*ListPodsResponse, error) }
MockClient a mock Kubernetes Client.
func (*MockClient) GetLogs ¶
func (m *MockClient) GetLogs(ctx context.Context, req GetPodLogsRequest) (*GetPodLogsResponse, error)
func (*MockClient) GetPodInfo ¶
func (m *MockClient) GetPodInfo(ctx context.Context, req GetPodInfoRequest) (*PodInfo, error)
func (*MockClient) ListPods ¶
func (m *MockClient) ListPods(ctx context.Context, req *ListPodsRequest) (*ListPodsResponse, error)
func (*MockClient) NewExecRequest ¶
func (m *MockClient) NewExecRequest(opts ExecRequestOpts) it.ExecRequest
func (*MockClient) QueryPodInfos ¶
func (m *MockClient) QueryPodInfos(ctx context.Context, req QueryPodInfosRequest) ([]PodInfo, error)
type QueryPodInfosRequest ¶
type QueryPodInfosRequest struct { Namespace string LabelSelector string FieldSelector string // ExpectedPodCount the expected number of pods that should be returned from the query ExpectedPodCount int // WaitTimeout the amount of time to wait for the pods to be in the 'RUNNING' state WaitTimeout time.Duration }