Documentation
¶
Overview ¶
Package option provides global singletons for storing configuration and variables used in Tetragon.
Index ¶
- Constants
- Variables
- func AddFlags(flags *pflag.FlagSet)
- func AncestorsEnabled(eventType tetragon.EventType) bool
- func CgroupRateEnabled() bool
- func CreateProcessLabels(namespace, workload, pod, binary, nodeName string) *metrics.ProcessLabels
- func DefaultLabelFilter() metrics.LabelFilter
- func InClusterControlPlaneEnabled() bool
- func K8SControlPlaneEnabled() bool
- func ParseMetricsLabelFilter(labelsString string) []string
- func ReadAndSetFlags() error
- func ReadConfigDir(path string) error
- func ReadConfigFile(path string, file string) error
- func ReadDirConfig(dirName string) (map[string]any, error)
- func ValidateHeapSize(name string, size int) error
- type BPFDbgEnum
- type CgroupRate
- type Enum
- type SliceEnum
- type UsernameMetadaCode
Constants ¶
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" )
const (
VerifierLogLevelHelp = "set eBPF verifier log level. Pass 0 for silent, 1 for truncated logs, 2 for a full dump"
)
Variables ¶
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 AncestorsEnabled ¶ added in v1.5.0
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:
- Define a granular metric with ProcessLabels type parameter (see pkg/metrics/granularmetric.go).
- 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 ReadAndSetFlags ¶ added in v1.0.0
func ReadAndSetFlags() error
func ReadConfigDir ¶ added in v0.11.0
func ReadConfigFile ¶ added in v0.11.0
func ReadDirConfig ¶
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
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
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
}
type SliceEnum ¶ added in v1.8.0
type SliceEnum struct {
Values []string
// contains filtered or unexported fields
}
func NewSliceEnum ¶ added in v1.8.0
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