cel(network): peer-selector matching for egress/ingress (rebase of #62) - #90
Open
ConstanzeTU wants to merge 1 commit into
Open
cel(network): peer-selector matching for egress/ingress (rebase of #62)#90ConstanzeTU wants to merge 1 commit into
ConstanzeTU wants to merge 1 commit into
Conversation
…tor_in_*)
Port of the celnetwork feature onto the alias-restructured CEL library:
the projection carries each network-neighbor entry's podSelector and
namespaceSelector (IngressPeers/EgressPeers), and the new
cp.was_selector_in_{egress,ingress} helpers match a runtime peer by the
namespace and pod labels the kubeipresolver enrichment stamps onto the
event - stable across pod IP churn and across nodes. Selector matching
follows NetworkPolicyPeer semantics: a nil namespaceSelector matches only
the profiled workload's own namespace, an unresolved peer is detected by
the empty resolved namespace, and an empty podSelector selects all pods
in the namespace. The functions register under cp.* and the nn.* legacy
alias; the golden projection corpus pins the peer surface.
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.
Rebase of the celnetwork feature (#62, previously merged to mirrormain) onto the current main.
What it adds
cp.was_selector_in_{egress,ingress}CEL helpers: match a runtime network peer by the namespace + pod labels that the kubeipresolver enrichment stamps onto the event — identity-based matching that survives pod IP churn and works across nodes.podSelector/namespaceSelector(IngressPeers/EgressPeers); the golden projection corpus pins this surface.cp.*and thenn.*backward-compat alias (feat(cel): restore ap./nn. namespace aliases for backward compatibility kubescape/node-agent#901) automatically.Semantics (NetworkPolicyPeer-aligned, differs from the mirrormain version)
namespaceSelectormatches only the profiled workload's own namespace — the learned generator omits the selector exactly for same-namespace peers; treating nil as any-namespace allowed a label-matching pod in a foreign namespace to suppress the alert (cross-namespace false negative).podSelectorinstead of alerting on its own learned traffic.Validation
selector_test.gopins the namespace semantics (incl. the foreign-namespace rejection),selector_compile_test.gopins registration; golden corpus regenerated with peer-carrying fixtures.