Skip to content

Commit 3407094

Browse files
committed
next-api-change
Signed-off-by: Andreas Karis <[email protected]>
1 parent b2c7e23 commit 3407094

31 files changed

+1211
-480
lines changed

apis/v1alpha1/bpf_application_state_types.go

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type BpfApplicationProgramState struct {
5050
// +unionDiscriminator
5151
// +required
5252
// +kubebuilder:validation:Enum:="XDP";"TC";"TCX";"UProbe";"URetProbe"
53-
Type EBPFProgType `json:"type"`
53+
Type EBPFProgType `json:"type,omitempty"`
5454

5555
// xdp contains the attachment data for an XDP program when type is set to XDP.
5656
// +unionMember
@@ -81,14 +81,30 @@ type BpfApplicationProgramState struct {
8181
}
8282

8383
type BpfApplicationStateStatus struct {
84-
// UpdateCount tracks the number of times the BpfApplicationState object has
84+
// conditions contains the summary state of the BpfApplication for the given
85+
// Kubernetes node. If one or more programs failed to load or attach to the
86+
// designated attachment point, the condition will report the error. If more
87+
// than one error has occurred, condition will contain the first error
88+
// encountered.
89+
// +patchMergeKey=type
90+
// +patchStrategy=merge
91+
// +listType=map
92+
// +listMapKey=type
93+
// +optional
94+
// +kubebuilder:validation:MaxItems=1023
95+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
96+
// updateCount tracks the number of times the BpfApplicationState object has
8597
// been updated. The bpfman agent initializes it to 1 when it creates the
8698
// object, and then increments it before each subsequent update. It serves
8799
// as a lightweight sequence number to verify that the API server is serving
88100
// the most recent version of the object before beginning a new Reconcile
89101
// operation.
102+
// +kubebuilder:validation:Minimum=0
103+
// +optional
90104
UpdateCount int64 `json:"updateCount"`
91-
// node is the name of the Kubernets node for this BpfApplicationState.
105+
// node is the name of the Kubernetes node for this BpfApplicationState.
106+
// +kubebuilder:validation:MaxLength=253
107+
// +optional
92108
Node string `json:"node"`
93109
// appLoadStatus reflects the status of loading the eBPF application on the
94110
// given node.
@@ -111,21 +127,15 @@ type BpfApplicationStateStatus struct {
111127
//
112128
// UnloadError is returned if one or more programs encountered an error when
113129
// being unloaded.
130+
// +optional
114131
AppLoadStatus AppLoadStatus `json:"appLoadStatus"`
115132
// programs is a list of eBPF programs contained in the parent BpfApplication
116133
// instance. Each entry in the list contains the derived program attributes as
117134
// well as the attach status for each program on the given Kubernetes node.
135+
// +kubebuilder:validation:MaxItems=1023
136+
// +listType=atomic
137+
// +optional
118138
Programs []BpfApplicationProgramState `json:"programs,omitempty"`
119-
// conditions contains the summary state of the BpfApplication for the given
120-
// Kubernetes node. If one or more programs failed to load or attach to the
121-
// designated attachment point, the condition will report the error. If more
122-
// than one error has occurred, condition will contain the first error
123-
// encountered.
124-
// +patchMergeKey=type
125-
// +patchStrategy=merge
126-
// +listType=map
127-
// +listMapKey=type
128-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
129139
}
130140

131141
// +genclient
@@ -141,13 +151,16 @@ type BpfApplicationStateStatus struct {
141151
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`
142152
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
143153
type BpfApplicationState struct {
144-
metav1.TypeMeta `json:",inline"`
154+
metav1.TypeMeta `json:",inline"`
155+
// metadata is the object's metadata.
156+
// +optional
145157
metav1.ObjectMeta `json:"metadata,omitempty"`
146158

147159
// status reflects the status of a BpfApplication instance for the given node.
148160
// appLoadStatus and conditions provide an overall status for the given node,
149161
// while each item in the programs list provides a per eBPF program status for
150162
// the given node.
163+
// +optional
151164
Status BpfApplicationStateStatus `json:"status,omitempty"`
152165
}
153166

apis/v1alpha1/bpf_application_types.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type BpfApplicationProgram struct {
3131
// name is a required field and is the name of the function that is the entry
3232
// point for the eBPF program. name must not be an empty string, must not
3333
// exceed 64 characters in length, must start with alpha characters and must
34-
// only contain alphanumeric characters.
34+
// only contain alphanumeric characters and underscores.
3535
// +required
3636
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
3737
// +kubebuilder:validation:MinLength=1
@@ -164,6 +164,8 @@ type BpfApplicationSpec struct {
164164
// effecting. For this reason, modifying the list is currently not allowed.
165165
// +required
166166
// +kubebuilder:validation:MinItems:=1
167+
// +kubebuilder:validation:MaxItems=1023
168+
// +listType=atomic
167169
Programs []BpfApplicationProgram `json:"programs,omitempty"`
168170
}
169171

@@ -185,11 +187,17 @@ type BpfApplicationSpec struct {
185187
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`
186188
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
187189
type BpfApplication struct {
188-
metav1.TypeMeta `json:",inline"`
190+
metav1.TypeMeta `json:",inline"`
191+
// metadata is the object's metadata.
192+
// +optional
189193
metav1.ObjectMeta `json:"metadata,omitempty"`
190194

191-
Spec BpfApplicationSpec `json:"spec,omitempty"`
192-
Status BpfAppStatus `json:"status,omitempty"`
195+
// spec defines the desired state of the BpfApplication.
196+
// +required
197+
Spec BpfApplicationSpec `json:"spec,omitempty"`
198+
// status reflects the observed state of the BpfApplication.
199+
// +optional
200+
Status BpfAppStatus `json:"status,omitempty"`
193201
}
194202

195203
// +kubebuilder:object:root=true

apis/v1alpha1/cluster_bpf_application_state_types.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,29 @@ type ClBpfApplicationProgramState struct {
132132
}
133133

134134
type ClBpfApplicationStateStatus struct {
135-
// 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
136148
// been updated. The bpfman agent initializes it to 1 when it creates the
137149
// object, and then increments it before each subsequent update. It serves
138150
// as a lightweight sequence number to verify that the API server is serving
139151
// the most recent version of the object before beginning a new Reconcile
140152
// operation.
153+
// +optional
141154
UpdateCount int64 `json:"updateCount"`
142155
// node is the name of the Kubernetes node for this ClusterBpfApplicationState.
156+
// +kubebuilder:validation:MaxLength=253
157+
// +optional
143158
Node string `json:"node"`
144159
// appLoadStatus reflects the status of loading the eBPF application on the
145160
// given node.
@@ -160,22 +175,16 @@ type ClBpfApplicationStateStatus struct {
160175
//
161176
// UnloadError is returned if one or more programs encountered an error when
162177
// being unloaded.
178+
// +optional
163179
AppLoadStatus AppLoadStatus `json:"appLoadStatus"`
164180
// programs is a list of eBPF programs contained in the parent
165181
// ClusterBpfApplication instance. Each entry in the list contains the derived
166182
// program attributes as well as the attach status for each program on the
167183
// given Kubernetes node.
184+
// +kubebuilder:validation:MaxItems=1023
185+
// +listType=atomic
186+
// +optional
168187
Programs []ClBpfApplicationProgramState `json:"programs,omitempty"`
169-
// conditions contains the summary state of the ClusterBpfApplication for the
170-
// given Kubernetes node. If one or more programs failed to load or attach to
171-
// the designated attachment point, the condition will report the error. If
172-
// more than one error has occurred, condition will contain the first error
173-
// encountered.
174-
// +patchMergeKey=type
175-
// +patchStrategy=merge
176-
// +listType=map
177-
// +listMapKey=type
178-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
179188
}
180189

181190
// +genclient
@@ -192,13 +201,16 @@ type ClBpfApplicationStateStatus struct {
192201
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`
193202
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
194203
type ClusterBpfApplicationState struct {
195-
metav1.TypeMeta `json:",inline"`
204+
metav1.TypeMeta `json:",inline"`
205+
// metadata is the object's metadata.
206+
// +optional
196207
metav1.ObjectMeta `json:"metadata,omitempty"`
197208

198209
// status reflects the status of a ClusterBpfApplication instance for the given
199210
// node. appLoadStatus and conditions provide an overall status for the given
200211
// node, while each item in the programs list provides a per eBPF program
201212
// status for the given node.
213+
// +optional
202214
Status ClBpfApplicationStateStatus `json:"status,omitempty"`
203215
}
204216

apis/v1alpha1/cluster_bpf_application_types.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type ClBpfApplicationProgram struct {
7777
// name is a required field and is the name of the function that is the entry
7878
// point for the eBPF program. name must not be an empty string, must not
7979
// exceed 64 characters in length, must start with alpha characters and must
80-
// only contain alphanumeric characters.
80+
// only contain alphanumeric characters and underscores.
8181
// +required
8282
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
8383
// +kubebuilder:validation:MinLength=1
@@ -293,7 +293,9 @@ type ClBpfApplicationSpec struct {
293293
// effecting. For this reason, modifying the list is currently not allowed.
294294
// +required
295295
// +kubebuilder:validation:MinItems:=1
296-
Programs []ClBpfApplicationProgram `json:"programs"`
296+
// +kubebuilder:validation:MaxItems=1023
297+
// +listType=atomic
298+
Programs []ClBpfApplicationProgram `json:"programs,omitempty"`
297299
}
298300

299301
// +genclient
@@ -316,11 +318,17 @@ type ClBpfApplicationSpec struct {
316318
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason`
317319
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
318320
type ClusterBpfApplication struct {
319-
metav1.TypeMeta `json:",inline"`
321+
metav1.TypeMeta `json:",inline"`
322+
// metadata is the standard object's metadata.
323+
// +optional
320324
metav1.ObjectMeta `json:"metadata,omitempty"`
321325

322-
Spec ClBpfApplicationSpec `json:"spec,omitempty"`
323-
Status BpfAppStatus `json:"status,omitempty"`
326+
// spec defines the desired state of the BpfApplication.
327+
// +required
328+
Spec ClBpfApplicationSpec `json:"spec,omitempty"`
329+
// status reflects the observed state of the BpfApplication.
330+
// +optional
331+
Status BpfAppStatus `json:"status,omitempty"`
324332
}
325333

326334
// +kubebuilder:object:root=true

apis/v1alpha1/cluster_fentry_program_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type ClFentryProgramInfo struct {
3030
// the program, add an entry to links with mode set to Attach. To detach it,
3131
// remove the entry from links.
3232
// +optional
33+
// +listType=atomic
3334
// +kubebuilder:validation:MaxItems=1
3435
Links []ClFentryAttachInfo `json:"links,omitempty"`
3536
}
@@ -43,7 +44,7 @@ type ClFentryLoadInfo struct {
4344
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
4445
// +kubebuilder:validation:MinLength=1
4546
// +kubebuilder:validation:MaxLength=64
46-
Function string `json:"function"`
47+
Function string `json:"function,omitempty"`
4748
}
4849

4950
type AttachTypeAttach string
@@ -68,6 +69,7 @@ type ClFentryProgramInfoState struct {
6869
// successful or not on this node, a linkId, which is the kernel ID for the
6970
// link if successfully attached, and other attachment specific data.
7071
// +optional
72+
// +listType=atomic
7173
// +kubebuilder:validation:MaxItems=1
7274
Links []ClFentryAttachInfoState `json:"links,omitempty"`
7375
}

apis/v1alpha1/cluster_fexit_program_types.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,22 @@ type ClFexitProgramInfo struct {
3030
// the program, add an entry to links with mode set to Attach. To detach it,
3131
// remove the entry from links.
3232
// +optional
33+
// +listType=atomic
3334
// +kubebuilder:validation:MaxItems=1
3435
Links []ClFexitAttachInfo `json:"links,omitempty"`
3536
}
3637

3738
type ClFexitLoadInfo struct {
3839
// function is a required field and specifies the name of the Linux kernel
3940
// function to attach the FExit program. function must not be an empty string,
40-
// must not exceed 64 characters in length, must start with alpha characters
41-
// and must only contain alphanumeric characters.
41+
// must be between 1 and 64 characters in length, must start with alpha
42+
// characters and must only contain alphanumeric characters and underscores.
43+
// The pattern ^[a-zA-Z][a-zA-Z0-9_]+. is enforced.
4244
// +required
4345
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
4446
// +kubebuilder:validation:MinLength=1
4547
// +kubebuilder:validation:MaxLength=64
46-
Function string `json:"function"`
48+
Function string `json:"function,omitempty"`
4749
}
4850

4951
type ClFexitAttachInfo struct {
@@ -62,6 +64,7 @@ type ClFexitProgramInfoState struct {
6264
// successful or not, a linkId, which is the kernel ID for the link if
6365
// successfully attached, and other attachment specific data.
6466
// +optional
67+
// +listType=atomic
6568
// +kubebuilder:validation:MaxItems=1
6669
Links []ClFexitAttachInfoState `json:"links,omitempty"`
6770
}

apis/v1alpha1/cluster_kprobe_program_types.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,22 @@ type ClKprobeProgramInfo struct {
3131
// default, the eBPF program is triggered at the entry of the attachment point,
3232
// but the attachment point can be adjusted using an optional offset.
3333
// +optional
34+
// +kubebuilder:validation:MaxItems=1
35+
// +listType=atomic
3436
Links []ClKprobeAttachInfo `json:"links,omitempty"`
3537
}
3638

3739
type ClKprobeAttachInfo struct {
3840
// function is a required field and specifies the name of the Linux kernel
3941
// function to attach the KProbe program. function must not be an empty string,
40-
// must not exceed 64 characters in length, must start with alpha characters
41-
// and must only contain alphanumeric characters.
42+
// must be between 1 and 64 characters in length, must start with alpha
43+
// characters and must only contain alphanumeric characters and underscores.
44+
// The pattern ^[a-zA-Z][a-zA-Z0-9_]+. is enforced.
4245
// +required
4346
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
4447
// +kubebuilder:validation:MinLength=1
4548
// +kubebuilder:validation:MaxLength=64
46-
Function string `json:"function"`
49+
Function string `json:"function,omitempty"`
4750

4851
// offset is an optional field and the value is added to the address of the
4952
// attachment point function. If not provided, offset defaults to 0.
@@ -58,15 +61,22 @@ type ClKprobeProgramInfoState struct {
5861
// successful or not on this node, a linkId, which is the kernel ID for the
5962
// link if successfully attached, and other attachment specific data.
6063
// +optional
64+
// +kubebuilder:validation:MaxItems=1023
65+
// +listType=atomic
6166
Links []ClKprobeAttachInfoState `json:"links,omitempty"`
6267
}
6368

6469
type ClKprobeAttachInfoState struct {
6570
AttachInfoStateCommon `json:",inline"`
6671

67-
// function is the provisioned name of the Linux kernel function the KProbe
68-
// program should be attached.
72+
// function is a required field and specifies the name of the Linux kernel
73+
// function to attach the Kprobe. function must not be an empty
74+
// string, must not exceed 64 characters in length, must start with alpha
75+
// characters and must only contain alphanumeric characters.
6976
// +required
77+
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
78+
// +kubebuilder:validation:MinLength=1
79+
// +kubebuilder:validation:MaxLength=64
7080
Function string `json:"function"`
7181

7282
// offset is the provisioned offset, whose value is added to the address of the

apis/v1alpha1/cluster_kretprobe_program_types.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ type ClKretprobeProgramInfo struct {
2929
//
3030
// The attachment point for a KRetProbe program is a Linux kernel function.
3131
// +optional
32+
// +kubebuilder:validation:MaxItems=1023
33+
// +listType=atomic
3234
Links []ClKretprobeAttachInfo `json:"links,omitempty"`
3335
}
3436

@@ -50,13 +52,21 @@ type ClKretprobeProgramInfoState struct {
5052
// successful or not on this node, a linkId, which is the kernel ID for the
5153
// link if successfully attached, and other attachment specific data.
5254
// +optional
55+
// +kubebuilder:validation:MaxItems=1023
56+
// +listType=atomic
5357
Links []ClKretprobeAttachInfoState `json:"links,omitempty"`
5458
}
5559

5660
type ClKretprobeAttachInfoState struct {
5761
AttachInfoStateCommon `json:",inline"`
5862

59-
// function is the provisioned name of the Linux kernel function the KRetProbe
60-
// program should be attached.
63+
// function is a required field and specifies the name of the Linux kernel
64+
// function to attach the KRetProbe program. function must not be an empty
65+
// string, must not exceed 64 characters in length, must start with alpha
66+
// characters and must only contain alphanumeric characters.
67+
// +required
68+
// +kubebuilder:validation:Pattern="^[a-zA-Z][a-zA-Z0-9_]+."
69+
// +kubebuilder:validation:MinLength=1
70+
// +kubebuilder:validation:MaxLength=64
6171
Function string `json:"function"`
6272
}

0 commit comments

Comments
 (0)