Repository navigation
feat: eBPF readiness gate + ebpf-profile capabilities (ADR 0011, slice 2) - #27
Merged
Merged
Conversation
…e 2) Gate the node role's eBPF profile on the kernel before any profiler exists, and give the ebpf install profile its capabilities — without privileged. - internal/ebpfgate: Probe(procRoot, sysRoot) reads the kernel version from <procRoot>/sys/kernel/osrelease and BTF from <sysRoot>/kernel/btf/vmlinux, returning a Result with a low-cardinality Reason. Reasons are split (kernel_too_old / btf_absent / kernel_unknown / supported) so fleet counts show why nodes declined; version dominates BTF so a RHEL-backport kernel (BTF present, < 5.8) is visibly refused on version. Table tests cover the matrix incl. the RHEL and precedence cases. - cmd/agent/node.go: -enable-ebpf master switch + -sys root. When set, the node evaluates the gate once at startup, logs a clear ready/refused line, and records a per-reason in-process counter (surfaced to the report stream when the profiler ships). A refusal degrades to scanner-only — never an escalation to privileged, never a node failure. The gate logs only kernel version + BTF, nothing derived from a workload. - deploy/node-daemonset-ebpf.yaml: the ebpf-profile variant — adds exactly CAP_BPF + CAP_PERFMON and a read-only /sys/kernel/btf mount and the -enable-ebpf switch, keeping drop:[ALL], privileged:false, and zero RBAC. - deploy/node-daemonset.yaml: correct the absolute "no eBPF capabilities" comments to be variant-dependent. No profiler, no capture, no new data leaves the cluster in this slice. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Slice 2 of the eBPF node-profiling feature (plan, ADR 0011). Gates the node's
ebpfprofile on the kernel and grants its capabilities — before any profiler exists, so slice 3 just plugs in.What it does
internal/ebpfgate.Probe(procRoot, sysRoot)— kernel version from<procRoot>/sys/kernel/osrelease, BTF from<sysRoot>/kernel/btf/vmlinux; returns aResult{Reason, KernelVersion, Major, Minor, BTFPresent}.supported/kernel_too_old/btf_absent/kernel_unknown— so fleet counts show why nodes declined (constraint b). Version dominates BTF, so a RHEL-backport kernel (BTF present but < 5.8) is visibly refused on version — exactly what we'd relax first for a RHEL customer.-enable-ebpfmaster switch (+-sysroot) inrunNode: evaluates the gate once at startup, logs a clear ready/refused line, records a per-reason in-process counter (surfaced to the report stream when the profiler ships — slice 6). A refusal degrades to scanner-only — never an escalation toprivileged, never a node failure.deploy/node-daemonset-ebpf.yaml— theebpf-profile variant: adds exactlyCAP_BPF+CAP_PERFMONand one read-only/sys/kernel/btfmount and-enable-ebpf, keepingdrop:[ALL],privileged:false, and the zero-RBAC identity. Alternative to the scanner manifest, not additive.deploy/node-daemonset.yaml— the absolute "no eBPF capabilities" comments are now variant-dependent.Guarantees / invariants held
privileged. Verified: base caps[SYS_PTRACE], ebpf caps[SYS_PTRACE, BPF, PERFMON], bothprivileged:false.-enable-ebpfon an unsupported kernel still runs the scanner to completion and returns nil.Tests
internal/ebpfgate: table over5.4 / 5.7 / 5.8 / 5.15 / 6.8 / 4.18-rhel / malformed / missing× BTF present/absent, plus precedence andparseKernelVersion.cmd/agent: gate supported/refused (counter + log asserts) and the refusal-doesn't-stop-the-node guard.go test -race ./...andgolangci-lintclean.Not in this slice
The profiler library + reporter (slice 3), symbol filtering (4), validation+spool (5), targeting (6), e2e (7).
🤖 Generated with Claude Code