Skip to content

Commit

Permalink
Rename BpfApplicationNode to BpfApplicationState
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Fredette <[email protected]>
  • Loading branch information
anfredette committed Jan 23, 2025
1 parent 83561f6 commit 5ca1b84
Show file tree
Hide file tree
Showing 69 changed files with 924 additions and 922 deletions.
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ resources:
crdVersion: v1
controller: true
domain: bpfman.io
kind: BpfApplicationNode
kind: BpfApplicationState
path: github.com/bpfman/bpfman-operator/apis/v1alpha1
version: v1alpha1
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

// BpfApplicationProgramNode defines the desired state of BpfApplication
// BpfApplicationProgramState defines the desired state of BpfApplication
// +union
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'XDP' ? has(self.xdp) : !has(self.xdp)",message="xdp configuration is required when type is XDP, and forbidden otherwise"
// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'TC' ? has(self.tc) : !has(self.tc)",message="tc configuration is required when type is TC, and forbidden otherwise"
Expand All @@ -34,7 +34,7 @@ import (
// // +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Uprobe' ? has(self.uprobe) : !has(self.uprobe)",message="uprobe configuration is required when type is Uprobe, and forbidden otherwise"
// // +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Uretprobe' ? has(self.uretprobe) : !has(self.uretprobe)",message="uretprobe configuration is required when type is Uretprobe, and forbidden otherwise"
// // +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Tracepoint' ? has(self.tracepoint) : !has(self.tracepoint)",message="tracepoint configuration is required when type is Tracepoint, and forbidden otherwise"
type BpfApplicationProgramNode struct {
type BpfApplicationProgramState struct {
// ProgramAttachStatus records whether the program should be loaded and whether
// the program is loaded.
ProgramAttachStatus BpfProgramConditionType `json:"programattachstatus"`
Expand All @@ -53,57 +53,57 @@ type BpfApplicationProgramNode struct {
// xdp defines the desired state of the application's XdpPrograms.
// +unionMember
// +optional
XDP *XdpProgramInfoNode `json:"xdp,omitempty"`
XDP *XdpProgramInfoState `json:"xdp,omitempty"`

// tc defines the desired state of the application's TcPrograms.
// +unionMember
// +optional
TC *TcProgramInfoNode `json:"tc,omitempty"`
TC *TcProgramInfoState `json:"tc,omitempty"`

// // tcx defines the desired state of the application's TcxPrograms.
// // +unionMember
// // +optional
// TCX *TcxProgramInfoNode `json:"tcx,omitempty"`
// TCX *TcxProgramInfoState `json:"tcx,omitempty"`

// fentry defines the desired state of the application's FentryPrograms.
// +unionMember
// +optional
Fentry *FentryProgramInfoNode `json:"fentry,omitempty"`
Fentry *FentryProgramInfoState `json:"fentry,omitempty"`

// // fexit defines the desired state of the application's FexitPrograms.
// // +unionMember
// // +optional
// Fexit *FexitProgramInfoNode `json:"fexit,omitempty"`
// Fexit *FexitProgramInfoState `json:"fexit,omitempty"`

// // kprobe defines the desired state of the application's KprobePrograms.
// // +unionMember
// // +optional
// Kprobe *KprobeProgramInfoNode `json:"kprobe,omitempty"`
// Kprobe *KprobeProgramInfoState `json:"kprobe,omitempty"`

// // kretprobe defines the desired state of the application's KretprobePrograms.
// // +unionMember
// // +optional
// Kretprobe *KprobeProgramInfoNode `json:"kretprobe,omitempty"`
// Kretprobe *KprobeProgramInfoState `json:"kretprobe,omitempty"`

// // uprobe defines the desired state of the application's UprobePrograms.
// // +unionMember
// // +optional
// Uprobe *UprobeProgramInfoNode `json:"uprobe,omitempty"`
// Uprobe *UprobeProgramInfoState `json:"uprobe,omitempty"`

// // uretprobe defines the desired state of the application's UretprobePrograms.
// // +unionMember
// // +optional
// Uretprobe *UprobeProgramInfoNode `json:"uretprobe,omitempty"`
// Uretprobe *UprobeProgramInfoState `json:"uretprobe,omitempty"`

// // tracepoint defines the desired state of the application's TracepointPrograms.
// // +unionMember
// // +optional
// Tracepoint *TracepointProgramInfoNode `json:"tracepoint,omitempty"`
// Tracepoint *TracepointProgramInfoState `json:"tracepoint,omitempty"`
}

// BpfApplicationSpec defines the desired state of BpfApplication
type BpfApplicationNodeSpec struct {
// The number of times the BpfApplicationNode has been updated. Set to 1
type BpfApplicationStateSpec struct {
// The number of times the BpfApplicationState has been updated. Set to 1
// when the object is created, then it is incremented prior to each update.
// This allows us to verify that the API server has the updated object prior
// to starting a new Reconcile operation.
Expand All @@ -112,9 +112,9 @@ type BpfApplicationNodeSpec struct {
// given node.
AppLoadStatus BpfProgramConditionType `json:"apploadstatus"`
// Programs is a list of bpf programs contained in the parent application.
// It is a map from the bpf program name to BpfApplicationProgramNode
// It is a map from the bpf program name to BpfApplicationProgramState
// elements.
Programs map[string]BpfApplicationProgramNode `json:"programs,omitempty"`
Programs map[string]BpfApplicationProgramState `json:"programs,omitempty"`
}

// +genclient
Expand All @@ -123,50 +123,50 @@ type BpfApplicationNodeSpec struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

// BpfApplicationNode is the Schema for the bpfapplications API
// BpfApplicationState contains the per-node state of a BpfApplication.
// +kubebuilder:printcolumn:name="Node",type=string,JSONPath=".metadata.labels['kubernetes.io/hostname']"
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type BpfApplicationNode struct {
type BpfApplicationState struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec BpfApplicationNodeSpec `json:"spec,omitempty"`
Status BpfAppStatus `json:"status,omitempty"`
Spec BpfApplicationStateSpec `json:"spec,omitempty"`
Status BpfAppStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
// BpfApplicationList contains a list of BpfApplications
type BpfApplicationNodeList struct {
// BpfApplicationStateList contains a list of BpfApplicationState objects
type BpfApplicationStateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BpfApplicationNode `json:"items"`
Items []BpfApplicationState `json:"items"`
}

func (an BpfApplicationNode) GetName() string {
func (an BpfApplicationState) GetName() string {
return an.Name
}

func (an BpfApplicationNode) GetUID() metav1types.UID {
func (an BpfApplicationState) GetUID() metav1types.UID {
return an.UID
}

func (an BpfApplicationNode) GetAnnotations() map[string]string {
func (an BpfApplicationState) GetAnnotations() map[string]string {
return an.Annotations
}

func (an BpfApplicationNode) GetLabels() map[string]string {
func (an BpfApplicationState) GetLabels() map[string]string {
return an.Labels
}

func (an BpfApplicationNode) GetStatus() *BpfAppStatus {
func (an BpfApplicationState) GetStatus() *BpfAppStatus {
return &an.Status
}

func (an BpfApplicationNode) GetClientObject() client.Object {
func (an BpfApplicationState) GetClientObject() client.Object {
return &an
}

func (anl BpfApplicationNodeList) GetItems() []BpfApplicationNode {
func (anl BpfApplicationStateList) GetItems() []BpfApplicationState {
return anl.Items
}
10 changes: 5 additions & 5 deletions apis/v1alpha1/fentryProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ type FentryProgramList struct {
Items []FentryProgram `json:"items"`
}

type FentryProgramInfoNode struct {
type FentryProgramInfoState struct {
// The list of points to which the program should be attached.
// FentryAttachInfoNode is similar to FentryAttachInfo, but the interface and
// FentryAttachInfoState is similar to FentryAttachInfo, but the interface and
// container selectors are expanded, and we have one instance of
// FentryAttachInfoNode for each unique attach point. The list is optional and
// FentryAttachInfoState for each unique attach point. The list is optional and
// may be udated after the bpf program has been loaded.
// +optional
AttachPoint FentryAttachInfoNode `json:"attach_points"`
AttachPoint FentryAttachInfoState `json:"attach_points"`
}

type FentryAttachInfoNode struct {
type FentryAttachInfoState struct {
AttachInfoCommon `json:",inline"`
// An identifier for the attach point assigned by bpfman. This field is
// empty until the program is successfully attached and bpfman returns the
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ type BpfAppCommon struct {
MapOwnerSelector *metav1.LabelSelector `json:"mapownerselector"`
}

// BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode object
// BpfAppStatus reflects the status of a BpfApplication or BpfApplicationState object
type BpfAppStatus struct {
// For a BpfApplication object, Conditions contains the global cluster state
// for the object. For a BpfApplicationNode object, Conditions contains the
// for the object. For a BpfApplicationState object, Conditions contains the
// state of the BpfApplication object on the given node.
// +patchMergeKey=type
// +patchStrategy=merge
Expand Down
10 changes: 5 additions & 5 deletions apis/v1alpha1/tcProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ type TcProgramList struct {
Items []TcProgram `json:"items"`
}

type TcProgramInfoNode struct {
type TcProgramInfoState struct {
// The list of points to which the program should be attached.
// TcAttachInfoNode is similar to TcAttachInfo, but the interface and
// TcAttachInfoState is similar to TcAttachInfo, but the interface and
// container selectors are expanded, and we have one instance of
// TcAttachInfoNode for each unique attach point. The list is optional and
// TcAttachInfoState for each unique attach point. The list is optional and
// may be udated after the bpf program has been loaded.
// +optional
AttachPoints []TcAttachInfoNode `json:"attach_points"`
AttachPoints []TcAttachInfoState `json:"attach_points"`
}

type TcAttachInfoNode struct {
type TcAttachInfoState struct {
AttachInfoCommon `json:",inline"`
// An identifier for the attach point assigned by bpfman. This field is
// empty until the program is successfully attached and bpfman returns the
Expand Down
13 changes: 6 additions & 7 deletions apis/v1alpha1/xdpProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,16 @@ type XdpProgramList struct {
Items []XdpProgram `json:"items"`
}

type XdpProgramInfoNode struct {
type XdpProgramInfoState struct {
// The list of points to which the program should be attached.
// XdpAttachInfoNode is similar to XdpAttachInfo, but the interface and
// XdpAttachInfoState is similar to XdpAttachInfo, but the interface and
// container selectors are expanded, and we have one instance of
// XdpAttachInfoNode for each unique attach point. The list is optional and
// may be udated after the bpf program has been loaded.
// +optional
AttachPoints []XdpAttachInfoNode `json:"attach_points"`
// XdpAttachInfoState for each unique attach point. The list is optional and
// may be udated after the bpf program has been loaded. +optional
AttachPoints []XdpAttachInfoState `json:"attach_points"`
}

type XdpAttachInfoNode struct {
type XdpAttachInfoState struct {
AttachInfoCommon `json:",inline"`

// Interface name to attach the xdp program to.
Expand Down
Loading

0 comments on commit 5ca1b84

Please sign in to comment.