@@ -74,27 +74,27 @@ const (
7474 envDNSTrackingPort = "DNS_TRACKING_PORT"
7575 envPreferredInterface = "PREFERRED_INTERFACE_FOR_MAC_PREFIX"
7676 envAttachMode = "TC_ATTACH_MODE"
77+ envOVNObservHostMountPath = "OVN_OBSERV_HOST_MOUNT_PATH"
7778 envListSeparator = ","
7879)
7980
8081const (
81- exportKafka = "kafka"
82- exportGRPC = "grpc"
83- kafkaCerts = "kafka-certs"
84- averageMessageSize = 100
85- bpfTraceMountName = "bpf-kernel-debug"
86- bpfTraceMountPath = "/sys/kernel/debug"
87- bpfNetNSMountName = "var-run-netns"
88- bpfNetNSMountPath = "/var/run/netns"
89- droppedFlowsAlertThreshold = 100
90- ovnObservMountName = "var-run-ovn"
91- ovnObservMountPath = "/var/run/ovn"
92- ovnObservHostMountPath = "/var/run/ovn-ic"
93- ovsMountPath = "/var/run/openvswitch"
94- ovsHostMountPath = "/var/run/openvswitch"
95- ovsMountName = "var-run-ovs"
96- defaultNetworkEventsGroupID = "10"
97- defaultPreferredInterface = "0a:58=eth0" // Hard-coded default config to deal with OVN-generated MACs
82+ exportKafka = "kafka"
83+ exportGRPC = "grpc"
84+ averageMessageSize = 100
85+ bpfTraceMountName = "bpf-kernel-debug"
86+ bpfTraceMountPath = "/sys/kernel/debug"
87+ bpfNetNSMountName = "var-run-netns"
88+ bpfNetNSMountPath = "/var/run/netns"
89+ droppedFlowsAlertThreshold = 100
90+ ovnObservMountName = "var-run-ovn"
91+ ovnObservMountPath = "/var/run/ovn"
92+ ovnObservHostMountPathOpenShift = "/var/run/ovn-ic"
93+ ovsMountPath = "/var/run/openvswitch"
94+ ovsHostMountPath = "/var/run/openvswitch"
95+ ovsMountName = "var-run-ovs"
96+ defaultNetworkEventsGroupID = "10"
97+ defaultPreferredInterface = "0a:58=eth0" // Hard-coded default config to deal with OVN-generated MACs
9898)
9999
100100const (
@@ -221,6 +221,7 @@ func (c *AgentController) desired(ctx context.Context, coll *flowslatest.FlowCol
221221 if err != nil {
222222 return nil , err
223223 }
224+ advancedConfig := helper .GetAdvancedAgentConfig (coll .Spec .Agent .EBPF .Advanced )
224225
225226 if coll .Spec .Agent .EBPF .Metrics .Server .TLS .Type != flowslatest .ServerTLSDisabled {
226227 var promTLS * flowslatest.CertificateReference
@@ -300,15 +301,22 @@ func (c *AgentController) desired(ctx context.Context, coll *flowslatest.FlowCol
300301 if coll .Spec .Agent .EBPF .IsAgentFeatureEnabled (flowslatest .NetworkEvents ) ||
301302 coll .Spec .Agent .EBPF .IsAgentFeatureEnabled (flowslatest .UDNMapping ) {
302303 if ! coll .Spec .Agent .EBPF .Privileged {
303- rlog .Error (fmt .Errorf ("invalid configuration" ), "To use Network Events Monitor" +
304- "features privileged mode needs to be enabled" )
304+ rlog .Error (fmt .Errorf ("invalid configuration" ), "To use NetworkEvents or UDNMapping features, privileged mode needs to be enabled" )
305305 } else {
306+ hostPath := advancedConfig .Env [envOVNObservHostMountPath ]
307+ if hostPath == "" {
308+ if c .ClusterInfo .IsOpenShift () {
309+ hostPath = ovnObservHostMountPathOpenShift
310+ } else {
311+ hostPath = ovsHostMountPath
312+ }
313+ }
306314 volume := corev1.Volume {
307315 Name : ovnObservMountName ,
308316 VolumeSource : corev1.VolumeSource {
309317 HostPath : & corev1.HostPathVolumeSource {
310318 Type : newHostPathType (corev1 .HostPathDirectory ),
311- Path : ovnObservHostMountPath ,
319+ Path : hostPath ,
312320 },
313321 },
314322 }
@@ -361,8 +369,6 @@ func (c *AgentController) desired(ctx context.Context, coll *flowslatest.FlowCol
361369 volumeMounts = append (volumeMounts , volumeMount )
362370 }
363371
364- advancedConfig := helper .GetAdvancedAgentConfig (coll .Spec .Agent .EBPF .Advanced )
365-
366372 return & v1.DaemonSet {
367373 ObjectMeta : metav1.ObjectMeta {
368374 Name : constants .EBPFAgentName ,
0 commit comments