From 691a9cde97f7314aa1eafa67ce8973f95c81c34f Mon Sep 17 00:00:00 2001 From: Mohamed Mahmoud Date: Mon, 3 Jun 2024 14:30:24 -0400 Subject: [PATCH] move global data and node selector out of the bpfcommon data struct Signed-off-by: Mohamed Mahmoud --- apis/v1alpha1/fentryProgram_types.go | 15 +- apis/v1alpha1/fexitProgram_types.go | 15 +- apis/v1alpha1/kprobeProgram_types.go | 14 +- apis/v1alpha1/shared_types.go | 38 ++- apis/v1alpha1/tcProgram_types.go | 14 +- apis/v1alpha1/tracepointProgram_types.go | 14 +- apis/v1alpha1/uprobeProgram_types.go | 14 +- apis/v1alpha1/xdpProgram_types.go | 15 +- apis/v1alpha1/zz_generated.deepcopy.go | 304 ++++++++++++------ ...bpfman-operator.clusterserviceversion.yaml | 2 +- .../manifests/bpfman.io_fentryprograms.yaml | 10 +- bundle/manifests/bpfman.io_fexitprograms.yaml | 10 +- .../manifests/bpfman.io_kprobeprograms.yaml | 10 +- bundle/manifests/bpfman.io_tcprograms.yaml | 10 +- .../bpfman.io_tracepointprograms.yaml | 10 +- .../manifests/bpfman.io_uprobeprograms.yaml | 12 +- bundle/manifests/bpfman.io_xdpprograms.yaml | 10 +- .../crd/bases/bpfman.io_fentryprograms.yaml | 6 +- config/crd/bases/bpfman.io_fexitprograms.yaml | 6 +- .../crd/bases/bpfman.io_kprobeprograms.yaml | 6 +- config/crd/bases/bpfman.io_tcprograms.yaml | 6 +- .../bases/bpfman.io_tracepointprograms.yaml | 6 +- .../crd/bases/bpfman.io_uprobeprograms.yaml | 6 +- config/crd/bases/bpfman.io_xdpprograms.yaml | 6 +- controllers/bpfman-agent/common.go | 6 +- controllers/bpfman-agent/fentry-program.go | 9 + .../bpfman-agent/fentry-program_test.go | 16 +- controllers/bpfman-agent/fexit-program.go | 9 + .../bpfman-agent/fexit-program_test.go | 16 +- controllers/bpfman-agent/kprobe-program.go | 9 + .../bpfman-agent/kprobe-program_test.go | 20 +- controllers/bpfman-agent/tc-program.go | 18 +- controllers/bpfman-agent/tc-program_test.go | 64 ++-- .../bpfman-agent/tracepoint-program.go | 20 +- .../bpfman-agent/tracepoint-program_test.go | 16 +- controllers/bpfman-agent/uprobe-program.go | 20 +- .../bpfman-agent/uprobe-program_test.go | 22 +- controllers/bpfman-agent/xdp-program.go | 17 +- controllers/bpfman-agent/xdp-program_test.go | 28 +- .../bpfman-operator/fentry-program_test.go | 17 +- .../bpfman-operator/fexit-program_test.go | 17 +- .../bpfman-operator/kprobe-program_test.go | 21 +- .../bpfman-operator/tc-program_test.go | 33 +- .../tracepoint-program_test.go | 17 +- .../bpfman-operator/uprobe-program_test.go | 23 +- .../bpfman-operator/xdp-program_test.go | 29 +- 46 files changed, 646 insertions(+), 360 deletions(-) diff --git a/apis/v1alpha1/fentryProgram_types.go b/apis/v1alpha1/fentryProgram_types.go index 11105f8c9..4b82fdb43 100644 --- a/apis/v1alpha1/fentryProgram_types.go +++ b/apis/v1alpha1/fentryProgram_types.go @@ -45,21 +45,20 @@ type FentryProgram struct { // FentryProgramSpec defines the desired state of FentryProgram // +kubebuilder:printcolumn:name="FunctionName",type=string,JSONPath=`.spec.func_name` type FentryProgramSpec struct { - BpfProgramCommon `json:",inline"` + FentryProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} +// FentryProgramInfo defines the Fentry program details +type FentryProgramInfo struct { + BpfProgramCommon `json:",inline"` // Function to attach the fentry to. FunctionName string `json:"func_name"` } // FentryProgramStatus defines the observed state of FentryProgram type FentryProgramStatus struct { - // Conditions houses the global cluster state for the FentryProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/fexitProgram_types.go b/apis/v1alpha1/fexitProgram_types.go index d723f2d67..97467996e 100644 --- a/apis/v1alpha1/fexitProgram_types.go +++ b/apis/v1alpha1/fexitProgram_types.go @@ -45,21 +45,20 @@ type FexitProgram struct { // FexitProgramSpec defines the desired state of FexitProgram // +kubebuilder:printcolumn:name="FunctionName",type=string,JSONPath=`.spec.func_name` type FexitProgramSpec struct { - BpfProgramCommon `json:",inline"` + FexitProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} +// FexitProgramInfo defines the Fexit program details +type FexitProgramInfo struct { + BpfProgramCommon `json:",inline"` // Function to attach the fexit to. FunctionName string `json:"func_name"` } // FexitProgramStatus defines the observed state of FexitProgram type FexitProgramStatus struct { - // Conditions houses the global cluster state for the FexitProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/kprobeProgram_types.go b/apis/v1alpha1/kprobeProgram_types.go index a72759a52..b427e9c44 100644 --- a/apis/v1alpha1/kprobeProgram_types.go +++ b/apis/v1alpha1/kprobeProgram_types.go @@ -50,6 +50,12 @@ type KprobeProgram struct { // +kubebuilder:printcolumn:name="RetProbe",type=boolean,JSONPath=`.spec.retprobe` // +kubebuilder:validation:XValidation:message="offset cannot be set for kretprobes",rule="self.retprobe == false || self.offset == 0" type KprobeProgramSpec struct { + KprobeProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} + +// KprobeProgramInfo defines the common fields for KprobeProgram +type KprobeProgramInfo struct { BpfProgramCommon `json:",inline"` // Functions to attach the kprobe to. @@ -73,13 +79,7 @@ type KprobeProgramSpec struct { // KprobeProgramStatus defines the observed state of KprobeProgram type KprobeProgramStatus struct { - // Conditions houses the global cluster state for the KprobeProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/shared_types.go b/apis/v1alpha1/shared_types.go index 354fd9d03..8d11eef2f 100644 --- a/apis/v1alpha1/shared_types.go +++ b/apis/v1alpha1/shared_types.go @@ -59,22 +59,10 @@ type BpfProgramCommon struct { // program BpfFunctionName string `json:"bpffunctionname"` - // NodeSelector allows the user to specify which nodes to deploy the - // bpf program to. This field must be specified, to select all nodes - // use standard metav1.LabelSelector semantics and make it empty. - NodeSelector metav1.LabelSelector `json:"nodeselector"` - // Bytecode configures where the bpf program's bytecode should be loaded // from. ByteCode BytecodeSelector `json:"bytecode"` - // GlobalData allows the user to to set global variables when the program is loaded - // with an array of raw bytes. This is a very low level primitive. The caller - // is responsible for formatting the byte string appropriately considering - // such things as size, endianness, alignment and packing of data structures. - // +optional - GlobalData map[string][]byte `json:"globaldata,omitempty"` - // 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 @@ -83,6 +71,32 @@ type BpfProgramCommon struct { MapOwnerSelector metav1.LabelSelector `json:"mapownerselector"` } +// BpfAppCommon defines the common attributes for all BpfApp programs +type BpfAppCommon struct { + // NodeSelector allows the user to specify which nodes to deploy the + // bpf program to. This field must be specified, to select all nodes + // use standard metav1.LabelSelector semantics and make it empty. + NodeSelector metav1.LabelSelector `json:"nodeselector"` + + // GlobalData allows the user to set global variables when the program is loaded + // with an array of raw bytes. This is a very low level primitive. The caller + // is responsible for formatting the byte string appropriately considering + // such things as size, endianness, alignment and packing of data structures. + // +optional + GlobalData map[string][]byte `json:"globaldata,omitempty"` +} + +// BpfProgramStatusCommon defines the BpfProgram status +type BpfProgramStatusCommon struct { + // Conditions houses the global cluster state for the eBPFProgram. The explicit + // condition types are defined internally. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + // PullPolicy describes a policy for if/when to pull a container image // +kubebuilder:validation:Enum=Always;Never;IfNotPresent type PullPolicy string diff --git a/apis/v1alpha1/tcProgram_types.go b/apis/v1alpha1/tcProgram_types.go index 37245d1c6..24ed566ab 100644 --- a/apis/v1alpha1/tcProgram_types.go +++ b/apis/v1alpha1/tcProgram_types.go @@ -50,6 +50,12 @@ type TcProceedOnValue string // TcProgramSpec defines the desired state of TcProgram type TcProgramSpec struct { + TcProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} + +// TcProgramInfo defines the tc program details +type TcProgramInfo struct { BpfProgramCommon `json:",inline"` // Selector to determine the network interface (or interfaces) @@ -77,13 +83,7 @@ type TcProgramSpec struct { // TcProgramStatus defines the observed state of TcProgram type TcProgramStatus struct { - // Conditions houses the global cluster state for the TcProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/tracepointProgram_types.go b/apis/v1alpha1/tracepointProgram_types.go index c388070bb..e692192a8 100644 --- a/apis/v1alpha1/tracepointProgram_types.go +++ b/apis/v1alpha1/tracepointProgram_types.go @@ -45,6 +45,12 @@ type TracepointProgram struct { // TracepointProgramSpec defines the desired state of TracepointProgram // +kubebuilder:printcolumn:name="TracePoint",type=string,JSONPath=`.spec.name` type TracepointProgramSpec struct { + TracepointProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} + +// TracepointProgramInfo defines the Tracepoint program details +type TracepointProgramInfo struct { BpfProgramCommon `json:",inline"` // Names refers to the names of kernel tracepoints to attach the @@ -54,13 +60,7 @@ type TracepointProgramSpec struct { // TracepointProgramStatus defines the observed state of TracepointProgram type TracepointProgramStatus struct { - // Conditions houses the global cluster state for the TracepointProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/uprobeProgram_types.go b/apis/v1alpha1/uprobeProgram_types.go index c036e6e44..b98500aad 100644 --- a/apis/v1alpha1/uprobeProgram_types.go +++ b/apis/v1alpha1/uprobeProgram_types.go @@ -53,6 +53,12 @@ type UprobeProgram struct { // +kubebuilder:printcolumn:name="RetProbe",type=boolean,JSONPath=`.spec.retprobe` // +kubebuilder:printcolumn:name="Pid",type=integer,JSONPath=`.spec.pid` type UprobeProgramSpec struct { + UprobeProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} + +// UprobeProgramInfo contains the information about the uprobe program +type UprobeProgramInfo struct { BpfProgramCommon `json:",inline"` // Function to attach the uprobe to. @@ -89,13 +95,7 @@ type UprobeProgramSpec struct { // UprobeProgramStatus defines the observed state of UprobeProgram type UprobeProgramStatus struct { - // Conditions houses the global cluster state for the UprobeProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/xdpProgram_types.go b/apis/v1alpha1/xdpProgram_types.go index 51347dca2..8ec1ac072 100644 --- a/apis/v1alpha1/xdpProgram_types.go +++ b/apis/v1alpha1/xdpProgram_types.go @@ -49,8 +49,13 @@ type XdpProceedOnValue string // XdpProgramSpec defines the desired state of XdpProgram type XdpProgramSpec struct { - BpfProgramCommon `json:",inline"` + XdpProgramInfo `json:",inline"` + BpfAppCommon `json:",inline"` +} +// XdpProgramInfo defines the common fields for all XdpProgram types +type XdpProgramInfo struct { + BpfProgramCommon `json:",inline"` // Selector to determine the network interface (or interfaces) InterfaceSelector InterfaceSelector `json:"interfaceselector"` @@ -72,13 +77,7 @@ type XdpProgramSpec struct { // XdpProgramStatus defines the observed state of XdpProgram type XdpProgramStatus struct { - // Conditions houses the global cluster state for the XdpProgram. The explicit - // condition types are defined internally. - // +patchMergeKey=type - // +patchStrategy=merge - // +listType=map - // +listMapKey=type - Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + BpfProgramStatusCommon `json:",inline"` } // +kubebuilder:object:root=true diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index cceb6e4b3..a763e90d8 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -25,6 +25,38 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfAppCommon) DeepCopyInto(out *BpfAppCommon) { + *out = *in + in.NodeSelector.DeepCopyInto(&out.NodeSelector) + if in.GlobalData != nil { + in, out := &in.GlobalData, &out.GlobalData + *out = make(map[string][]byte, len(*in)) + for key, val := range *in { + var outVal []byte + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make([]byte, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfAppCommon. +func (in *BpfAppCommon) DeepCopy() *BpfAppCommon { + if in == nil { + return nil + } + out := new(BpfAppCommon) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BpfProgram) DeepCopyInto(out *BpfProgram) { *out = *in @@ -55,24 +87,7 @@ func (in *BpfProgram) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BpfProgramCommon) DeepCopyInto(out *BpfProgramCommon) { *out = *in - in.NodeSelector.DeepCopyInto(&out.NodeSelector) in.ByteCode.DeepCopyInto(&out.ByteCode) - if in.GlobalData != nil { - in, out := &in.GlobalData, &out.GlobalData - *out = make(map[string][]byte, len(*in)) - for key, val := range *in { - var outVal []byte - if val == nil { - (*out)[key] = nil - } else { - inVal := (*in)[key] - in, out := &inVal, &outVal - *out = make([]byte, len(*in)) - copy(*out, *in) - } - (*out)[key] = outVal - } - } in.MapOwnerSelector.DeepCopyInto(&out.MapOwnerSelector) } @@ -155,6 +170,28 @@ func (in *BpfProgramStatus) DeepCopy() *BpfProgramStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfProgramStatusCommon) DeepCopyInto(out *BpfProgramStatusCommon) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfProgramStatusCommon. +func (in *BpfProgramStatusCommon) DeepCopy() *BpfProgramStatusCommon { + if in == nil { + return nil + } + out := new(BpfProgramStatusCommon) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BytecodeImage) DeepCopyInto(out *BytecodeImage) { *out = *in @@ -252,6 +289,22 @@ func (in *FentryProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FentryProgramInfo) DeepCopyInto(out *FentryProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FentryProgramInfo. +func (in *FentryProgramInfo) DeepCopy() *FentryProgramInfo { + if in == nil { + return nil + } + out := new(FentryProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FentryProgramList) DeepCopyInto(out *FentryProgramList) { *out = *in @@ -287,7 +340,8 @@ func (in *FentryProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FentryProgramSpec) DeepCopyInto(out *FentryProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + in.FentryProgramInfo.DeepCopyInto(&out.FentryProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FentryProgramSpec. @@ -303,13 +357,7 @@ func (in *FentryProgramSpec) DeepCopy() *FentryProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FentryProgramStatus) DeepCopyInto(out *FentryProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FentryProgramStatus. @@ -349,6 +397,22 @@ func (in *FexitProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FexitProgramInfo) DeepCopyInto(out *FexitProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FexitProgramInfo. +func (in *FexitProgramInfo) DeepCopy() *FexitProgramInfo { + if in == nil { + return nil + } + out := new(FexitProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FexitProgramList) DeepCopyInto(out *FexitProgramList) { *out = *in @@ -384,7 +448,8 @@ func (in *FexitProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FexitProgramSpec) DeepCopyInto(out *FexitProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + in.FexitProgramInfo.DeepCopyInto(&out.FexitProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FexitProgramSpec. @@ -400,13 +465,7 @@ func (in *FexitProgramSpec) DeepCopy() *FexitProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FexitProgramStatus) DeepCopyInto(out *FexitProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FexitProgramStatus. @@ -490,6 +549,22 @@ func (in *KprobeProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KprobeProgramInfo) DeepCopyInto(out *KprobeProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KprobeProgramInfo. +func (in *KprobeProgramInfo) DeepCopy() *KprobeProgramInfo { + if in == nil { + return nil + } + out := new(KprobeProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KprobeProgramList) DeepCopyInto(out *KprobeProgramList) { *out = *in @@ -525,7 +600,8 @@ func (in *KprobeProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KprobeProgramSpec) DeepCopyInto(out *KprobeProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + in.KprobeProgramInfo.DeepCopyInto(&out.KprobeProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KprobeProgramSpec. @@ -541,13 +617,7 @@ func (in *KprobeProgramSpec) DeepCopy() *KprobeProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KprobeProgramStatus) DeepCopyInto(out *KprobeProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KprobeProgramStatus. @@ -587,6 +657,28 @@ func (in *TcProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TcProgramInfo) DeepCopyInto(out *TcProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + in.InterfaceSelector.DeepCopyInto(&out.InterfaceSelector) + if in.ProceedOn != nil { + in, out := &in.ProceedOn, &out.ProceedOn + *out = make([]TcProceedOnValue, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TcProgramInfo. +func (in *TcProgramInfo) DeepCopy() *TcProgramInfo { + if in == nil { + return nil + } + out := new(TcProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TcProgramList) DeepCopyInto(out *TcProgramList) { *out = *in @@ -622,13 +714,8 @@ func (in *TcProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TcProgramSpec) DeepCopyInto(out *TcProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) - in.InterfaceSelector.DeepCopyInto(&out.InterfaceSelector) - if in.ProceedOn != nil { - in, out := &in.ProceedOn, &out.ProceedOn - *out = make([]TcProceedOnValue, len(*in)) - copy(*out, *in) - } + in.TcProgramInfo.DeepCopyInto(&out.TcProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TcProgramSpec. @@ -644,13 +731,7 @@ func (in *TcProgramSpec) DeepCopy() *TcProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TcProgramStatus) DeepCopyInto(out *TcProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TcProgramStatus. @@ -690,6 +771,27 @@ func (in *TracepointProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TracepointProgramInfo) DeepCopyInto(out *TracepointProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + if in.Names != nil { + in, out := &in.Names, &out.Names + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TracepointProgramInfo. +func (in *TracepointProgramInfo) DeepCopy() *TracepointProgramInfo { + if in == nil { + return nil + } + out := new(TracepointProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TracepointProgramList) DeepCopyInto(out *TracepointProgramList) { *out = *in @@ -725,12 +827,8 @@ func (in *TracepointProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TracepointProgramSpec) DeepCopyInto(out *TracepointProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) - if in.Names != nil { - in, out := &in.Names, &out.Names - *out = make([]string, len(*in)) - copy(*out, *in) - } + in.TracepointProgramInfo.DeepCopyInto(&out.TracepointProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TracepointProgramSpec. @@ -746,13 +844,7 @@ func (in *TracepointProgramSpec) DeepCopy() *TracepointProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TracepointProgramStatus) DeepCopyInto(out *TracepointProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TracepointProgramStatus. @@ -792,6 +884,27 @@ func (in *UprobeProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UprobeProgramInfo) DeepCopyInto(out *UprobeProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = new(ContainerSelector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UprobeProgramInfo. +func (in *UprobeProgramInfo) DeepCopy() *UprobeProgramInfo { + if in == nil { + return nil + } + out := new(UprobeProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UprobeProgramList) DeepCopyInto(out *UprobeProgramList) { *out = *in @@ -827,12 +940,8 @@ func (in *UprobeProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UprobeProgramSpec) DeepCopyInto(out *UprobeProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) - if in.Containers != nil { - in, out := &in.Containers, &out.Containers - *out = new(ContainerSelector) - (*in).DeepCopyInto(*out) - } + in.UprobeProgramInfo.DeepCopyInto(&out.UprobeProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UprobeProgramSpec. @@ -848,13 +957,7 @@ func (in *UprobeProgramSpec) DeepCopy() *UprobeProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UprobeProgramStatus) DeepCopyInto(out *UprobeProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UprobeProgramStatus. @@ -894,6 +997,28 @@ func (in *XdpProgram) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *XdpProgramInfo) DeepCopyInto(out *XdpProgramInfo) { + *out = *in + in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) + in.InterfaceSelector.DeepCopyInto(&out.InterfaceSelector) + if in.ProceedOn != nil { + in, out := &in.ProceedOn, &out.ProceedOn + *out = make([]XdpProceedOnValue, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XdpProgramInfo. +func (in *XdpProgramInfo) DeepCopy() *XdpProgramInfo { + if in == nil { + return nil + } + out := new(XdpProgramInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *XdpProgramList) DeepCopyInto(out *XdpProgramList) { *out = *in @@ -929,13 +1054,8 @@ func (in *XdpProgramList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *XdpProgramSpec) DeepCopyInto(out *XdpProgramSpec) { *out = *in - in.BpfProgramCommon.DeepCopyInto(&out.BpfProgramCommon) - in.InterfaceSelector.DeepCopyInto(&out.InterfaceSelector) - if in.ProceedOn != nil { - in, out := &in.ProceedOn, &out.ProceedOn - *out = make([]XdpProceedOnValue, len(*in)) - copy(*out, *in) - } + in.XdpProgramInfo.DeepCopyInto(&out.XdpProgramInfo) + in.BpfAppCommon.DeepCopyInto(&out.BpfAppCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XdpProgramSpec. @@ -951,13 +1071,7 @@ func (in *XdpProgramSpec) DeepCopy() *XdpProgramSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *XdpProgramStatus) DeepCopyInto(out *XdpProgramStatus) { *out = *in - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.Condition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } + in.BpfProgramStatusCommon.DeepCopyInto(&out.BpfProgramStatusCommon) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XdpProgramStatus. diff --git a/bundle/manifests/bpfman-operator.clusterserviceversion.yaml b/bundle/manifests/bpfman-operator.clusterserviceversion.yaml index 5378c3ebc..a9e208a71 100644 --- a/bundle/manifests/bpfman-operator.clusterserviceversion.yaml +++ b/bundle/manifests/bpfman-operator.clusterserviceversion.yaml @@ -215,7 +215,7 @@ metadata: ] capabilities: Basic Install containerImage: quay.io/bpfman/bpfman-operator:v0.0.0 - createdAt: "2024-05-23T11:40:06Z" + createdAt: "2024-06-04T18:15:26Z" operators.operatorframework.io/builder: operator-sdk-v1.27.0 operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 repository: https://github.com/bpfman/bpfman diff --git a/bundle/manifests/bpfman.io_fentryprograms.yaml b/bundle/manifests/bpfman.io_fentryprograms.yaml index 0d427148b..76cefd41c 100644 --- a/bundle/manifests/bpfman.io_fentryprograms.yaml +++ b/bundle/manifests/bpfman.io_fentryprograms.yaml @@ -111,7 +111,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -149,11 +149,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -167,7 +169,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -196,11 +198,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -222,7 +226,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the FentryProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/bundle/manifests/bpfman.io_fexitprograms.yaml b/bundle/manifests/bpfman.io_fexitprograms.yaml index 1d2aadea6..78225dcfb 100644 --- a/bundle/manifests/bpfman.io_fexitprograms.yaml +++ b/bundle/manifests/bpfman.io_fexitprograms.yaml @@ -111,7 +111,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -149,11 +149,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -167,7 +169,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -196,11 +198,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -222,7 +226,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the FexitProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/bundle/manifests/bpfman.io_kprobeprograms.yaml b/bundle/manifests/bpfman.io_kprobeprograms.yaml index 039faf665..e40bed810 100644 --- a/bundle/manifests/bpfman.io_kprobeprograms.yaml +++ b/bundle/manifests/bpfman.io_kprobeprograms.yaml @@ -119,7 +119,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -157,11 +157,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -175,7 +177,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -204,11 +206,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -244,7 +248,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the KprobeProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/bundle/manifests/bpfman.io_tcprograms.yaml b/bundle/manifests/bpfman.io_tcprograms.yaml index d16aa4fdb..ca3dec73e 100644 --- a/bundle/manifests/bpfman.io_tcprograms.yaml +++ b/bundle/manifests/bpfman.io_tcprograms.yaml @@ -128,7 +128,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -183,11 +183,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -201,7 +203,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -230,11 +232,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -290,7 +294,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the TcProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/bundle/manifests/bpfman.io_tracepointprograms.yaml b/bundle/manifests/bpfman.io_tracepointprograms.yaml index 853c6a4a8..add6d12b6 100644 --- a/bundle/manifests/bpfman.io_tracepointprograms.yaml +++ b/bundle/manifests/bpfman.io_tracepointprograms.yaml @@ -108,7 +108,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -146,11 +146,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -171,7 +173,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -200,11 +202,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -226,7 +230,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the TracepointProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/bundle/manifests/bpfman.io_uprobeprograms.yaml b/bundle/manifests/bpfman.io_uprobeprograms.yaml index 17db25e4e..376ccbe27 100644 --- a/bundle/manifests/bpfman.io_uprobeprograms.yaml +++ b/bundle/manifests/bpfman.io_uprobeprograms.yaml @@ -170,11 +170,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -196,7 +198,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -234,11 +236,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -252,7 +256,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -281,11 +285,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -325,7 +331,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the UprobeProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/bundle/manifests/bpfman.io_xdpprograms.yaml b/bundle/manifests/bpfman.io_xdpprograms.yaml index c84369089..94ce6b7c4 100644 --- a/bundle/manifests/bpfman.io_xdpprograms.yaml +++ b/bundle/manifests/bpfman.io_xdpprograms.yaml @@ -116,7 +116,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -171,11 +171,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -189,7 +191,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -218,11 +220,13 @@ spec: items: type: string type: array + x-kubernetes-list-type: atomic required: - key - operator type: object type: array + x-kubernetes-list-type: atomic matchLabels: additionalProperties: type: string @@ -269,7 +273,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the XdpProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_fentryprograms.yaml b/config/crd/bases/bpfman.io_fentryprograms.yaml index a10e1da19..129fecf6f 100644 --- a/config/crd/bases/bpfman.io_fentryprograms.yaml +++ b/config/crd/bases/bpfman.io_fentryprograms.yaml @@ -111,7 +111,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -169,7 +169,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -226,7 +226,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the FentryProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_fexitprograms.yaml b/config/crd/bases/bpfman.io_fexitprograms.yaml index 2c2f252d8..d8e8bbd51 100644 --- a/config/crd/bases/bpfman.io_fexitprograms.yaml +++ b/config/crd/bases/bpfman.io_fexitprograms.yaml @@ -111,7 +111,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -169,7 +169,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -226,7 +226,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the FexitProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_kprobeprograms.yaml b/config/crd/bases/bpfman.io_kprobeprograms.yaml index fe1744936..076d269e5 100644 --- a/config/crd/bases/bpfman.io_kprobeprograms.yaml +++ b/config/crd/bases/bpfman.io_kprobeprograms.yaml @@ -119,7 +119,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -177,7 +177,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -248,7 +248,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the KprobeProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_tcprograms.yaml b/config/crd/bases/bpfman.io_tcprograms.yaml index 5402b2fef..29df476c7 100644 --- a/config/crd/bases/bpfman.io_tcprograms.yaml +++ b/config/crd/bases/bpfman.io_tcprograms.yaml @@ -128,7 +128,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -203,7 +203,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -294,7 +294,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the TcProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_tracepointprograms.yaml b/config/crd/bases/bpfman.io_tracepointprograms.yaml index 988dc6029..bbcc48241 100644 --- a/config/crd/bases/bpfman.io_tracepointprograms.yaml +++ b/config/crd/bases/bpfman.io_tracepointprograms.yaml @@ -108,7 +108,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -173,7 +173,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -230,7 +230,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the TracepointProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_uprobeprograms.yaml b/config/crd/bases/bpfman.io_uprobeprograms.yaml index 4eb9a1090..356c58008 100644 --- a/config/crd/bases/bpfman.io_uprobeprograms.yaml +++ b/config/crd/bases/bpfman.io_uprobeprograms.yaml @@ -198,7 +198,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -256,7 +256,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -331,7 +331,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the UprobeProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/config/crd/bases/bpfman.io_xdpprograms.yaml b/config/crd/bases/bpfman.io_xdpprograms.yaml index f6e87ba42..131fd0435 100644 --- a/config/crd/bases/bpfman.io_xdpprograms.yaml +++ b/config/crd/bases/bpfman.io_xdpprograms.yaml @@ -116,7 +116,7 @@ spec: format: byte type: string description: |- - GlobalData allows the user to to set global variables when the program is loaded + GlobalData allows the user to set global variables when the program is loaded with an array of raw bytes. This is a very low level primitive. The caller is responsible for formatting the byte string appropriately considering such things as size, endianness, alignment and packing of data structures. @@ -191,7 +191,7 @@ spec: nodeselector: description: |- NodeSelector allows the user to specify which nodes to deploy the - bpf program to. This field must be specified, to select all nodes + bpf program to. This field must be specified, to select all nodes use standard metav1.LabelSelector semantics and make it empty. properties: matchExpressions: @@ -273,7 +273,7 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the XdpProgram. The explicit + Conditions houses the global cluster state for the eBPFProgram. The explicit condition types are defined internally. items: description: "Condition contains details for one aspect of the current diff --git a/controllers/bpfman-agent/common.go b/controllers/bpfman-agent/common.go index 1ba06c2a4..6485dd417 100644 --- a/controllers/bpfman-agent/common.go +++ b/controllers/bpfman-agent/common.go @@ -112,6 +112,10 @@ type bpfmanReconciler interface { // setCurrentProgram sets the current *Program for the reconciler as well as // any other related state needed. setCurrentProgram(program client.Object) error + // getNodeSelector returns the node selector for the nodes where bpf programs will be deployed. + getNodeSelector() *metav1.LabelSelector + // getBpfGlobalData returns the Bpf program global variables. + getBpfGlobalData() map[string][]byte } // reconcileCommon is the common reconciler loop called by each bpfman @@ -729,7 +733,7 @@ func (r *ReconcilerCommon) reconcileProgram(ctx context.Context, // Determine which node local actions should be taken based on whether the node is selected // OR if the *Program is being deleted. - isNodeSelected, err := isNodeSelected(&rec.getBpfProgramCommon().NodeSelector, rec.getNode().Labels) + isNodeSelected, err := isNodeSelected(rec.getNodeSelector(), rec.getNode().Labels) if err != nil { return internal.Requeue, fmt.Errorf("failed to check if node is selected: %v", err) } diff --git a/controllers/bpfman-agent/fentry-program.go b/controllers/bpfman-agent/fentry-program.go index 1d6e59ff4..872f6b77d 100644 --- a/controllers/bpfman-agent/fentry-program.go +++ b/controllers/bpfman-agent/fentry-program.go @@ -27,6 +27,7 @@ import ( gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" @@ -69,6 +70,14 @@ func (r *FentryProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.BpfPro return &r.currentFentryProgram.Spec.BpfProgramCommon } +func (r *FentryProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentFentryProgram.Spec.NodeSelector +} + +func (r *FentryProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentFentryProgram.Spec.GlobalData +} + func (r *FentryProgramReconciler) setCurrentProgram(program client.Object) error { var ok bool diff --git a/controllers/bpfman-agent/fentry-program_test.go b/controllers/bpfman-agent/fentry-program_test.go index d686ca97b..c72b8bb09 100644 --- a/controllers/bpfman-agent/fentry-program_test.go +++ b/controllers/bpfman-agent/fentry-program_test.go @@ -62,14 +62,18 @@ func TestFentryProgramControllerCreate(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.FentryProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + FentryProgramInfo: bpfmaniov1alpha1.FentryProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, }, - FunctionName: functionName, }, } diff --git a/controllers/bpfman-agent/fexit-program.go b/controllers/bpfman-agent/fexit-program.go index e78cd6ad4..ca45313cd 100644 --- a/controllers/bpfman-agent/fexit-program.go +++ b/controllers/bpfman-agent/fexit-program.go @@ -27,6 +27,7 @@ import ( gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" @@ -69,6 +70,14 @@ func (r *FexitProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.BpfProg return &r.currentFexitProgram.Spec.BpfProgramCommon } +func (r *FexitProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentFexitProgram.Spec.NodeSelector +} + +func (r *FexitProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentFexitProgram.Spec.GlobalData +} + func (r *FexitProgramReconciler) setCurrentProgram(program client.Object) error { var ok bool diff --git a/controllers/bpfman-agent/fexit-program_test.go b/controllers/bpfman-agent/fexit-program_test.go index 08faa8d67..6dbb57604 100644 --- a/controllers/bpfman-agent/fexit-program_test.go +++ b/controllers/bpfman-agent/fexit-program_test.go @@ -62,14 +62,18 @@ func TestFexitProgramControllerCreate(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.FexitProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + FexitProgramInfo: bpfmaniov1alpha1.FexitProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, }, - FunctionName: functionName, }, } diff --git a/controllers/bpfman-agent/kprobe-program.go b/controllers/bpfman-agent/kprobe-program.go index 18ace44f9..01766e103 100644 --- a/controllers/bpfman-agent/kprobe-program.go +++ b/controllers/bpfman-agent/kprobe-program.go @@ -27,6 +27,7 @@ import ( gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" @@ -69,6 +70,14 @@ func (r *KprobeProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.BpfPro return &r.currentKprobeProgram.Spec.BpfProgramCommon } +func (r *KprobeProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentKprobeProgram.Spec.NodeSelector +} + +func (r *KprobeProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentKprobeProgram.Spec.GlobalData +} + func (r *KprobeProgramReconciler) setCurrentProgram(program client.Object) error { var ok bool diff --git a/controllers/bpfman-agent/kprobe-program_test.go b/controllers/bpfman-agent/kprobe-program_test.go index b8b8df7bb..2b360c693 100644 --- a/controllers/bpfman-agent/kprobe-program_test.go +++ b/controllers/bpfman-agent/kprobe-program_test.go @@ -65,16 +65,20 @@ func TestKprobeProgramControllerCreate(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.KprobeProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + KprobeProgramInfo: bpfmaniov1alpha1.KprobeProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, + Offset: uint64(offset), + RetProbe: retprobe, }, - FunctionName: functionName, - Offset: uint64(offset), - RetProbe: retprobe, }, } diff --git a/controllers/bpfman-agent/tc-program.go b/controllers/bpfman-agent/tc-program.go index 21386cd2a..935b04f26 100644 --- a/controllers/bpfman-agent/tc-program.go +++ b/controllers/bpfman-agent/tc-program.go @@ -20,20 +20,20 @@ import ( "context" "fmt" - "k8s.io/apimachinery/pkg/types" - bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal" "github.com/bpfman/bpfman-operator/internal" + gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - - gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" - v1 "k8s.io/api/core/v1" ) //+kubebuilder:rbac:groups=bpfman.io,resources=tcprograms,verbs=get;list;watch @@ -71,6 +71,14 @@ func (r *TcProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.BpfProgram return &r.currentTcProgram.Spec.BpfProgramCommon } +func (r *TcProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentTcProgram.Spec.NodeSelector +} + +func (r *TcProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentTcProgram.Spec.GlobalData +} + func (r *TcProgramReconciler) setCurrentProgram(program client.Object) error { var err error var ok bool diff --git a/controllers/bpfman-agent/tc-program_test.go b/controllers/bpfman-agent/tc-program_test.go index 201c029bb..303a6518d 100644 --- a/controllers/bpfman-agent/tc-program_test.go +++ b/controllers/bpfman-agent/tc-program_test.go @@ -64,21 +64,25 @@ func TestTcProgramControllerCreate(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.TcProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, - }, - }, - InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ - Interfaces: &[]string{fakeInt}, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, }, - Priority: 0, - Direction: direction, - ProceedOn: []bpfmaniov1alpha1.TcProceedOnValue{ - bpfmaniov1alpha1.TcProceedOnValue("pipe"), - bpfmaniov1alpha1.TcProceedOnValue("dispatcher_return"), + TcProgramInfo: bpfmaniov1alpha1.TcProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, + }, + InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ + Interfaces: &[]string{fakeInt}, + }, + Priority: 0, + Direction: direction, + ProceedOn: []bpfmaniov1alpha1.TcProceedOnValue{ + bpfmaniov1alpha1.TcProceedOnValue("pipe"), + bpfmaniov1alpha1.TcProceedOnValue("dispatcher_return"), + }, }, }, } @@ -231,21 +235,25 @@ func TestTcProgramControllerCreateMultiIntf(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.TcProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, - }, - }, - InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ - Interfaces: &fakeInts, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, }, - Priority: 0, - Direction: direction, - ProceedOn: []bpfmaniov1alpha1.TcProceedOnValue{ - bpfmaniov1alpha1.TcProceedOnValue("pipe"), - bpfmaniov1alpha1.TcProceedOnValue("dispatcher_return"), + TcProgramInfo: bpfmaniov1alpha1.TcProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, + }, + InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ + Interfaces: &fakeInts, + }, + Priority: 0, + Direction: direction, + ProceedOn: []bpfmaniov1alpha1.TcProceedOnValue{ + bpfmaniov1alpha1.TcProceedOnValue("pipe"), + bpfmaniov1alpha1.TcProceedOnValue("dispatcher_return"), + }, }, }, } diff --git a/controllers/bpfman-agent/tracepoint-program.go b/controllers/bpfman-agent/tracepoint-program.go index dc07ca655..fdc00bf53 100644 --- a/controllers/bpfman-agent/tracepoint-program.go +++ b/controllers/bpfman-agent/tracepoint-program.go @@ -21,20 +21,20 @@ import ( "fmt" "strings" - "k8s.io/apimachinery/pkg/types" - bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal" + internal "github.com/bpfman/bpfman-operator/internal" + gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - - internal "github.com/bpfman/bpfman-operator/internal" - gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" - v1 "k8s.io/api/core/v1" ) //+kubebuilder:rbac:groups=bpfman.io,resources=tracepointprograms,verbs=get;list;watch @@ -70,6 +70,14 @@ func (r *TracepointProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.Bp return &r.currentTracepointProgram.Spec.BpfProgramCommon } +func (r *TracepointProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentTracepointProgram.Spec.NodeSelector +} + +func (r *TracepointProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentTracepointProgram.Spec.GlobalData +} + func (r *TracepointProgramReconciler) setCurrentProgram(program client.Object) error { var ok bool diff --git a/controllers/bpfman-agent/tracepoint-program_test.go b/controllers/bpfman-agent/tracepoint-program_test.go index 1a37b8ae1..7f6bfc839 100644 --- a/controllers/bpfman-agent/tracepoint-program_test.go +++ b/controllers/bpfman-agent/tracepoint-program_test.go @@ -62,14 +62,18 @@ func TestTracepointProgramControllerCreate(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.TracepointProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + TracepointProgramInfo: bpfmaniov1alpha1.TracepointProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + Names: []string{tracepointName}, }, - Names: []string{tracepointName}, }, } diff --git a/controllers/bpfman-agent/uprobe-program.go b/controllers/bpfman-agent/uprobe-program.go index 8e9ae980e..c1092ae01 100644 --- a/controllers/bpfman-agent/uprobe-program.go +++ b/controllers/bpfman-agent/uprobe-program.go @@ -22,20 +22,20 @@ import ( "strconv" "strings" - "k8s.io/apimachinery/pkg/types" - bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal" + internal "github.com/bpfman/bpfman-operator/internal" + gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - - internal "github.com/bpfman/bpfman-operator/internal" - gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" - v1 "k8s.io/api/core/v1" ) //+kubebuilder:rbac:groups=bpfman.io,resources=uprobeprograms,verbs=get;list;watch @@ -71,6 +71,14 @@ func (r *UprobeProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.BpfPro return &r.currentUprobeProgram.Spec.BpfProgramCommon } +func (r *UprobeProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentUprobeProgram.Spec.NodeSelector +} + +func (r *UprobeProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentUprobeProgram.Spec.GlobalData +} + func (r *UprobeProgramReconciler) setCurrentProgram(program client.Object) error { var ok bool diff --git a/controllers/bpfman-agent/uprobe-program_test.go b/controllers/bpfman-agent/uprobe-program_test.go index f6d8ec96b..296184e7f 100644 --- a/controllers/bpfman-agent/uprobe-program_test.go +++ b/controllers/bpfman-agent/uprobe-program_test.go @@ -67,17 +67,21 @@ func TestUprobeProgramControllerCreate(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.UprobeProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + UprobeProgramInfo: bpfmaniov1alpha1.UprobeProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, + Target: target, + Offset: uint64(offset), + RetProbe: retprobe, }, - FunctionName: functionName, - Target: target, - Offset: uint64(offset), - RetProbe: retprobe, }, } diff --git a/controllers/bpfman-agent/xdp-program.go b/controllers/bpfman-agent/xdp-program.go index 484a93278..ff185f668 100644 --- a/controllers/bpfman-agent/xdp-program.go +++ b/controllers/bpfman-agent/xdp-program.go @@ -23,16 +23,17 @@ import ( bpfmaniov1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" bpfmanagentinternal "github.com/bpfman/bpfman-operator/controllers/bpfman-agent/internal" internal "github.com/bpfman/bpfman-operator/internal" + gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - - gobpfman "github.com/bpfman/bpfman/clients/gobpfman/v1" - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" ) //+kubebuilder:rbac:groups=bpfman.io,resources=xdpprograms,verbs=get;list;watch @@ -69,6 +70,14 @@ func (r *XdpProgramReconciler) getBpfProgramCommon() *bpfmaniov1alpha1.BpfProgra return &r.currentXdpProgram.Spec.BpfProgramCommon } +func (r *XdpProgramReconciler) getNodeSelector() *metav1.LabelSelector { + return &r.currentXdpProgram.Spec.NodeSelector +} + +func (r *XdpProgramReconciler) getBpfGlobalData() map[string][]byte { + return r.currentXdpProgram.Spec.GlobalData +} + func (r *XdpProgramReconciler) setCurrentProgram(program client.Object) error { var err error var ok bool diff --git a/controllers/bpfman-agent/xdp-program_test.go b/controllers/bpfman-agent/xdp-program_test.go index d558c3dd3..c90702820 100644 --- a/controllers/bpfman-agent/xdp-program_test.go +++ b/controllers/bpfman-agent/xdp-program_test.go @@ -78,19 +78,23 @@ func xdpProgramControllerCreate(t *testing.T, multiInterface bool, multiConditio Name: name, }, Spec: bpfmaniov1alpha1.XdpProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, - }, - }, - InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ - Interfaces: &fakeInts, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, }, - Priority: 0, - ProceedOn: []bpfmaniov1alpha1.XdpProceedOnValue{bpfmaniov1alpha1.XdpProceedOnValue("pass"), - bpfmaniov1alpha1.XdpProceedOnValue("dispatcher_return"), + XdpProgramInfo: bpfmaniov1alpha1.XdpProgramInfo{ + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, + }, + InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ + Interfaces: &fakeInts, + }, + Priority: 0, + ProceedOn: []bpfmaniov1alpha1.XdpProceedOnValue{bpfmaniov1alpha1.XdpProceedOnValue("pass"), + bpfmaniov1alpha1.XdpProceedOnValue("dispatcher_return"), + }, }, }, } diff --git a/controllers/bpfman-operator/fentry-program_test.go b/controllers/bpfman-operator/fentry-program_test.go index 1d9dd5a9c..2ab5fdd33 100644 --- a/controllers/bpfman-operator/fentry-program_test.go +++ b/controllers/bpfman-operator/fentry-program_test.go @@ -56,14 +56,19 @@ func fentryProgramReconcile(t *testing.T, multiCondition bool) { Name: name, }, Spec: bpfmaniov1alpha1.FentryProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + FentryProgramInfo: bpfmaniov1alpha1.FentryProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, }, - FunctionName: functionName, }, } diff --git a/controllers/bpfman-operator/fexit-program_test.go b/controllers/bpfman-operator/fexit-program_test.go index 9ed731b37..48913b5bd 100644 --- a/controllers/bpfman-operator/fexit-program_test.go +++ b/controllers/bpfman-operator/fexit-program_test.go @@ -56,14 +56,19 @@ func fexitProgramReconcile(t *testing.T, multiCondition bool) { Name: name, }, Spec: bpfmaniov1alpha1.FexitProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + FexitProgramInfo: bpfmaniov1alpha1.FexitProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, }, - FunctionName: functionName, }, } diff --git a/controllers/bpfman-operator/kprobe-program_test.go b/controllers/bpfman-operator/kprobe-program_test.go index af73c0acd..ce1a61a10 100644 --- a/controllers/bpfman-operator/kprobe-program_test.go +++ b/controllers/bpfman-operator/kprobe-program_test.go @@ -58,16 +58,21 @@ func kprobeProgramReconcile(t *testing.T, multiCondition bool) { Name: name, }, Spec: bpfmaniov1alpha1.KprobeProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + KprobeProgramInfo: bpfmaniov1alpha1.KprobeProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, + Offset: uint64(offset), + RetProbe: retprobe, }, - FunctionName: functionName, - Offset: uint64(offset), - RetProbe: retprobe, }, } diff --git a/controllers/bpfman-operator/tc-program_test.go b/controllers/bpfman-operator/tc-program_test.go index a63e4b41a..737dcc99c 100644 --- a/controllers/bpfman-operator/tc-program_test.go +++ b/controllers/bpfman-operator/tc-program_test.go @@ -55,21 +55,26 @@ func TestTcProgramReconcile(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.TcProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, - }, - }, - InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ - Interfaces: &[]string{fakeInt}, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, }, - Priority: 0, - Direction: direction, - ProceedOn: []bpfmaniov1alpha1.TcProceedOnValue{ - bpfmaniov1alpha1.TcProceedOnValue("pipe"), - bpfmaniov1alpha1.TcProceedOnValue("dispatcher_return"), + TcProgramInfo: bpfmaniov1alpha1.TcProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, + }, + InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ + Interfaces: &[]string{fakeInt}, + }, + Priority: 0, + Direction: direction, + ProceedOn: []bpfmaniov1alpha1.TcProceedOnValue{ + bpfmaniov1alpha1.TcProceedOnValue("pipe"), + bpfmaniov1alpha1.TcProceedOnValue("dispatcher_return"), + }, }, }, } diff --git a/controllers/bpfman-operator/tracepoint-program_test.go b/controllers/bpfman-operator/tracepoint-program_test.go index f3bdc618f..1efa2b8d5 100644 --- a/controllers/bpfman-operator/tracepoint-program_test.go +++ b/controllers/bpfman-operator/tracepoint-program_test.go @@ -53,14 +53,19 @@ func TestTracepointProgramReconcile(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.TracepointProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + TracepointProgramInfo: bpfmaniov1alpha1.TracepointProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + Names: []string{tracepointName}, }, - Names: []string{tracepointName}, }, } diff --git a/controllers/bpfman-operator/uprobe-program_test.go b/controllers/bpfman-operator/uprobe-program_test.go index 9bfeede0b..18f3f04e1 100644 --- a/controllers/bpfman-operator/uprobe-program_test.go +++ b/controllers/bpfman-operator/uprobe-program_test.go @@ -56,17 +56,22 @@ func TestUprobeProgramReconcile(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.UprobeProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, + }, + UprobeProgramInfo: bpfmaniov1alpha1.UprobeProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, }, + FunctionName: functionName, + Target: target, + Offset: uint64(offset), + RetProbe: retprobe, }, - FunctionName: functionName, - Target: target, - Offset: uint64(offset), - RetProbe: retprobe, }, } diff --git a/controllers/bpfman-operator/xdp-program_test.go b/controllers/bpfman-operator/xdp-program_test.go index 43833d0e1..10bedf796 100644 --- a/controllers/bpfman-operator/xdp-program_test.go +++ b/controllers/bpfman-operator/xdp-program_test.go @@ -53,19 +53,24 @@ func TestXdpProgramReconcile(t *testing.T) { Name: name, }, Spec: bpfmaniov1alpha1.XdpProgramSpec{ - BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ - BpfFunctionName: bpfFunctionName, - NodeSelector: metav1.LabelSelector{}, - ByteCode: bpfmaniov1alpha1.BytecodeSelector{ - Path: &bytecodePath, - }, - }, - InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ - Interfaces: &[]string{fakeInt}, + BpfAppCommon: bpfmaniov1alpha1.BpfAppCommon{ + NodeSelector: metav1.LabelSelector{}, }, - Priority: 0, - ProceedOn: []bpfmaniov1alpha1.XdpProceedOnValue{bpfmaniov1alpha1.XdpProceedOnValue("pass"), - bpfmaniov1alpha1.XdpProceedOnValue("dispatcher_return"), + XdpProgramInfo: bpfmaniov1alpha1.XdpProgramInfo{ + + BpfProgramCommon: bpfmaniov1alpha1.BpfProgramCommon{ + BpfFunctionName: bpfFunctionName, + ByteCode: bpfmaniov1alpha1.BytecodeSelector{ + Path: &bytecodePath, + }, + }, + InterfaceSelector: bpfmaniov1alpha1.InterfaceSelector{ + Interfaces: &[]string{fakeInt}, + }, + Priority: 0, + ProceedOn: []bpfmaniov1alpha1.XdpProceedOnValue{bpfmaniov1alpha1.XdpProceedOnValue("pass"), + bpfmaniov1alpha1.XdpProceedOnValue("dispatcher_return"), + }, }, }, }