Skip to content

Commit 5f2254d

Browse files
committed
Adjust kernel capabilities when ebpf mgr is in use
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
1 parent 5ddfb11 commit 5f2254d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

controllers/ebpf/internal/permissions/permissions.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ import (
1919
"sigs.k8s.io/controller-runtime/pkg/log"
2020
)
2121

22+
// AllowedCapabilities description of what capabilities netobserv requires when running w/o ebpf manager
23+
// BPF: Allows netobserv to use eBPF programs and maps.
24+
// PERFMON: Allows access to perf monitoring and profiling features.
25+
// NET_ADMIN: required for TC programs to attach/detach to/from qdisc and for TCX hooks.
26+
// SYS_RESOURCE: allows a process to override resource limits and manage system-wide resource usage.
2227
var AllowedCapabilities = []v1.Capability{"BPF", "PERFMON", "NET_ADMIN", "SYS_RESOURCE"}
2328

2429
// Reconciler reconciles the different resources to enable the privileged operation of the
@@ -164,6 +169,10 @@ func (c *Reconciler) reconcileOpenshiftPermissions(
164169
if desired.Privileged {
165170
scc.AllowPrivilegedContainer = true
166171
scc.AllowHostDirVolumePlugin = true
172+
scc.ReadOnlyRootFilesystem = true
173+
if helper.IsAgentFeatureEnabled(desired, flowslatest.EbpfManager) {
174+
scc.RequiredDropCapabilities = []v1.Capability{"ALL"}
175+
}
167176
} else {
168177
scc.AllowedCapabilities = AllowedCapabilities
169178
}

0 commit comments

Comments
 (0)