Documentation
¶
Overview ¶
Package capture contains functions related to handling Retina/Capture.
Index ¶
- Constants
- Variables
- func TestContext(t *testing.T) (context.Context, context.CancelFunc)
- type CaptureJobNumExceedLimitError
- type CaptureManager
- type CaptureTarget
- type CaptureTargetsOnNode
- type CaptureToPodTranslator
- func (translator *CaptureToPodTranslator) CalculateCaptureTargetsOnNode(ctx context.Context, captureTarget retinav1alpha1.CaptureTarget, ...) (*CaptureTargetsOnNode, error)
- func (translator *CaptureToPodTranslator) ObtainCaptureJobPodEnv(capture retinav1alpha1.Capture) (map[string]string, error)
- func (translator *CaptureToPodTranslator) TranslateCaptureToJobs(ctx context.Context, capture *retinav1alpha1.Capture) ([]*batchv1.Job, error)
- type SecretNotFoundError
Constants ¶
const DefaultHostPathBaseDir = "/var/log/retina/captures"
DefaultHostPathBaseDir is the safe default location under which Capture CRs may place captured artifacts on a node when no operator-level base directory is configured.
Variables ¶
var ( // ErrHostPathEmpty is returned when the supplied HostPath is empty. ErrHostPathEmpty = errors.New("hostPath is empty") // ErrHostPathAbsolute is returned when the supplied HostPath is absolute. The // CR field is a subpath name only; it must not contain a leading separator // (POSIX or Windows) or a drive-letter prefix. ErrHostPathAbsolute = errors.New("hostPath must be a relative subpath name, not an absolute path") // ErrHostPathTraversal is returned when the supplied HostPath contains a parent-directory traversal. ErrHostPathTraversal = errors.New("hostPath must not contain '..' path segments") // ErrHostPathEscapesBase is a defense-in-depth error returned when, after // joining and cleaning, the resulting path would lie outside the configured base directory. ErrHostPathEscapesBase = errors.New("hostPath resolves outside the configured base directory") // ErrHostPathBaseDir is returned when the operator-provided base directory is not usable. ErrHostPathBaseDir = errors.New("invalid hostPath base directory") )
Functions ¶
func TestContext ¶ added in v0.0.26
Types ¶
type CaptureJobNumExceedLimitError ¶
func (CaptureJobNumExceedLimitError) Error ¶
func (err CaptureJobNumExceedLimitError) Error() string
type CaptureManager ¶
type CaptureManager struct {
// contains filtered or unexported fields
}
CaptureManager captures network packets and metadata into tar ball, then send the tar ball to the location(s) specified by users.
func NewCaptureManager ¶
func NewCaptureManager(logger *log.ZapLogger, tel telemetry.Telemetry) *CaptureManager
func (*CaptureManager) CaptureNetwork ¶
func (cm *CaptureManager) CaptureNetwork(ctx context.Context) (string, error)
func (*CaptureManager) Cleanup ¶
func (cm *CaptureManager) Cleanup() error
func (*CaptureManager) OutputCapture ¶
func (cm *CaptureManager) OutputCapture(ctx context.Context, srcDir string) error
type CaptureTarget ¶
type CaptureTarget struct {
// PodIpAddresses indicates the capture is performed on the Pods per their IP addresses.
PodIpAddresses []string
// CaptureNodeInterface indicates the capture is performed on the host node interface.
CaptureNodeInterface bool
// OS indicates the operating system of the node hosting the target.
OS string
}
CaptureTarget indicates on which the network capture will be performed on a given node.
type CaptureTargetsOnNode ¶
type CaptureTargetsOnNode map[string]CaptureTarget
CaptureTargetsOnNode maps nodes to the targets network capture will be performed. On each node, the network capture can be done on either Pod hosted in the node, or the node interface itself. When multiple nodes are selected per capture configuration, there'll be multiple jobs created per node.
func (CaptureTargetsOnNode) AddNodeInterface ¶
func (cton CaptureTargetsOnNode) AddNodeInterface(hostname string)
func (CaptureTargetsOnNode) AddPod ¶
func (cton CaptureTargetsOnNode) AddPod(hostname string, ipAddresses []string)
func (CaptureTargetsOnNode) UpdateNodeOS ¶
func (cton CaptureTargetsOnNode) UpdateNodeOS(hostname string, os string)
type CaptureToPodTranslator ¶
type CaptureToPodTranslator struct {
// Apiserver is unique identifier to identify the cluster in the trace capture.
Apiserver string
// contains filtered or unexported fields
}
CaptureToPodTranslator translate the Capture object to a Job.
func NewCaptureToPodTranslator ¶
func NewCaptureToPodTranslator(kubeClient kubernetes.Interface, logger *log.ZapLogger, config config.CaptureConfig) *CaptureToPodTranslator
NewCaptureToPodTranslator initializes a CaptureToPodTranslator.
func (*CaptureToPodTranslator) CalculateCaptureTargetsOnNode ¶
func (translator *CaptureToPodTranslator) CalculateCaptureTargetsOnNode(ctx context.Context, captureTarget retinav1alpha1.CaptureTarget, namespace string) (*CaptureTargetsOnNode, error)
CalculateCaptureTargetsOnNode returns capture target on each node.
func (*CaptureToPodTranslator) ObtainCaptureJobPodEnv ¶
func (translator *CaptureToPodTranslator) ObtainCaptureJobPodEnv(capture retinav1alpha1.Capture) (map[string]string, error)
ObtainCaptureJobPodEnv translates Capture object to Environment variables to capture job Pod.
func (*CaptureToPodTranslator) TranslateCaptureToJobs ¶
func (translator *CaptureToPodTranslator) TranslateCaptureToJobs(ctx context.Context, capture *retinav1alpha1.Capture) ([]*batchv1.Job, error)
type SecretNotFoundError ¶
func (SecretNotFoundError) Error ¶
func (err SecretNotFoundError) Error() string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
managed
managed package provides the functionality to manage the output locations for the Capture.
|
managed package provides the functionality to manage the output locations for the Capture. |
|
Package provider is a generated GoMock package.
|
Package provider is a generated GoMock package. |