Documentation
¶
Index ¶
- Constants
- Variables
- func GetClientset() (*kubernetes.Clientset, error)
- func NewCommand(kubeClient kubernetes.Interface) *cobra.Command
- func NewCreateSubCommand(kubeClient kubernetes.Interface) *cobra.Command
- func NewDeleteSubCommand(kubeClient kubernetes.Interface) *cobra.Command
- func NewDownloadSubCommand() *cobra.Command
- func NewListSubCommand() *cobra.Command
- type DownloadCmd
- type DownloadService
- type Key
- type NodeOS
- type Opts
- type PrintDataFormat
- type TimestampFormat
- type VerbosityLevel
Constants ¶
View Source
const ( DefaultCleanUpAfterUpload bool = false DefaultDebug bool = false DefaultDuration time.Duration = 1 * time.Minute // DefaultHostPath is the default subpath (joined under DefaultHostPathBaseDir on // the node) where capture artifacts are stored. It is a bare name, not an // absolute path: absolute paths are rejected by the operator. DefaultHostPath string = "retina" // DefaultHostPathBaseDir is the default node-side parent directory for capture // artifacts; the user-supplied --host-path subpath is joined under it. DefaultHostPathBaseDir string = "/var/log/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 // JobTTLSecondsAfterFinished is how long completed/failed jobs and their // pods are kept before Kubernetes garbage-collects them (no-wait mode). JobTTLSecondsAfterFinished int32 = 300 // 5 minutes // JobActiveDeadlineBufferSeconds is added to the capture duration to form // the Job's activeDeadlineSeconds. This buffer accounts for output upload // and cleanup time after the capture itself finishes. JobActiveDeadlineBufferSeconds int64 = 1800 // 30 minutes // WaitDeadlineBuffer is extra time added to the capture duration when // computing the wait deadline, to account for upload and scheduling overhead. WaitDeadlineBuffer time.Duration = 5 * time.Minute // MinPollAttempts is the minimum number of polling iterations before the // wait deadline expires. Used to compute a fallback poll period. MinPollAttempts = 4 )
View Source
const ( LinuxOS = 0 WindowsOS = 1 )
View Source
const DefaultName = "retina-capture"
View Source
const (
DefaultOutputPath = "./"
)
Variables ¶
View Source
var ( ErrInvalidVerbosityLevel = errors.New("invalid verbosity level") ErrInvalidTimestampFormat = errors.New("invalid timestamp format") ErrInvalidPrintDataFormat = errors.New("invalid print data format") ErrBPFFilterEmpty = errors.New("BPF filter cannot be empty or whitespace-only") ErrBPFFilterContainsFlag = errors.New("BPF filter contains flag which is not allowed") )
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 NewListSubCommand ¶ added in v1.0.0
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 NodeOS ¶ added in v1.0.0
type NodeOS *int
NodeOS represents the operating system of a Kubernetes node
type Opts ¶ added in v1.0.0
type Opts struct {
genericclioptions.ConfigFlags
Name *string
// contains filtered or unexported fields
}
type PrintDataFormat ¶ added in v1.2.1
type PrintDataFormat string
PrintDataFormat represents the format for printing packet data
const ( PrintDataNone PrintDataFormat = "" // Default, no data printing PrintDataHex PrintDataFormat = "hex" // tcpdump -x (hex only) PrintDataHexWithLink PrintDataFormat = "hex-with-link" // tcpdump -xx (hex with link header) PrintDataASCII PrintDataFormat = "ascii" // tcpdump -A (ASCII only) PrintDataASCIIWithLink PrintDataFormat = "ascii-with-link" // tcpdump -AA (ASCII with link header) )
func (PrintDataFormat) Validate ¶ added in v1.2.1
func (p PrintDataFormat) Validate() error
type TimestampFormat ¶ added in v1.2.1
type TimestampFormat string
TimestampFormat represents the timestamp format for packet capture output
const ( TimestampDefault TimestampFormat = "" // Default formatted timestamp TimestampNone TimestampFormat = "none" // tcpdump -t TimestampUnformatted TimestampFormat = "unformatted" // tcpdump -tt (Unix epoch) TimestampDelta TimestampFormat = "delta" // tcpdump -ttt (delta between packets) TimestampDate TimestampFormat = "date" // tcpdump -tttt (with date) TimestampDeltaSinceFirst TimestampFormat = "delta-since-first" // tcpdump -ttttt (delta since first) )
func (TimestampFormat) Validate ¶ added in v1.2.1
func (t TimestampFormat) Validate() error
type VerbosityLevel ¶ added in v1.2.1
type VerbosityLevel string
VerbosityLevel represents the verbosity level for packet capture output
const ( VerbosityNormal VerbosityLevel = "" // Default, no extra verbosity VerbosityVerbose VerbosityLevel = "verbose" // tcpdump -v VerbosityExtra VerbosityLevel = "extra" // tcpdump -vv VerbosityMax VerbosityLevel = "max" // tcpdump -vvv )
func (VerbosityLevel) Validate ¶ added in v1.2.1
func (v VerbosityLevel) Validate() error
Click to show internal directories.
Click to hide internal directories.