Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bpf/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static __always_inline struct ssl_info lookup_ssl_info(struct pt_regs* ctx, void
static __always_inline int program_disabled(int program_domain) {
__u32 zero = 0;
struct configuration* s = bpf_map_lookup_elem(&settings, &zero);
if (s && (s->flags & CONFIGURATION_FLAG_CAPTURE_STOPPED)) {
if (s && !(s->flags & CONFIGURATION_FLAG_CAPTURE_ENABLED)) {
return 1;
}
Comment on lines +175 to 177

Copilot AI Feb 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

program_disabled() returns early when CAPTURE_ENABLED is not set, which means the later special-case "system always enabled" logic is bypassed whenever capture is disabled. Either move the PROGRAM_DOMAIN_CAPTURE_SYSTEM check before the CAPTURE_ENABLED gate (if system truly must always run), or adjust the comment/behavior to match the intended semantics.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot does this rename causes this or it was like that before? Current PR goal is adjusting naming for clearer understanding of what those toggles do


Expand Down
2 changes: 1 addition & 1 deletion bpf/include/maps.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct socket_cookie_data
__u8 __pad2;
};

#define CONFIGURATION_FLAG_CAPTURE_STOPPED (1 << 0)
#define CONFIGURATION_FLAG_CAPTURE_ENABLED (1 << 0)
#define CONFIGURATION_PASS_ALL_CGROUPS (1 << 1)
struct configuration
{
Expand Down
40 changes: 26 additions & 14 deletions pkg/kubernetes/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
)

const (
SUFFIX_CONFIG_MAP = "config-map"
CONFIG_POD_REGEX = "POD_REGEX"
CONFIG_NAMESPACES = "NAMESPACES"
CONFIG_STOPPED = "STOPPED"
SUFFIX_CONFIG_MAP = "config-map"
CONFIG_POD_REGEX = "POD_REGEX"
CONFIG_NAMESPACES = "NAMESPACES"
CONFIG_DISSECTION_ENABLED = "DISSECTION_ENABLED"

CONFIG_RAW_CAPTURE = "RAW_CAPTURE"
CONFIG_RAW_CAPTURE_ENABLED = "RAW_CAPTURE_ENABLED"
)
Comment on lines +16 to 22

Copilot AI Feb 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming config-map keys from STOPPED/RAW_CAPTURE to DISSECTION_ENABLED/RAW_CAPTURE_ENABLED is a breaking config schema change. If there are existing deployments/controllers still writing the old keys, this tracer will ignore them. Consider supporting both old and new keys during a deprecation window (e.g., check for the new key first, then fall back to the old key names) to avoid silent behavior changes.

Copilot uses AI. Check for mistakes.

const (
CONFIGURATION_FLAG_CAPTURE_STOPPED = 1 << 0
CONFIGURATION_FLAG_CAPTURE_ENABLED = 1 << 0
CONFIGURATION_FLAG_PASS_ALL_CGROUPS = 1 << 1
)

Expand All @@ -37,16 +37,28 @@ func SyncConfig(configMap *v1.ConfigMap) (*regexp2.Regexp, []string, uint32) {
namespaces := strings.Split(configNamespaces, ",")

var settings uint32
var stopped bool
var rawCapture bool
if stopped, err = strconv.ParseBool(configMap.Data[CONFIG_STOPPED]); err != nil {
log.Error().Err(err).Str("config", CONFIG_STOPPED).Send()
dissectionEnabled := true
rawCaptureEnabled := true
if v, ok := configMap.Data[CONFIG_DISSECTION_ENABLED]; ok && v != "" {
if parsed, err := strconv.ParseBool(v); err != nil {
log.Warn().Err(err).Str("config", CONFIG_DISSECTION_ENABLED).Msg("invalid value, defaulting to true")
} else {
dissectionEnabled = parsed
}
} else {
log.Warn().Str("config", CONFIG_DISSECTION_ENABLED).Msg("missing or empty, defaulting to true")
}
if rawCapture, err = strconv.ParseBool(configMap.Data[CONFIG_RAW_CAPTURE]); err != nil {
log.Error().Err(err).Str("config", CONFIG_RAW_CAPTURE).Send()
if v, ok := configMap.Data[CONFIG_RAW_CAPTURE_ENABLED]; ok && v != "" {
if parsed, err := strconv.ParseBool(v); err != nil {
log.Warn().Err(err).Str("config", CONFIG_RAW_CAPTURE_ENABLED).Msg("invalid value, defaulting to true")
} else {
rawCaptureEnabled = parsed
}
} else {
log.Warn().Str("config", CONFIG_RAW_CAPTURE_ENABLED).Msg("missing or empty, defaulting to true")
}
if stopped && !rawCapture {
settings |= CONFIGURATION_FLAG_CAPTURE_STOPPED
if dissectionEnabled || rawCaptureEnabled {
settings |= CONFIGURATION_FLAG_CAPTURE_ENABLED
}

return regex, namespaces, settings
Expand Down