Skip to content

fix(core): deduplicate config reload namespace updates#2763

Open
rootp1 wants to merge 1 commit into
kubearmor:mainfrom
rootp1:fix/config-reload-namespace-dedup
Open

fix(core): deduplicate config reload namespace updates#2763
rootp1 wants to merge 1 commit into
kubearmor:mainfrom
rootp1:fix/config-reload-namespace-dedup

Conversation

@rootp1

@rootp1 rootp1 commented Jul 10, 2026

Copy link
Copy Markdown

Purpose of PR?:

Summary

  • deduplicate config-reload namespace updates so repeated endpoints in the same namespace do not replay the same posture and visibility work
  • take an endpoint snapshot under EndPointsLock before iterating so the config-reload path reads a stable view of dm.EndPoints
  • add focused tests for namespace deduplication and the concurrent snapshot pattern

Linked Issue

Fixes #2762

What Changed

  • replaced per-endpoint config-reload updates with per-namespace updates derived from a deduplicated endpoint snapshot
  • added uniqueEndpointNamespaces to centralize the namespace deduplication logic
  • added focused unit and race-oriented coverage for the updated path

Verification

  • make gofmt — passed
  • go test ./... — failed: Darwin host hits existing Linux-specific build errors in common/utils (unix.Mount, unix.Sysinfo_t, unix.MemfdCreate)
  • $(go env GOPATH)/bin/revive ./... — failed: repository has many pre-existing lint findings unrelated to this change
  • $(go env GOPATH)/bin/gosec -exclude=G402,G115 ./... — failed: analysis is blocked by the same Darwin/Linux type errors, though it reported Issues: 0
  • $(go env GOPATH)/bin/govulncheck ./... — failed: toolchain/package resolution requires Go 1.26 while the available toolchain tops out at the Go 1.25 compatibility layer used here
  • cd tests && make — not run: the current upstream tree does not contain tests/Makefile

Scope

  • only KubeArmor/core/unorchestratedUpdates.go and focused tests for that path were changed; unrelated files were not modified

Does this PR introduce a breaking change?

No.

If the changes in this PR are manually verified, list down the scenarios covered::

  • Not manually verified in a Linux/Kubernetes runtime in this environment.

Additional information for reviewer? :

  • This change stays within the config-reload path and intentionally avoids broader refactoring.

Checklist:

  • Bug fix. Fixes Config reload replays namespace updates once per endpoint #2762
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • PR Title follows the convention of <type>(<scope>): <subject>
  • Commit has unit tests
  • Commit has integration tests

Signed-off-by: rootp1 <arnav.iitr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config reload replays namespace updates once per endpoint

1 participant