Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETOBSERV-1910: Add packet drop filtering API #790

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apis/flowcollector/v1beta1/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ type EBPFFlowFilter struct {
// ICMPCode defines the ICMP code to filter flows by.
// +optional
ICMPCode *int `json:"icmpCode,omitempty"`

// `pktDrops`, to filter flows with packet drops
// +optional
PktDrops *bool `json:"pktDrops,omitempty"`
}

// `FlowCollectorEBPF` defines a FlowCollector that uses eBPF to collect the flows information
Expand Down
2 changes: 2 additions & 0 deletions apis/flowcollector/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions apis/flowcollector/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions apis/flowcollector/v1beta2/flowcollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ type EBPFFlowFilter struct {
// `icmpType`, for ICMP traffic, defines the ICMP type to filter flows by.
// +optional
ICMPType *int `json:"icmpType,omitempty"`

// `pktDrops`, to filter flows with packet drops
// +optional
PktDrops *bool `json:"pktDrops,omitempty"`
}

// `FlowCollectorEBPF` defines a FlowCollector that uses eBPF to collect the flows information
Expand Down
5 changes: 5 additions & 0 deletions apis/flowcollector/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions bundle/manifests/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ spec:
PeerIP defines the IP address to filter flows by.
Example: 10.10.10.10
type: string
pktDrops:
description: '`pktDrops`, to filter flows with packet
drops'
type: boolean
ports:
anyOf:
- type: integer
Expand Down Expand Up @@ -3792,6 +3796,10 @@ spec:
`peerIP` defines the IP address to filter flows by.
Example: `10.10.10.10`.
type: string
pktDrops:
description: '`pktDrops`, to filter flows with packet
drops'
type: boolean
ports:
anyOf:
- type: integer
Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/flows.netobserv.io_flowcollectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ spec:
PeerIP defines the IP address to filter flows by.
Example: 10.10.10.10
type: string
pktDrops:
description: '`pktDrops`, to filter flows with packet drops'
type: boolean
ports:
anyOf:
- type: integer
Expand Down Expand Up @@ -3499,6 +3502,9 @@ spec:
`peerIP` defines the IP address to filter flows by.
Example: `10.10.10.10`.
type: string
pktDrops:
description: '`pktDrops`, to filter flows with packet drops'
type: boolean
ports:
anyOf:
- type: integer
Expand Down
4 changes: 4 additions & 0 deletions controllers/ebpf/agent_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const (
envFilterICMPCode = "FILTER_ICMP_CODE"
envFilterPeerIPAddress = "FILTER_PEER_IP"
envFilterTCPFlags = "FILTER_TCP_FLAGS"
envFilterPktDrops = "FILTER_DROPS"
envListSeparator = ","
)

Expand Down Expand Up @@ -573,6 +574,9 @@ func (c *AgentController) configureFlowFilter(filter *flowslatest.EBPFFlowFilter
})
}

if filter.PktDrops != nil && *filter.PktDrops {
config = append(config, corev1.EnvVar{Name: envFilterPktDrops, Value: "true"})
}
return config
}

Expand Down
14 changes: 14 additions & 0 deletions docs/FlowCollector.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,13 @@ To filter two ports, use a "port1,port2" in string format. For example, `ports:
Example: 10.10.10.10<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>pktDrops</b></td>
<td>boolean</td>
<td>
`pktDrops`, to filter flows with packet drops<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>ports</b></td>
<td>int or string</td>
Expand Down Expand Up @@ -7911,6 +7918,13 @@ To filter two ports, use a "port1,port2" in string format. For example, `ports:
Example: `10.10.10.10`.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>pktDrops</b></td>
<td>boolean</td>
<td>
`pktDrops`, to filter flows with packet drops<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>ports</b></td>
<td>int or string</td>
Expand Down
Loading