streamer

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 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 int64) 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 {
	Size int64
	// 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 GetTarSize added in v0.12.0

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

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.

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