Skip to content
This repository was archived by the owner on Feb 9, 2026. It is now read-only.

Rename l4/l7 related controls#194

Draft
corest wants to merge 3 commits into
masterfrom
l7-dissection-control
Draft

Rename l4/l7 related controls#194
corest wants to merge 3 commits into
masterfrom
l7-dissection-control

Conversation

@corest

@corest corest commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the tracer’s configuration semantics to rename and invert the “capture stopped” flag into an explicit “capture enabled” flag, aligning the Go-side config parsing with the BPF-side flag check.

Changes:

  • Renamed config-map keys related to capture/dissection controls (e.g., STOPPEDDISSECTION_ENABLED, RAW_CAPTURERAW_CAPTURE_ENABLED).
  • Renamed/inverted the configuration bit from CONFIGURATION_FLAG_CAPTURE_STOPPED to CONFIGURATION_FLAG_CAPTURE_ENABLED.
  • Updated BPF program_disabled() logic to disable programs when capture is not enabled.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
pkg/kubernetes/config.go Renames config keys and computes the new “capture enabled” bit from config-map values.
bpf/include/maps.h Renames the BPF configuration flag macro to CONFIGURATION_FLAG_CAPTURE_ENABLED.
bpf/common.c Updates program gating to use the new “capture enabled” flag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/kubernetes/config.go Outdated
Comment on lines 40 to 50
var dissectionEnabled bool
var rawCaptureEnabled bool
if dissectionEnabled, err = strconv.ParseBool(configMap.Data[CONFIG_DISSECTION_ENABLED]); err != nil {
log.Error().Err(err).Str("config", CONFIG_DISSECTION_ENABLED).Send()
}
if rawCapture, err = strconv.ParseBool(configMap.Data[CONFIG_RAW_CAPTURE]); err != nil {
log.Error().Err(err).Str("config", CONFIG_RAW_CAPTURE).Send()
if rawCaptureEnabled, err = strconv.ParseBool(configMap.Data[CONFIG_RAW_CAPTURE_ENABLED]); err != nil {
log.Error().Err(err).Str("config", CONFIG_RAW_CAPTURE_ENABLED).Send()
}
if stopped && !rawCapture {
settings |= CONFIGURATION_FLAG_CAPTURE_STOPPED
if dissectionEnabled || rawCaptureEnabled {
settings |= CONFIGURATION_FLAG_CAPTURE_ENABLED
}

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.

SyncConfig now only sets CONFIGURATION_FLAG_CAPTURE_ENABLED when DISSECTION_ENABLED or RAW_CAPTURE_ENABLED parses to true. If these keys are missing (or empty), ParseBool returns an error and leaves both booleans false, which disables capture by default and can also spam logs on every config sync. Consider treating missing/empty values as a non-error and applying a safe default (e.g., dissection enabled by default), only logging when a value is present but invalid.

Copilot uses AI. Check for mistakes.
Comment thread pkg/kubernetes/config.go
Comment on lines +16 to 22
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"
)

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.
Comment thread bpf/common.c
Comment on lines +175 to 177
if (s && !(s->flags & CONFIGURATION_FLAG_CAPTURE_ENABLED)) {
return 1;
}

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

Copilot AI commented Feb 8, 2026

Copy link
Copy Markdown

@corest I've opened a new pull request, #195, to work on those changes. Once the pull request is ready, I'll request review from you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants