containerprofile

package
v0.3.197 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPreStopCacheSize is the default maximum number of containers to track
	DefaultPreStopCacheSize = 1000
	// DefaultPreStopCacheTTL is the default time-to-live for cache entries
	DefaultPreStopCacheTTL = 5 * time.Minute
)

Variables

This section is empty.

Functions

func AP deprecated

AP returns the deprecated "ap.*" backward-compat alias namespace for this library's cp.* functions (e.g. ap.was_executed, ap.was_path_opened, ...).

Deprecated: kubescape/node-agent#864 renamed the ap.*/nn.* CEL helper namespaces to cp.* with no backward-compatible aliases, which silently disabled any pre-existing user-authored CEL rule still referencing the old names (pkg/utils/cel.go logs a warning and just skips the rule on compile failure). AP restores those names for a transition window: it shares the same containerProfileLibrary instance and the same funcSpecs table as cp.*, so every ap.* call is wired to the exact same Go implementation (l.wasExecuted, l.wasPathOpened, ...) as its cp.* equivalent — only the CEL-facing function name and overload id differ (cel-go requires overload ids to be unique per environment, so ap.* can't literally reuse cp.*'s FunctionOpt values). Remove once user rules have migrated to cp.*.

func CP

Types

type PreStopHookCache

type PreStopHookCache struct {
	// contains filtered or unexported fields
}

PreStopHookCache tracks which containers have had their preStop hook triggered. It uses an LRU cache with time-based expiration to automatically clean up old entries and limit memory usage.

func GetPreStopHookCache

func GetPreStopHookCache() *PreStopHookCache

GetPreStopHookCache returns the global preStop hook cache singleton. The cache is lazily initialized with default settings on first call.

func NewPreStopHookCache

func NewPreStopHookCache(maxSize int, ttl time.Duration) *PreStopHookCache

NewPreStopHookCache creates a new preStop hook cache with the specified maximum size and TTL duration.

func (*PreStopHookCache) Len

func (c *PreStopHookCache) Len() int

Len returns the current number of entries in the cache.

func (*PreStopHookCache) MarkPreStopTriggered

func (c *PreStopHookCache) MarkPreStopTriggered(containerID string)

MarkPreStopTriggered marks that the preStop hook was triggered for the given container ID. The entry will automatically expire after the cache's TTL duration.

func (*PreStopHookCache) Remove

func (c *PreStopHookCache) Remove(containerID string)

Remove removes a container ID from the cache.

func (*PreStopHookCache) WasPreStopTriggered

func (c *PreStopHookCache) WasPreStopTriggered(containerID string) bool

WasPreStopTriggered returns true if the preStop hook was triggered for the given container ID and the entry has not yet expired.

Jump to

Keyboard shortcuts

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