option

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package option provides global singletons for storing configuration and variables used in Tetragon.

Index

Constants

View Source
const (
	KeyConfigDir              = "config-dir"
	KeyDebug                  = "debug"
	KeyHubbleLib              = "bpf-lib"
	KeyBTF                    = "btf"
	KeyProcFS                 = "procfs"
	KeyKernelVersion          = "kernel"
	KeyVerifierLogLevel       = "verifier-log-level"
	KeyVerbosity              = "verbose"
	KeyProcessCacheSize       = "process-cache-size"
	KeyDisableProcessCache    = "disable-process-cache"
	KeyDataCacheSize          = "data-cache-size"
	KeyDeletedPodCacheSize    = "deleted-pod-cache-size"
	KeyProcessCacheGCInterval = "process-cache-gc-interval"
	KeyForceSmallProgs        = "force-small-progs"
	KeyForceLargeProgs        = "force-large-progs"
	KeyClusterName            = "cluster-name"

	KeyLogLevel  = "log-level"
	KeyLogFormat = "log-format"
	KeyLogFile   = "log-file"

	KeyEnableK8sAPI         = "enable-k8s-api"
	KeyK8sKubeConfigPath    = "k8s-kubeconfig-path"
	KeyK8sControlPlaneRetry = "k8s-controlplane-retry"

	KeyEnablePodAnnotations = "enable-pod-annotations"

	KeyMetricsServer      = "metrics-server"
	KeyEnableEventMetrics = "enable-event-metrics"
	KeyMetricsLabelFilter = "metrics-label-filter"
	KeyServerAddress      = "server-address"
	KeyGopsAddr           = "gops-address"

	KeyEnableProcessEnvironmentVariables = "enable-process-environment-variables"

	KeyFilterEnvironmentVariables = "filter-environment-variables"

	KeyEnableAncestors   = "enable-ancestors"
	KeyEnableProcessCred = "enable-process-cred"
	KeyEnableProcessNs   = "enable-process-ns"
	KeyTracingPolicy     = "tracing-policy"
	KeyTracingPolicyDir  = "tracing-policy-dir"

	KeyCpuProfile = "cpuprofile"
	KeyMemProfile = "memprofile"
	KeyPprofAddr  = "pprof-address"

	KeyExportFilename             = "export-filename"
	KeyExportFileMaxSizeMB        = "export-file-max-size-mb"
	KeyExportFileRotationInterval = "export-file-rotation-interval"
	KeyExportFileMaxBackups       = "export-file-max-backups"
	KeyExportFileCompress         = "export-file-compress"
	KeyExportRateLimit            = "export-rate-limit"
	KeyExportFilePerm             = "export-file-perm"

	KeyEnableExportAggregation     = "enable-export-aggregation"
	KeyExportAggregationWindowSize = "export-aggregation-window-size"
	KeyExportAggregationBufferSize = "export-aggregation-buffer-size"

	KeyExportAllowlist = "export-allowlist"
	KeyExportDenylist  = "export-denylist"

	KeyFieldFilters     = "field-filters"
	KeyRedactionFilters = "redaction-filters"

	KeyNetnsDir = "netns-dir"

	KeyDisableKprobeMulti = "disable-kprobe-multi"
	KeyDisableUprobeMulti = "disable-uprobe-multi"

	KeySleepablePreloadSize = "sleepable-preload-size"
	KeySleepableOffloadSize = "sleepable-offload-size"

	KeyUprobeHeapSize = "uprobe-heap-size"

	KeyFentryHeapSize = "fentry-heap-size"

	KeyLsmHeapSize = "lsm-heap-size"

	KeyUsePerfRingBuffer = "use-perf-ring-buffer"
	KeyRBSize            = "rb-size"
	KeyRBSizeTotal       = "rb-size-total"
	KeyRBQueueSize       = "rb-queue-size"

	KeyEventQueueSize = "event-queue-size"

	KeyReleasePinnedBPF = "release-pinned-bpf"

	KeyEnablePolicyFilter          = "enable-policy-filter"
	KeyEnablePolicyFilterCgroupMap = "enable-policy-filter-cgroup-map"
	KeyEnablePolicyFilterDebug     = "enable-policy-filter-debug"

	KeyEnablePidSetFilter = "enable-pid-set-filter"

	KeyEnableMsgHandlingLatency = "enable-msg-handling-latency"

	KeyEnablePodInfo          = "enable-pod-info"
	KeyEnableTracingPolicyCRD = "enable-tracing-policy-crd"

	KeyExposeStackAddresses = "expose-stack-addresses"

	KeyGenerateDocs = "generate-docs"

	KeyCgroupRate = "cgroup-rate"

	KeyUsernameMetadata = "username-metadata"

	KeyHealthServerAddress = "health-server-address"
	KeyHealthTimeInterval  = "health-server-interval"

	KeyBpfDir = "bpf-dir"

	KeyKeepSensorsOnExit      = "keep-sensors-on-exit"
	KeyPersistGRPCPolicies    = "persist-grpc-policies"
	KeyPersistGRPCPoliciesDir = "persist-grpc-policies-dir"

	KeyEnableCRI   = "enable-cri"
	KeyCRIEndpoint = "cri-endpoint"

	KeyEnableCgIDmap      = "enable-cgidmap"
	KeyEnableCgIDmapDebug = "enable-cgidmap-debug"
	KeyEnableCgTrackerID  = "enable-cgtrackerid"

	KeyEventCacheRetries    = "event-cache-retries"
	KeyEventCacheRetryDelay = "event-cache-retry-delay"

	KeyExecveMapEntries    = "execve-map-entries"
	KeyExecveMapSize       = "execve-map-size"
	KeyExecveMapNoPrealloc = "execve-map-no-prealloc"

	KeyParentsMapEnabled = "parents-map-enabled"
	KeyParentsMapEntries = "parents-map-entries"
	KeyParentsMapSize    = "parents-map-size"

	KeyRetprobesCacheSize = "retprobes-cache-size"

	KeyEnableDeprecatedTPGRPC = "enable-deprecated-tracingpolicy-grpc"

	// gRPC server TLS / mTLS flags.
	KeyServerTLSCertFile          = "server-tls-cert-file"
	KeyServerTLSKeyFile           = "server-tls-key-file"
	KeyServerTLSClientCAFiles     = "server-tls-client-ca-files"
	KeyServerTLSRequireClientCert = "server-tls-require-client-cert"

	KeyBpfDebugArea = "bpf-debug-area"
	KeyBpfDebugLog  = "bpf-debug-log"
)
View Source
const (
	VerifierLogLevelHelp = "set eBPF verifier log level. Pass 0 for silent, 1 for truncated logs, 2 for a full dump"
)

Variables

View Source
var (

	// Config contains all the configuration used by Tetragon.
	Config = config{

		ProcFS: "/proc",

		LogOpts: make(map[string]string),

		MetricsLabelFilter: DefaultLabelFilter(),

		EventCacheNumRetries: defaults.DefaultEventCacheNumRetries,
		EventCacheRetryDelay: defaults.DefaultEventCacheRetryDelay,

		RetprobesCacheSize: defaults.DefaultRetprobesCacheSize,

		SleepablePreloadSize: defaults.DefaultSleepablePreloadSize,

		SleepableOffloadSize: defaults.DefaultSleepableOffloadSize,

		UprobeHeapSize: defaults.DefaultUprobeHeapSize,

		FentryHeapSize: defaults.DefaultFentryHeapSize,

		LsmHeapSize: defaults.DefaultLsmHeapSize,

		DeletedPodCacheSize: constants.WatcherDeletedPodCacheSize,

		BPFDebugAreas: NewBPFDbgEnum(map[string]uint8{
			"generic":   1 << 0,
			"process":   1 << 1,
			"uprobe_so": 1 << 2,
		}),
	}
)

Functions

func AddFlags added in v1.0.0

func AddFlags(flags *pflag.FlagSet)

func AncestorsEnabled added in v1.5.0

func AncestorsEnabled(eventType tetragon.EventType) bool

AncestorsEnabled returns the value of the configuration option responsible for enabling process ancestors for events with the specified eventType. If events with the specified eventType don't support ancestors, false is returned.

func CgroupRateEnabled added in v1.2.0

func CgroupRateEnabled() bool

func CreateProcessLabels added in v1.1.0

func CreateProcessLabels(namespace, workload, pod, binary, nodeName string) *metrics.ProcessLabels

CreateProcessLabels creates a new ProcessLabels struct with the global labels filter applied. To have a metric respect the labels filter, we have to:

  1. Define a granular metric with ProcessLabels type parameter (see pkg/metrics/granularmetric.go).
  2. When calling WithLabelValues, pass a ProcessLabels struct created with CreateProcessLabels.

func DefaultLabelFilter added in v1.1.0

func DefaultLabelFilter() metrics.LabelFilter

func InClusterControlPlaneEnabled added in v1.6.0

func InClusterControlPlaneEnabled() bool

func K8SControlPlaneEnabled added in v1.6.0

func K8SControlPlaneEnabled() bool

func ParseMetricsLabelFilter added in v1.0.0

func ParseMetricsLabelFilter(labelsString string) []string

func ReadAndSetFlags added in v1.0.0

func ReadAndSetFlags() error

func ReadConfigDir added in v0.11.0

func ReadConfigDir(path string) error

func ReadConfigFile added in v0.11.0

func ReadConfigFile(path string, file string) error

func ReadDirConfig

func ReadDirConfig(dirName string) (map[string]any, error)

ReadDirConfig reads the given directory and returns a map that maps the filename to the contents of that file.

func ValidateHeapSize added in v1.8.0

func ValidateHeapSize(name string, size int) error

ValidateHeapSize checks that a heap size is positive and fits in the uint32 map capacity field.

Types

type BPFDbgEnum added in v1.8.0

type BPFDbgEnum struct {
	*SliceEnum
	// contains filtered or unexported fields
}

func NewBPFDbgEnum added in v1.8.0

func NewBPFDbgEnum(allowedMap map[string]uint8) *BPFDbgEnum

func (*BPFDbgEnum) ToBPFConfig added in v1.8.0

func (e *BPFDbgEnum) ToBPFConfig() uint8

type CgroupRate added in v1.2.0

type CgroupRate struct {
	Events   uint64
	Interval uint64
}

func ParseCgroupRate added in v1.2.0

func ParseCgroupRate(rate string) CgroupRate

type Enum added in v1.8.0

type Enum struct {
	Value string
	// contains filtered or unexported fields
}

func NewEnum added in v1.8.0

func NewEnum(allowed []string, d string) (*Enum, error)

func (*Enum) Allowed added in v1.8.0

func (e *Enum) Allowed() string

func (*Enum) Set added in v1.8.0

func (e *Enum) Set(p string) error

func (*Enum) String added in v1.8.0

func (e *Enum) String() string

func (*Enum) Type added in v1.8.0

func (e *Enum) Type() string

type SliceEnum added in v1.8.0

type SliceEnum struct {
	Values []string
	// contains filtered or unexported fields
}

func NewSliceEnum added in v1.8.0

func NewSliceEnum(allowed []string, d []string) (*SliceEnum, error)

func (*SliceEnum) Allowed added in v1.8.0

func (e *SliceEnum) Allowed() string

func (*SliceEnum) Set added in v1.8.0

func (e *SliceEnum) Set(p string) error

func (*SliceEnum) String added in v1.8.0

func (e *SliceEnum) String() string

func (*SliceEnum) Type added in v1.8.0

func (e *SliceEnum) Type() string

type UsernameMetadaCode added in v1.1.1

type UsernameMetadaCode int
const (
	// Username metadata collection modes
	USERNAME_METADATA_DISABLED UsernameMetadaCode = iota
	USERNAME_METADATA_UNIX     UsernameMetadaCode = 1 // Username from /etc/passwd
)

func (UsernameMetadaCode) String added in v1.1.1

func (op UsernameMetadaCode) String() string

Jump to

Keyboard shortcuts

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