Skip to content

Commit

Permalink
Merge pull request #21 from msherif1234/move-bytecode
Browse files Browse the repository at this point in the history
move bytecode to app common to be configured at the top level
  • Loading branch information
mergify[bot] authored Jun 6, 2024
2 parents b86d220 + 1f29e57 commit f4caa07
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 50 deletions.
8 changes: 4 additions & 4 deletions apis/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ type BpfProgramCommon struct {
// program
BpfFunctionName string `json:"bpffunctionname"`

// Bytecode configures where the bpf program's bytecode should be loaded
// from.
ByteCode BytecodeSelector `json:"bytecode"`

// MapOwnerSelector is used to select the loaded eBPF program this eBPF program
// will share a map with. The value is a label applied to the BpfProgram to select.
// The selector must resolve to exactly one instance of a BpfProgram on a given node
Expand All @@ -84,6 +80,10 @@ type BpfAppCommon struct {
// such things as size, endianness, alignment and packing of data structures.
// +optional
GlobalData map[string][]byte `json:"globaldata,omitempty"`

// Bytecode configures where the bpf program's bytecode should be loaded
// from.
ByteCode BytecodeSelector `json:"bytecode"`
}

// BpfProgramStatusCommon defines the BpfProgram status
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions controllers/bpfman-agent/fentry-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func TestFentryProgramControllerCreate(t *testing.T) {
Spec: bpfmaniov1alpha1.FentryProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FentryProgramInfo: bpfmaniov1alpha1.FentryProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-agent/fexit-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func TestFexitProgramControllerCreate(t *testing.T) {
Spec: bpfmaniov1alpha1.FexitProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FexitProgramInfo: bpfmaniov1alpha1.FexitProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-agent/kprobe-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ func TestKprobeProgramControllerCreate(t *testing.T) {
Spec: bpfmaniov1alpha1.KprobeProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
KprobeProgramInfo: bpfmaniov1alpha1.KprobeProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
Offset: uint64(offset),
Expand Down
12 changes: 6 additions & 6 deletions controllers/bpfman-agent/tc-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ func TestTcProgramControllerCreate(t *testing.T) {
Spec: bpfmaniov1alpha1.TcProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
TcProgramInfo: bpfmaniov1alpha1.TcProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{
Interfaces: &[]string{fakeInt},
Expand Down Expand Up @@ -237,13 +237,13 @@ func TestTcProgramControllerCreateMultiIntf(t *testing.T) {
Spec: bpfmaniov1alpha1.TcProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
TcProgramInfo: bpfmaniov1alpha1.TcProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{
Interfaces: &fakeInts,
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-agent/tracepoint-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ func TestTracepointProgramControllerCreate(t *testing.T) {
Spec: bpfmaniov1alpha1.TracepointProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
TracepointProgramInfo: bpfmaniov1alpha1.TracepointProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
Names: []string{tracepointName},
},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-agent/uprobe-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func TestUprobeProgramControllerCreate(t *testing.T) {
Spec: bpfmaniov1alpha1.UprobeProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
UprobeProgramInfo: bpfmaniov1alpha1.UprobeProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
Target: target,
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-agent/xdp-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ func xdpProgramControllerCreate(t *testing.T, multiInterface bool, multiConditio
Spec: bpfmaniov1alpha1.XdpProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
XdpProgramInfo: bpfmaniov1alpha1.XdpProgramInfo{
BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{
Interfaces: &fakeInts,
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/fentry-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ func fentryProgramReconcile(t *testing.T, multiCondition bool) {
Spec: bpfmaniov1alpha1.FentryProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FentryProgramInfo: bpfmaniov1alpha1.FentryProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/fexit-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ func fexitProgramReconcile(t *testing.T, multiCondition bool) {
Spec: bpfmaniov1alpha1.FexitProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FexitProgramInfo: bpfmaniov1alpha1.FexitProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/kprobe-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ func kprobeProgramReconcile(t *testing.T, multiCondition bool) {
Spec: bpfmaniov1alpha1.KprobeProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
KprobeProgramInfo: bpfmaniov1alpha1.KprobeProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
Offset: uint64(offset),
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/tc-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func TestTcProgramReconcile(t *testing.T) {
Spec: bpfmaniov1alpha1.TcProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
TcProgramInfo: bpfmaniov1alpha1.TcProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{
Interfaces: &[]string{fakeInt},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/tracepoint-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ func TestTracepointProgramReconcile(t *testing.T) {
Spec: bpfmaniov1alpha1.TracepointProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
TracepointProgramInfo: bpfmaniov1alpha1.TracepointProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
Names: []string{tracepointName},
},
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/uprobe-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ func TestUprobeProgramReconcile(t *testing.T) {
Spec: bpfmaniov1alpha1.UprobeProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
UprobeProgramInfo: bpfmaniov1alpha1.UprobeProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
FunctionName: functionName,
Target: target,
Expand Down
6 changes: 3 additions & 3 deletions controllers/bpfman-operator/xdp-program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ func TestXdpProgramReconcile(t *testing.T) {
Spec: bpfmaniov1alpha1.XdpProgramSpec{
BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{
NodeSelector: metav1.LabelSelector{},
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
XdpProgramInfo: bpfmaniov1alpha1.XdpProgramInfo{

BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{
BpfFunctionName: bpfFunctionName,
ByteCode: bpfmaniov1alpha1.BytecodeSelector{
Path: &bytecodePath,
},
},
InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{
Interfaces: &[]string{fakeInt},
Expand Down

0 comments on commit f4caa07

Please sign in to comment.