fix: pod IP deletion leak, namespace filtering, and configurable filter map size#2112
Closed
aanchal22 wants to merge 2 commits intomicrosoft:mainfrom
Closed
fix: pod IP deletion leak, namespace filtering, and configurable filter map size#2112aanchal22 wants to merge 2 commits intomicrosoft:mainfrom
aanchal22 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Fixes a critical issue causing metrics collection failures Pod IPs were leaking in the eBPF filtermap due to metadata mismatch between ADD and DELETE operations. Metadata flags (pod/namespace) were re-evaluated at DELETE time instead of using values from ADD time, causing mismatches in: - IP reuse (tracked → untracked namespace) - Namespace filter changes after pod add - Annotation changes between add and delete **Solution:** Track which metadata was used during ADD and use the same metadata during DELETE, regardless of state changes. Namespace exclude filtering was broken, causing no metrics collection or eBPF map exhaustion Problems: - appendExcludeList() was empty (not implemented) - updateNamespaceLists() used sequential ifs instead of if/else - nsOfInterest() had incorrect default behavior - No protection against spurious DELETE events **Solution:** Implement namespace filtering. - Add metadataTrackingInfo struct to track metadata per IP - Record pod/namespace metadata after successful AddIPs - Use tracked metadata (not current flags) during DeleteIPs - Implement appendExcludeList() with proper initial setup - Fix updateNamespaceLists() if/else logic - Fix nsOfInterest() default to return true when no filtering - Add DELETE event protection (check cache before deleting) - Add GetAllNamespaces() to cache interface - Add warning logs for deleteIP failures - Eliminates memory leak (refcount reaches zero) - Fixes namespace exclude filtering - Handles IP reuse correctly - No breaking changes - Minimal overhead (~24 bytes per tracked IP) Signed off by: Aanchal Khandelwal (akhandelwal@adobe.com)
The retina_filter eBPF map had its max_entries hardcoded in the C source. This makes it configurable at runtime by overriding MapSpec.MaxEntries before loading the map into the kernel. Configurable via: - Helm values.yaml: filterMapMaxEntries: 15000 - Environment variable: RETINA_FILTERMAXMAPENTRIES=15000 - Default: 255 Files changed: - pkg/config/config.go: Added FilterMapMaxEntries field - pkg/plugin/filter/filter_map_linux.go: Init() accepts maxEntries param - pkg/plugin/filter/filter_map_windows.go: Updated signature to match - pkg/bpf/setup_linux.go: Thread filterMapMaxEntries to filter.Init() - init/retina/main_linux.go: Pass config value to bpf.Setup() - pkg/managers/filtermanager/manager_linux.go: Thread filterMapMaxEntries - pkg/managers/filtermanager/manager_windows.go: Updated signature to match - pkg/watchers/apiserver/apiserver.go: Updated filtermanager.Init() call - cmd/standard/daemon.go: Pass config value to filtermanager.Init() - deploy/standard/.../retina/values.yaml: Added default - deploy/standard/.../retina/templates/configmap.yaml: Added template line - adobe/ethos-core-retina/chart/values.yaml: Adobe override (15000) - Test files: Updated call signatures Signed off by: Aanchal Khandelwal (akhandelwal@adobe.com)
Contributor
Author
|
@microsoft-github-policy-service agree company="Adobe" |
nddq
requested changes
Mar 14, 2026
Member
nddq
left a comment
There was a problem hiding this comment.
@aanchal22 This PR is trying address too many things at once. We should break this PR down into at least 2 smaller ones according to the description.
Contributor
Author
Going to close this PR as I have created 2 separate PRs as suggested - #2117 & #2116 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes critical bugs in namespace exclude filtering and pod IP tracking, and adds configurability for the eBPF filter map size.
Fix: Pod IP Deletion Leak and Namespace Filtering (#2085)
Pod IPs were leaking in the eBPF filtermap because metadata flags (pod/namespace) were re-evaluated at DELETE time instead of using values recorded at ADD time. This caused mismatches during IP reuse,
namespace filter changes, and annotation changes.
Additionally, namespace exclude filtering was non-functional:
appendExcludeList()was empty (not implemented)updateNamespaceLists()used sequentialifinstead ofif/else ifnsOfInterest()had incorrect default behavior (returned false instead of true)Changes:
metadataTrackingInfostruct to track which metadata was used during ADDappendExcludeList()with proper initial setup viaGetAllNamespaces()updateNamespaceLists()if/else logic andnsOfInterest()defaultFeature: Configurable eBPF Filter Map Size
The
retina_filtereBPF mapmax_entrieswas hardcoded. This makes it configurable at runtime via Helm values or environment variable by overridingMapSpec.MaxEntriesbefore loading the map into thekernel.
Configuration options:
filterMapMaxEntries: 15000RETINA_FILTERMAXMAPENTRIES=15000Changes:
FilterMapMaxEntriesto Config struct with default of 255filter.Init()to accept and applymaxEntriesparameterbpf.Setup(),filtermanager.Init(), and callersRelated Issue
Fixes #2085
Checklist
git commit -S -s ...).Testing Completed
maxEntriesvalue via init container logs:go buildpasses for bothcontroller/main.goandinit/retina/main_linux.goAdditional Notes