Skip to content

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Oct 22, 2025

See the commit messages for details.

Fixes: #1868

VariableSpec is the only component of CollectionSpec with unexported
fields. This makes it awkward to use during testing outside of package
ebpf.

Fix this by exporting and documenting the fields of variable spec.
To achieve this, VariableSpec.Set doesn't immediately copy data into
MapSpec.Contents. Instead VariableSpec.Value holds the marshaled data.

The collection loader ensures that VariableSpec.Value is copied into
MapSpec.Contents before loading. A nice side-effect is that this ends
up creating a lot less copies of MapSpec.Contents.

Fixes: cilium#1868
Signed-off-by: Lorenz Bauer <[email protected]>
@github-actions github-actions bot added the breaking-change Changes exported API label Oct 22, 2025
Using RewriteConstants currently enforces the presence of BTF, even
though the code doesn't explicitly rely on it. Remove this restriciton.

Signed-off-by: Lorenz Bauer <[email protected]>
@lmb lmb force-pushed the variable-spec-public branch from 5791c45 to 79f1b65 Compare October 22, 2025 14:55
@lmb lmb marked this pull request as ready for review October 22, 2025 15:02
@lmb lmb requested a review from a team as a code owner October 22, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Changes exported API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow callers to create VariableSpecs

1 participant