Skip to content

Commit e831a4f

Browse files
committed
WIP: UDN mappnig PoC
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
1 parent bfda0ff commit e831a4f

File tree

11 files changed

+58
-5
lines changed

11 files changed

+58
-5
lines changed

apis/flowcollector/v1beta1/flowcollector_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ type FlowCollectorIPFIX struct {
154154
// - `NetworkEvents`, to track Network events.<br>
155155
// - `PacketTranslation`, to enrich flows with packets translation information. <br>
156156
// - `EbpfManager`, to enable using EBPF Manager to manage netobserv ebpf programs [Developer Preview].<br>
157-
// +kubebuilder:validation:Enum:="PacketDrop";"DNSTracking";"FlowRTT";"NetworkEvents";"PacketTranslation";"EbpfManager"
157+
// - `UDNMapping`, to enable interfaces mappind to udn. <br>
158+
// +kubebuilder:validation:Enum:="PacketDrop";"DNSTracking";"FlowRTT";"NetworkEvents";"PacketTranslation";"EbpfManager";"UDNMapping"
158159
type AgentFeature string
159160

160161
const (
@@ -164,6 +165,7 @@ const (
164165
NetworkEvents AgentFeature = "NetworkEvents"
165166
PacketTranslation AgentFeature = "PacketTranslation"
166167
EbpfManager AgentFeature = "EbpfManager"
168+
UDNMapping AgentFeature = "UDNMapping"
167169
)
168170

169171
// Name of an eBPF agent alert.
@@ -358,6 +360,7 @@ type FlowCollectorEBPF struct {
358360
// the kernel debug filesystem, so the eBPF pod has to run as privileged.
359361
// - `PacketTranslation`: enable enriching flows with packet's translation information. <br>
360362
// - `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
363+
// - `UDNMapping`, to enable interfaces mappind to udn. <br>
361364
// +optional
362365
Features []AgentFeature `json:"features,omitempty"`
363366

apis/flowcollector/v1beta2/flowcollector_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ type FlowCollectorIPFIX struct {
177177
// - `NetworkEvents`, to track Network events [Developer Preview].<br>
178178
// - `PacketTranslation`, to enrich flows with packets translation information. <br>
179179
// - `EbpfManager`, to enable using EBPF Manager to manage netobserv ebpf programs [Developer Preview].<br>
180-
// +kubebuilder:validation:Enum:="PacketDrop";"DNSTracking";"FlowRTT";"NetworkEvents";"PacketTranslation";"EbpfManager"
180+
// - `UDNMapping`, to enable interfaces mappind to udn. <br>
181+
// +kubebuilder:validation:Enum:="PacketDrop";"DNSTracking";"FlowRTT";"NetworkEvents";"PacketTranslation";"EbpfManager";"UDNMapping"
181182
type AgentFeature string
182183

183184
const (
@@ -187,6 +188,7 @@ const (
187188
NetworkEvents AgentFeature = "NetworkEvents"
188189
PacketTranslation AgentFeature = "PacketTranslation"
189190
EbpfManager AgentFeature = "EbpfManager"
191+
UDNMapping AgentFeature = "UDNMapping"
190192
)
191193

192194
// Name of an eBPF agent alert.
@@ -384,6 +386,7 @@ type FlowCollectorEBPF struct {
384386
// - `PacketTranslation`: enable enriching flows with packet's translation information. <br>
385387
// - `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
386388
// IMPORTANT: This feature is available as a Developer Preview.<br>
389+
// - `UDNMapping`, to enable interfaces mappind to udn. <br>
387390
// +optional
388391
Features []AgentFeature `json:"features,omitempty"`
389392

apis/flowcollector/v1beta2/flowcollector_validation_webhook.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ func (r *FlowCollector) validateAgent(_ context.Context, fc *FlowCollector) (adm
105105
if slices.Contains(fc.Spec.Agent.EBPF.Features, EbpfManager) && !fc.Spec.Agent.EBPF.Privileged {
106106
warnings = append(warnings, "The BPF Manager feature requires eBPF Agent to run in privileged mode")
107107
}
108+
if slices.Contains(fc.Spec.Agent.EBPF.Features, UDNMapping) && !fc.Spec.Agent.EBPF.Privileged {
109+
warnings = append(warnings, "The UDNMapping feature requires eBPF Agent to run in privileged mode")
110+
}
108111
var errs []error
109112
if fc.Spec.Agent.EBPF.FlowFilter != nil && fc.Spec.Agent.EBPF.FlowFilter.Enable != nil && *fc.Spec.Agent.EBPF.FlowFilter.Enable {
110113
m := make(map[string]bool)

bundle/manifests/flows.netobserv.io_flowcollectors.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ spec:
137137
the kernel debug filesystem, so the eBPF pod has to run as privileged.
138138
- `PacketTranslation`: enable enriching flows with packet's translation information. <br>
139139
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
140+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
140141
items:
141142
description: |-
142143
Agent feature, can be one of:<br>
@@ -146,13 +147,15 @@ spec:
146147
- `NetworkEvents`, to track Network events.<br>
147148
- `PacketTranslation`, to enrich flows with packets translation information. <br>
148149
- `EbpfManager`, to enable using EBPF Manager to manage netobserv ebpf programs [Developer Preview].<br>
150+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
149151
enum:
150152
- PacketDrop
151153
- DNSTracking
152154
- FlowRTT
153155
- NetworkEvents
154156
- PacketTranslation
155157
- EbpfManager
158+
- UDNMapping
156159
type: string
157160
type: array
158161
flowFilter:
@@ -3949,6 +3952,7 @@ spec:
39493952
- `PacketTranslation`: enable enriching flows with packet's translation information. <br>
39503953
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
39513954
IMPORTANT: This feature is available as a Developer Preview.<br>
3955+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
39523956
items:
39533957
description: |-
39543958
Agent feature, can be one of:<br>
@@ -3958,13 +3962,15 @@ spec:
39583962
- `NetworkEvents`, to track Network events [Developer Preview].<br>
39593963
- `PacketTranslation`, to enrich flows with packets translation information. <br>
39603964
- `EbpfManager`, to enable using EBPF Manager to manage netobserv ebpf programs [Developer Preview].<br>
3965+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
39613966
enum:
39623967
- PacketDrop
39633968
- DNSTracking
39643969
- FlowRTT
39653970
- NetworkEvents
39663971
- PacketTranslation
39673972
- EbpfManager
3973+
- UDNMapping
39683974
type: string
39693975
type: array
39703976
flowFilter:

config/crd/bases/flows.netobserv.io_flowcollectors.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ spec:
122122
the kernel debug filesystem, so the eBPF pod has to run as privileged.
123123
- `PacketTranslation`: enable enriching flows with packet's translation information. <br>
124124
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
125+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
125126
items:
126127
description: |-
127128
Agent feature, can be one of:<br>
@@ -131,13 +132,15 @@ spec:
131132
- `NetworkEvents`, to track Network events.<br>
132133
- `PacketTranslation`, to enrich flows with packets translation information. <br>
133134
- `EbpfManager`, to enable using EBPF Manager to manage netobserv ebpf programs [Developer Preview].<br>
135+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
134136
enum:
135137
- PacketDrop
136138
- DNSTracking
137139
- FlowRTT
138140
- NetworkEvents
139141
- PacketTranslation
140142
- EbpfManager
143+
- UDNMapping
141144
type: string
142145
type: array
143146
flowFilter:
@@ -3631,6 +3634,7 @@ spec:
36313634
- `PacketTranslation`: enable enriching flows with packet's translation information. <br>
36323635
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
36333636
IMPORTANT: This feature is available as a Developer Preview.<br>
3637+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
36343638
items:
36353639
description: |-
36363640
Agent feature, can be one of:<br>
@@ -3640,13 +3644,15 @@ spec:
36403644
- `NetworkEvents`, to track Network events [Developer Preview].<br>
36413645
- `PacketTranslation`, to enrich flows with packets translation information. <br>
36423646
- `EbpfManager`, to enable using EBPF Manager to manage netobserv ebpf programs [Developer Preview].<br>
3647+
- `UDNMapping`, to enable interfaces mappind to udn. <br>
36433648
enum:
36443649
- PacketDrop
36453650
- DNSTracking
36463651
- FlowRTT
36473652
- NetworkEvents
36483653
- PacketTranslation
36493654
- EbpfManager
3655+
- UDNMapping
36503656
type: string
36513657
type: array
36523658
flowFilter:

config/samples/flows_v1beta2_flowcollector.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ spec:
2525
# - "NetworkEvents"
2626
# - "PacketTranslation"
2727
# - "EbpfManager"
28+
# - "UDNMapping"
2829
interfaces: []
2930
excludeInterfaces: ["lo"]
3031
kafkaBatchSize: 1048576

controllers/consoleplugin/config/static-frontend-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,13 @@ columns:
437437
filter: ifdirections
438438
default: false
439439
width: 10
440+
- id: Udns
441+
name: interface assigned UDN label
442+
field: Udns
443+
filter: udns
444+
default: true
445+
width: 10
446+
feature: udnMapping
440447
- id: FlowDirInts
441448
name: Interfaces and Directions
442449
tooltip: Pairs of network interface and direction of the Flow observed at the network interface observation point.
@@ -952,6 +959,8 @@ filters:
952959
component: autocomplete
953960
placeholder: 'E.g: Ingress, Egress'
954961
hint: Specify the direction of the Flow observed at the network interface observation point.
962+
- id: udns
963+
name: interface assigned udn label
955964
- id: id
956965
name: Conversation Id
957966
component: text
@@ -1273,6 +1282,9 @@ fields:
12731282
- name: Interfaces
12741283
type: string
12751284
description: Network interfaces
1285+
- name: Udns
1286+
type: string
1287+
description: Network interfaces UDNs mapping
12761288
- name: Flags
12771289
type: string
12781290
description: |

controllers/consoleplugin/consoleplugin_objects.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ func (b *builder) setFrontendConfig(fconf *cfg.FrontendConfig) error {
462462
fconf.Features = append(fconf.Features, "packetTranslation")
463463
}
464464

465+
if helper.IsUDNMappingEnabled(&b.desired.Agent.EBPF) {
466+
fconf.Features = append(fconf.Features, "udnMapping")
467+
}
468+
465469
if b.desired.Agent.EBPF.Advanced != nil {
466470
if v, ok := b.desired.Agent.EBPF.Advanced.Env[ebpf.EnvDedupeJustMark]; ok {
467471
dedupJustMark, err = strconv.ParseBool(v)

controllers/ebpf/agent_controller.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const (
6969
envFilterRules = "FLOW_FILTER_RULES"
7070
envEnablePacketTranslation = "ENABLE_PKT_TRANSLATION"
7171
envEnableEbpfMgr = "EBPF_PROGRAM_MANAGER_MODE"
72+
envEnableUDNMapping = "ENABLE_UDN_MAPPING"
7273
envListSeparator = ","
7374
)
7475

@@ -319,7 +320,8 @@ func (c *AgentController) desired(ctx context.Context, coll *flowslatest.FlowCol
319320
}
320321
}
321322

322-
if helper.IsAgentFeatureEnabled(&coll.Spec.Agent.EBPF, flowslatest.NetworkEvents) {
323+
if helper.IsAgentFeatureEnabled(&coll.Spec.Agent.EBPF, flowslatest.NetworkEvents) ||
324+
helper.IsAgentFeatureEnabled(&coll.Spec.Agent.EBPF, flowslatest.UDNMapping) {
323325
if !coll.Spec.Agent.EBPF.Privileged {
324326
rlog.Error(fmt.Errorf("invalid configuration"), "To use Network Events Monitor"+
325327
"features privileged mode needs to be enabled")
@@ -699,6 +701,13 @@ func (c *AgentController) setEnvConfig(coll *flowslatest.FlowCollector) []corev1
699701
})
700702
}
701703

704+
if helper.IsUDNMappingEnabled(&coll.Spec.Agent.EBPF) {
705+
config = append(config, corev1.EnvVar{
706+
Name: envEnableUDNMapping,
707+
Value: "true",
708+
})
709+
}
710+
702711
if helper.IsPacketTranslationEnabled(&coll.Spec.Agent.EBPF) {
703712
config = append(config, corev1.EnvVar{
704713
Name: envEnablePacketTranslation,

docs/FlowCollector.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ If the `spec.agent.ebpf.privileged` parameter is not set, an error is reported.<
293293
- `NetworkEvents`: enable the Network events monitoring feature. This feature requires mounting
294294
the kernel debug filesystem, so the eBPF pod has to run as privileged.
295295
- `PacketTranslation`: enable enriching flows with packet's translation information. <br>
296-
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br><br/>
296+
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
297+
- `UDNMapping`, to enable interfaces mappind to udn. <br><br/>
297298
</td>
298299
<td>false</td>
299300
</tr><tr>
@@ -6265,7 +6266,8 @@ It requires using the OVN-Kubernetes network plugin with the Observability featu
62656266
IMPORTANT: This feature is available as a Developer Preview.<br>
62666267
- `PacketTranslation`: enable enriching flows with packet's translation information. <br>
62676268
- `EbpfManager`: allow using eBPF manager to manage netobserv ebpf programs. <br>
6268-
IMPORTANT: This feature is available as a Developer Preview.<br><br/>
6269+
IMPORTANT: This feature is available as a Developer Preview.<br>
6270+
- `UDNMapping`, to enable interfaces mappind to udn. <br><br/>
62696271
</td>
62706272
<td>false</td>
62716273
</tr><tr>

0 commit comments

Comments
 (0)