@@ -18,8 +18,6 @@ package v1alpha1
1818
1919import  (
2020	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 
21- 	metav1types "k8s.io/apimachinery/pkg/types" 
22- 	"sigs.k8s.io/controller-runtime/pkg/client" 
2321)
2422
2523// +union 
@@ -73,7 +71,7 @@ type ClBpfApplicationProgramState struct {
7371	// +unionDiscriminator 
7472	// +required 
7573	// +kubebuilder:validation:Enum:="FEntry";"FExit";"KProbe";"KRetProbe";"TC";"TCX";"TracePoint";"UProbe";"URetProbe";"XDP" 
76- 	Type  EBPFProgType  `json:"type"` 
74+ 	Type  EBPFProgType  `json:"type,omitempty "` 
7775
7876	// xdp contains the attachment data for an XDP program when type is set to XDP. 
7977	// +unionMember 
@@ -134,15 +132,32 @@ type ClBpfApplicationProgramState struct {
134132}
135133
136134type  ClBpfApplicationStateStatus  struct  {
137- 	// UpdateCount tracks the number of times the BpfApplicationState object has 
135+ 	// conditions contains the summary state of the ClusterBpfApplication for the 
136+ 	// given Kubernetes node. If one or more programs failed to load or attach to 
137+ 	// the designated attachment point, the condition will report the error. If 
138+ 	// more than one error has occurred, condition will contain the first error 
139+ 	// encountered. 
140+ 	// +patchMergeKey=type 
141+ 	// +patchStrategy=merge 
142+ 	// +listType=map 
143+ 	// +listMapKey=type 
144+ 	// +optional 
145+ 	// +kubebuilder:validation:MaxItems=1023 
146+ 	Conditions  []metav1.Condition  `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` 
147+ 	// updateCount tracks the number of times the BpfApplicationState object has 
138148	// been updated. The bpfman agent initializes it to 1 when it creates the 
139149	// object, and then increments it before each subsequent update. It serves 
140150	// as a lightweight sequence number to verify that the API server is serving 
141151	// the most recent version of the object before beginning a new Reconcile 
142152	// operation. 
143- 	UpdateCount  int64  `json:"updateCount"` 
153+ 	// +kubebuilder:validation:Minimum=1 
154+ 	// +optional 
155+ 	UpdateCount  int64  `json:"updateCount,omitempty"` 
144156	// node is the name of the Kubernetes node for this ClusterBpfApplicationState. 
145- 	Node  string  `json:"node"` 
157+ 	// +kubebuilder:validation:MinLength=1 
158+ 	// +kubebuilder:validation:MaxLength=253 
159+ 	// +optional 
160+ 	Node  string  `json:"node,omitempty"` 
146161	// appLoadStatus reflects the status of loading the eBPF application on the 
147162	// given node. 
148163	// 
@@ -162,22 +177,16 @@ type ClBpfApplicationStateStatus struct {
162177	// 
163178	// UnloadError is returned if one or more programs encountered an error when 
164179	// being unloaded. 
165- 	AppLoadStatus  AppLoadStatus  `json:"appLoadStatus"` 
180+ 	// +optional 
181+ 	AppLoadStatus  AppLoadStatus  `json:"appLoadStatus,omitempty"` 
166182	// programs is a list of eBPF programs contained in the parent 
167183	// ClusterBpfApplication instance. Each entry in the list contains the derived 
168184	// program attributes as well as the attach status for each program on the 
169185	// given Kubernetes node. 
186+ 	// +kubebuilder:validation:MaxItems=1023 
187+ 	// +listType=atomic 
188+ 	// +optional 
170189	Programs  []ClBpfApplicationProgramState  `json:"programs,omitempty"` 
171- 	// conditions contains the summary state of the ClusterBpfApplication for the 
172- 	// given Kubernetes node. If one or more programs failed to load or attach to 
173- 	// the designated attachment point, the condition will report the error. If 
174- 	// more than one error has occurred, condition will contain the first error 
175- 	// encountered. 
176- 	// +patchMergeKey=type 
177- 	// +patchStrategy=merge 
178- 	// +listType=map 
179- 	// +listMapKey=type 
180- 	Conditions  []metav1.Condition  `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` 
181190}
182191
183192// +genclient 
@@ -194,13 +203,16 @@ type ClBpfApplicationStateStatus struct {
194203// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason` 
195204// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" 
196205type  ClusterBpfApplicationState  struct  {
197- 	metav1.TypeMeta    `json:",inline"` 
206+ 	metav1.TypeMeta  `json:",inline"` 
207+ 	// metadata is the object's metadata. 
208+ 	// +optional 
198209	metav1.ObjectMeta  `json:"metadata,omitempty"` 
199210
200211	// status reflects the status of a ClusterBpfApplication instance for the given 
201212	// node. appLoadStatus and conditions provide an overall status for the given 
202213	// node, while each item in the programs list provides a per eBPF program 
203214	// status for the given node. 
215+ 	// +optional 
204216	Status  ClBpfApplicationStateStatus  `json:"status,omitempty"` 
205217}
206218
@@ -211,31 +223,3 @@ type ClusterBpfApplicationStateList struct {
211223	metav1.ListMeta  `json:"metadata,omitempty"` 
212224	Items            []ClusterBpfApplicationState  `json:"items"` 
213225}
214- 
215- func  (an  ClusterBpfApplicationState ) GetName () string  {
216- 	return  an .Name 
217- }
218- 
219- func  (an  ClusterBpfApplicationState ) GetUID () metav1types.UID  {
220- 	return  an .UID 
221- }
222- 
223- func  (an  ClusterBpfApplicationState ) GetAnnotations () map [string ]string  {
224- 	return  an .Annotations 
225- }
226- 
227- func  (an  ClusterBpfApplicationState ) GetLabels () map [string ]string  {
228- 	return  an .Labels 
229- }
230- 
231- func  (an  ClusterBpfApplicationState ) GetConditions () []metav1.Condition  {
232- 	return  an .Status .Conditions 
233- }
234- 
235- func  (an  ClusterBpfApplicationState ) GetClientObject () client.Object  {
236- 	return  & an 
237- }
238- 
239- func  (anl  ClusterBpfApplicationStateList ) GetItems () []ClusterBpfApplicationState  {
240- 	return  anl .Items 
241- }
0 commit comments