Skip to content

Commit

Permalink
Make existing controllers work with new CRDs
Browse files Browse the repository at this point in the history
Limitation: They only work with a single attach point per program.

Signed-off-by: Andre Fredette <[email protected]>
  • Loading branch information
anfredette committed Dec 10, 2024
1 parent aa91d11 commit 9724cf0
Show file tree
Hide file tree
Showing 61 changed files with 1,064 additions and 882 deletions.
4 changes: 2 additions & 2 deletions apis/v1alpha1/bpfapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ type BpfApplication struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec BpfApplicationSpec `json:"spec,omitempty"`
Status BpfApplicationStatus `json:"status,omitempty"`
Spec BpfApplicationSpec `json:"spec,omitempty"`
Status BpfAppStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
9 changes: 5 additions & 4 deletions apis/v1alpha1/fentryProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ type FentryProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// FentryProgramSpec defines the desired state of FentryProgram
Expand All @@ -51,11 +52,11 @@ type FentryProgramSpec struct {
type FentryProgramInfo struct {
BpfProgramCommon `json:",inline"`
FentryLoadInfo `json:",inline"`
// Whether the program should be attached to the function.
// This may be updated after the program has been loaded.
// Whether the program should be attached to the function.
// This may be updated after the program has been loaded.
// +optional
// +kubebuilder:default=false
attach bool `json:"attach,omitempty"`
Attach bool `json:"attach,omitempty"`
}

// FentryLoadInfo contains the program-specific load information for Fentry
Expand Down
5 changes: 3 additions & 2 deletions apis/v1alpha1/fexitProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ type FexitProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// FexitProgramSpec defines the desired state of FexitProgram
Expand All @@ -55,7 +56,7 @@ type FexitProgramInfo struct {
// This may be updated after the program has been loaded.
// +optional
// +kubebuilder:default=false
attach bool `json:"attach,omitempty"`
Attach bool `json:"attach,omitempty"`
}

// FexitLoadInfo contains the program-specific load information for Fexit
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/kprobeProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type KprobeProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// KprobeProgramSpec defines the desired state of KprobeProgram
Expand Down
3 changes: 0 additions & 3 deletions apis/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ type BpfAppCommon struct {
// Bytecode configures where the bpf program's bytecode should be loaded
// from.
ByteCode BytecodeSelector `json:"bytecode"`

// Status of the BpfApp
Status BpfAppStatus `json:"status,omitempty"`
}

// BpfAppStatus defines the BpfProgram status
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/tcProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ type TcProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// +kubebuilder:validation:Enum=unspec;ok;reclassify;shot;pipe;stolen;queued;repeat;redirect;trap;dispatcher_return
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/tcxProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ type TcxProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// TcxProgramSpec defines the desired state of TcxProgram
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/tracepointProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ type TracepointProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// TracepointProgramSpec defines the desired state of TracepointProgram
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/uprobeProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ type UprobeProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// UprobeProgramSpec defines the desired state of UprobeProgram
Expand Down
3 changes: 2 additions & 1 deletion apis/v1alpha1/xdpProgram_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type XdpProgram struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

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

// +kubebuilder:validation:Enum=aborted;drop;pass;tx;redirect;dispatcher_return
Expand Down
9 changes: 8 additions & 1 deletion apis/v1alpha1/zz_generated.deepcopy.go

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

83 changes: 1 addition & 82 deletions config/crd/bases/bpfman.io_bpfapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1516,93 +1516,12 @@ spec:
: !has(self.tracepoint)'
minItems: 1
type: array
status:
description: Status of the BpfApp
properties:
conditions:
description: |-
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 state of this API Resource.\n---\nThis struct is intended
for direct use as an array at the field path .status.conditions.
\ For example,\n\n\n\ttype FooStatus struct{\n\t // Represents
the observations of a foo's current state.\n\t // Known
.status.conditions.type are: \"Available\", \"Progressing\",
and \"Degraded\"\n\t // +patchMergeKey=type\n\t // +patchStrategy=merge\n\t
\ // +listType=map\n\t // +listMapKey=type\n\t Conditions
[]metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\"
patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False,
Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
type: object
required:
- bytecode
- nodeselector
type: object
status:
description: BpfApplicationStatus defines the observed state of BpfApplication
description: BpfAppStatus defines the BpfProgram status
properties:
conditions:
description: |-
Expand Down
Loading

0 comments on commit 9724cf0

Please sign in to comment.