streamer

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package streamer ... TODO: write this!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Streamer

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

Streamer represents the actor that streams data onto a POD, running on Kubernetes. It does so via `kubectl exec` to run `tar` on target container, and it redirects stdin to upload the local data.

func NewStreamer

func NewStreamer(restConfig *rest.Config, clientset kubernetes.Interface) *Streamer

NewStreamer instantiate Streamer.

func (*Streamer) Done

func (s *Streamer) Done(target *Target) error

Done uses "kubectl exec" to run an command on target container, notifying the upload is done.

func (*Streamer) Stream

func (s *Streamer) Stream(target *Target, writerFn WriterFn, size int) error

Stream the data onto the informed target, and it uses the BaseDir as the path to store the data on the running POD. The writerFn is employed to expose the writer interface to callers.

type Tar

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

Tar helper to create a tar instance based on a source directory, skipping entries that are not desired like `.git` directory and entries in `.gitignore` file.

func NewTar

func NewTar(src string) (*Tar, error)

NewTar instantiate a tar helper based on the source directory path informed.

func (*Tar) Create

func (t *Tar) Create(w io.Writer) error

Create the actual tar by inspecting all files in source path, skipping some.

func (*Tar) Size added in v0.12.0

func (t *Tar) Size() (int, error)

Size returns the size in bytes that a call of Create would write into the io.Writer

Note: This performs a whote walk through of the source directory and can be an expensive operation.

type Target

type Target struct {
	Namespace string // kubernetes namespace
	Pod       string // pod name
	Container string // container name
	BaseDir   string // base directory to store streamed data
}

Target represents the target POD to receive streamed data.

func (*Target) IsEmpty

func (t *Target) IsEmpty() bool

type WriterFn

type WriterFn func(w io.Writer) error

WriterFn exposes the writer interface, receives the data to be streamed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL