gadgets

package
v0.27.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TraceName

func TraceName(namespace, name string) string

func TraceNameFromNamespacedName

func TraceNameFromNamespacedName(n k8sTypes.NamespacedName) string

Types

type BaseFactory

type BaseFactory struct {
	Helpers GadgetHelpers
	Client  client.Client

	// DeleteTrace is optionally set by gadgets if they need to do
	// specialised clean up. Example:
	//
	// func NewFactory() gadgets.TraceFactory {
	// 	return &TraceFactory{
	// 		BaseFactory: gadgets.BaseFactory{DeleteTrace: deleteTrace},
	// 	}
	// }
	DeleteTrace func(name string, trace interface{})
	// contains filtered or unexported fields
}

func (*BaseFactory) Delete

func (f *BaseFactory) Delete(name string)

func (*BaseFactory) Initialize

func (f *BaseFactory) Initialize(r GadgetHelpers, c client.Client)

func (*BaseFactory) Lookup added in v0.11.0

func (f *BaseFactory) Lookup(name string) (interface{}, error)

func (*BaseFactory) LookupOrCreate

func (f *BaseFactory) LookupOrCreate(name string, newTrace func() interface{}) interface{}

func (*BaseFactory) Operations

func (f *BaseFactory) Operations() map[gadgetv1alpha1.Operation]TraceOperation

func (*BaseFactory) OutputModesSupported

func (f *BaseFactory) OutputModesSupported() map[gadgetv1alpha1.TraceOutputMode]struct{}

type GadgetHelpers

type GadgetHelpers interface {
	containercollection.ContainerResolver
	gadgets.DataEnricherByMntNs
	gadgets.DataEnricherByNetNs
	gadgets.DataNodeEnricher

	PublishEvent(tracerID string, line string) error
	TracerMountNsMap(tracerID string) (*ebpf.Map, error)
	ContainersMap() *ebpf.Map
}

GadgetHelpers provides different functions that are used in the gadgets implementation.

type TraceFactory

type TraceFactory interface {
	// Initialize gives the Helpers and the Client to the gadget. Gadgets
	// don't need to implement this method if they use BaseFactory as an
	// anonymous field.
	Initialize(Helpers GadgetHelpers, Client client.Client)

	// Delete request a gadget to release the information it has about a
	// trace. BaseFactory implements this method, so gadgets who embed
	// BaseFactory don't need to implement it.
	Delete(name string)

	// Operations gives the list of operations on a gadget that users can
	// call via the gadget.kinvolk.io/operation annotation.
	Operations() map[gadgetv1alpha1.Operation]TraceOperation

	// OutputModesSupported returns the set of OutputMode supported by the
	// gadget.
	OutputModesSupported() map[gadgetv1alpha1.TraceOutputMode]struct{}
}

type TraceFactoryWithDocumentation

type TraceFactoryWithDocumentation interface {
	Description() string
}

type TraceFactoryWithScheme

type TraceFactoryWithScheme interface {
	TraceFactory

	// AddToScheme let gadgets inform the Trace controller of any scheme
	// they want to use
	AddToScheme(*apimachineryruntime.Scheme)
}

type TraceOperation

type TraceOperation struct {
	// Operation is the function called by the controller
	Operation func(name string, trace *gadgetv1alpha1.Trace)

	// Doc documents the operation. It is used to generate the
	// documentation.
	Doc string

	// Order controls the ordering of the operation in the documentation.
	// It's only needed when ordering alphabetically is not suitable.
	Order int
}

TraceOperation packages an operation on a gadget that users can call via the annotation gadget.kinvolk.io/operation.

Directories

Path Synopsis
advise
audit
cpu
snapshot
top
tcp
dns
sni
tcp

Jump to

Keyboard shortcuts

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