capture

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 44 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultDebug           bool          = false
	DefaultDuration        time.Duration = 1 * time.Minute
	DefaultHostPath        string        = "/mnt/retina/captures"
	DefaultIncludeMetadata bool          = true
	DefaultJobNumLimit     int           = 0
	DefaultMaxSize         int           = 100
	DefaultNodeSelectors   string        = "kubernetes.io/os=linux"
	DefaultNowait          bool          = true
	DefaultPacketSize      int           = 0
	DefaultS3Path          string        = "retina/captures"
	DefaultWaitPeriod      time.Duration = 1 * time.Minute
	DefaultWaitTimeout     time.Duration = 5 * time.Minute
)
View Source
const (
	LinuxOS   = 0
	WindowsOS = 1
)
View Source
const DefaultName = "retina-capture"
View Source
const (
	DefaultOutputPath = "./"
)

Variables

View Source
var (
	ErrCreateDirectory    = errors.New("failed to create directory")
	ErrGetNodeInfo        = errors.New("failed to get node information")
	ErrWriteFileToHost    = errors.New("failed to write file to host")
	ErrObtainPodList      = errors.New("failed to obtain list of pods")
	ErrExecFileDownload   = errors.New("failed to exec file download in container")
	ErrCreateDownloadPod  = errors.New("failed to create download pod")
	ErrGetDownloadPod     = errors.New("failed to get download pod")
	ErrCheckFileExistence = errors.New("failed to check file existence")
	ErrCreateExecutor     = errors.New("failed to create executor")
	ErrExecCommand        = errors.New("failed to exec command")
	ErrCreateOutputDir    = errors.New("failed to create output directory")
	ErrNoBlobsFound       = errors.New("no blobs found with prefix")
)
View Source
var (
	ErrNoPodFound                = errors.New("no pod found for job")
	ErrManyPodsFound             = errors.New("more than one pod found for job; expected exactly one")
	ErrCaptureContainerNotFound  = errors.New("capture container not found in pod")
	ErrFileNotAccessible         = errors.New("file does not exist or is not readable")
	ErrEmptyDownloadOutput       = errors.New("download command produced no output")
	ErrFailedToCreateDownloadPod = errors.New("failed to create download pod")
	ErrUnsupportedNodeOS         = errors.New("unsupported node operating system")
	ErrMissingRequiredFlags      = errors.New("either --name, --blob-url, or --all must be specified")
	ErrAllNamespacesRequiresAll  = errors.New("--all-namespaces flag can only be used with --all flag")
)

Functions

func GetClientset added in v1.0.0

func GetClientset() (*kubernetes.Clientset, error)

func NewCommand added in v1.0.0

func NewCommand(kubeClient kubernetes.Interface) *cobra.Command

func NewCreateSubCommand added in v1.0.0

func NewCreateSubCommand(kubeClient kubernetes.Interface) *cobra.Command

func NewDeleteSubCommand added in v1.0.0

func NewDeleteSubCommand(kubeClient kubernetes.Interface) *cobra.Command

func NewDownloadSubCommand added in v1.0.0

func NewDownloadSubCommand() *cobra.Command

func NewListSubCommand added in v1.0.0

func NewListSubCommand() *cobra.Command

Types

type DownloadCmd added in v1.0.0

type DownloadCmd struct {
	ContainerImage   string
	SrcFilePath      string
	MountPath        string
	KeepAliveCommand []string
	FileCheckCommand []string
	FileReadCommand  []string
}

DownloadCmd holds all OS-specific commands and configurations

type DownloadService added in v1.0.0

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

DownloadService encapsulates the download functionality and shared dependencies

func NewDownloadService added in v1.0.0

func NewDownloadService(kubeClient kubernetes.Interface, config *rest.Config, namespace string) *DownloadService

NewDownloadService creates a new download service with shared dependencies

func (*DownloadService) DownloadFile added in v1.0.0

func (ds *DownloadService) DownloadFile(ctx context.Context, nodeName, hostPath, fileName, captureName string) error

DownloadFile downloads a capture file from a specific node

func (*DownloadService) DownloadFileContent added in v1.0.0

func (ds *DownloadService) DownloadFileContent(ctx context.Context, nodeName, hostPath, fileName, captureName string) ([]byte, error)

DownloadFileContent downloads a capture file from a specific node and returns the content

type Key added in v1.0.0

type Key struct {
	Name      string
	Namespace string
}

Key represents a unique capture identifier

type NodeOS added in v1.0.0

type NodeOS *int

NodeOS represents the operating system of a Kubernetes node

var (
	Linux   NodeOS = &[]int{LinuxOS}[0]
	Windows NodeOS = &[]int{WindowsOS}[0]
)

type Opts added in v1.0.0

type Opts struct {
	genericclioptions.ConfigFlags
	Name *string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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