Repository navigation
feat(dpv2policy): add Dataplane V2 network policy log feature - #1259
Merged
Merged
Conversation
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
November 12, 2026 01:46
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements GKE Dataplane V2 network policy log inspection tasks under the new googlecloud/dpv2policy package, allowing policy-action logs to be parsed and mapped to Pod, network policy, and Node timelines. It also updates the general k8snode query to exclude these logs. The reviewer feedback recommends removing a redundant defensive nil check on the required reader parameter in ExtractPolicyAction to align with project guidelines, as well as removing the corresponding test case that would otherwise panic.
kyasbal
force-pushed
the
push-ustqwvvvkroy
branch
from
November 12, 2026 07:00
bd98d6b to
d9e1330
Compare
Add a dedicated inspection feature for GKE Dataplane V2 network policy logs (logs/policy-action of the k8s_node resource type). Each log is linked to the outbound and inbound network policy timelines of its source and destination Pods, to the NetworkPolicy, FQDNNetworkPolicy and ClusterNetworkPolicy resources that decided the connection, and to the reporting Node when neither endpoint is a Pod. Policy resources are resolved by the UID recorded in the Cilium policy labels when audit logs know it, and by known API versions otherwise. The summary shows each policy rule once even when Cilium lists it more than once. Exclude policy-action logs from the Kubernetes node log query because they have no message field and were shown with empty summaries under the node timelines.
kyasbal
force-pushed
the
push-ustqwvvvkroy
branch
from
November 17, 2026 05:24
d9e1330 to
b12e2b3
Compare
Code Quality Report — ✅ Cloud Build
|
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.
Summary
Adds a dedicated Dataplane V2 Network Policy Logs feature that visualizes GKE Dataplane V2 network policy logs (
logs/policy-actionof thek8s_noderesource type) on the timelines of the source and destination Pods and the network policies that decided each connection.This is the first PR of a stack that adds GKE Dataplane V2 (Cilium / anetd) log support:
dpv2policy, a new feature for policy-action logs (excluded fromk8snode)k8snode: link cilium-cni logs in the container runtime log to Podsk8scontainer: enrich cilium-agent logs with subsystem, level and Pod referencesk8saudit: show CiliumEndpoint under the owning Pod timelineMotivation
policy-actionlogs were fetched by the Kubernetes node log query, but they have noMESSAGEfield. They showed up with empty summaries underNode/<node>/policy-actionand were not linked to the Pods or the policies involved.Changes
pkg/task/inspection/googlecloud/dpv2policy/: contract (task IDs, extractor, log type, timeline types and paths) andimpl/(query, ingester, grouper, mapper, module), with README en/ja.resource.type="k8s_node"andLOG_ID("policy-action"). The shared node name filter also applies.[DENY x6] ingress TCP <ns>/<pod>:<port> -> <ns>/<pod>:<port> (implicit deny),(by NetworkPolicy <ns>/<name>),(by ClusterNetworkPolicy <name>, reserved:deny-any-ingress). A rule that Cilium lists more than once is shown once. Denials use theWARNINGseverity so that dropped connections stand out.outboundtimeline (typenetpol) under the source Pod and theinboundtimeline under the destination Pod. Remote Pods without workload fields are still linked by namespace and name.NetworkPolicy,FQDNNetworkPolicyandClusterNetworkPolicyresource. Resources are resolved first by the UID in the Cilium policy labels (viak8saudit.ResourceUIDInventoryTaskID), then by known API versions.policy-actiontimeline under the reporting Node only when neither endpoint is a Pod.k8snode: excludedLOG_ID("policy-action")from the node log query..khicompatibility concerns: no new enums, and timeline type styles are serialized in each.khifile.Screenshots
Verified against network policy logs generated on a GKE Autopilot cluster with Dataplane V2 and network policy logging enabled (3,121 policy-action logs: 19 denials and 3,102 allowed connections).
Verification
make pre-commitmake build-go && make lint-go && make test-go(including the task graph conformance tests for every inspection type)