Documentation ¶
Index ¶
- Variables
- func DownloadFile(ctx context.Context, kubeClient client.Client, config *rest.Config, ...) error
- func ExecuteCommand(ctx context.Context, kubeClient client.Client, config *rest.Config, ...) (string, string, error)
- func ExecuteCommandOnPod(ctx context.Context, kubeClient client.Client, config *rest.Config, ...) (string, string, error)
- func ExecuteCommandRaw(ctx context.Context, kubeClient client.Client, config *rest.Config, ...) error
- func GetLogsFromPod(ctx context.Context, kubeClient client.Client, config *rest.Config, ...) (string, error)
- func PickRandomPod(pods *corev1.PodList) (*corev1.Pod, error)
- func UploadFile(ctx context.Context, kubeClient client.Client, config *rest.Config, ...) error
- type FakeExecutor
Constants ¶
This section is empty.
Variables ¶
var FakeNewSPDYExecutor = func(_ *rest.Config, method string, url *url.URL) (remotecommand.Executor, error) { return &FakeExecutor{method: method, url: url}, nil }
FakeNewSPDYExecutor can be used for unit testing. Current this will do nothing and will be extended in the future.
var NewSPDYExecutor = remotecommand.NewSPDYExecutor
NewSPDYExecutor defines the NewSPDYExecutor method used for this package. For normal code you don't have to change it. For unit testing you can set NewSPDYExecutor = FakeNewSPDYExecutor.
Functions ¶
func DownloadFile ¶
func DownloadFile( ctx context.Context, kubeClient client.Client, config *rest.Config, target *corev1.Pod, container string, src string, dst io.Writer) error
DownloadFile will download the file from the provided Pod/container into dst.
func ExecuteCommand ¶
func ExecuteCommand( ctx context.Context, kubeClient client.Client, config *rest.Config, namespace string, name string, container string, command string, printOutput bool, ) (string, string, error)
ExecuteCommand executes command in the default container of a Pod with shell, returns stdout and stderr.
func ExecuteCommandOnPod ¶
func ExecuteCommandOnPod( ctx context.Context, kubeClient client.Client, config *rest.Config, pod *corev1.Pod, container string, command string, printOutput bool, ) (string, string, error)
ExecuteCommandOnPod runs a command on the provided Pod. The command will be executed inside a bash -c ”.
func ExecuteCommandRaw ¶
func ExecuteCommandRaw( ctx context.Context, kubeClient client.Client, config *rest.Config, namespace string, name string, container string, command []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, isTty bool, ) error
ExecuteCommandRaw will run the command without putting it into a shell.
func GetLogsFromPod ¶
func GetLogsFromPod( ctx context.Context, kubeClient client.Client, config *rest.Config, pod *corev1.Pod, container string, since *int64) (string, error)
GetLogsFromPod will fetch the logs for the specified Pod and container since the provided seconds.
func PickRandomPod ¶
PickRandomPod will return a random Pod from the provided list
Types ¶
type FakeExecutor ¶
type FakeExecutor struct {
// contains filtered or unexported fields
}
FakeExecutor used for unit testing.
func (*FakeExecutor) Stream ¶
func (fakeExecutor *FakeExecutor) Stream(options remotecommand.StreamOptions) error
Stream opens a protocol streamer to the server and streams until a client closes the connection or the server disconnects.
func (*FakeExecutor) StreamWithContext ¶
func (fakeExecutor *FakeExecutor) StreamWithContext(_ context.Context, options remotecommand.StreamOptions) error
StreamWithContext opens a protocol streamer to the server and streams until a client closes the connection or the server disconnects or the context is done.