diff --git a/apis/v1alpha1/bpfApplicationNode_types.go b/apis/v1alpha1/bpfApplicationNode_types.go new file mode 100644 index 000000000..d995a04b7 --- /dev/null +++ b/apis/v1alpha1/bpfApplicationNode_types.go @@ -0,0 +1,130 @@ +/* +Copyright 2023 The bpfman Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BpfApplicationProgramNode 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" +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'TCX' ? has(self.tcx) : !has(self.tcx)",message="tcx configuration is required when type is TCX, and forbidden otherwise" +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Fentry' ? has(self.fentry) : !has(self.fentry)",message="fentry configuration is required when type is Fentry, and forbidden otherwise" +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Fexit' ? has(self.fexit) : !has(self.fexit)",message="fexit configuration is required when type is Fexit, and forbidden otherwise" +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Kprobe' ? has(self.kprobe) : !has(self.kprobe)",message="kprobe configuration is required when type is Kprobe, and forbidden otherwise" +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Kretprobe' ? has(self.kretprobe) : !has(self.kretprobe)",message="kretprobe configuration is required when type is Kretprobe, and forbidden otherwise" +// +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 specifies the bpf program type + // +unionDiscriminator + // +kubebuilder:validation:Required + // +kubebuilder:validation:Enum:="XDP";"TC";"TCX";"Fentry";"Fexit";"Kprobe";"Kretprobe";"Uprobe";"Uretprobe";"Tracepoint" + Type EBPFProgType `json:"type,omitempty"` + + // xdp defines the desired state of the application's XdpPrograms. + // +unionMember + // +optional + XDP *XdpProgramInfoNode `json:"xdp,omitempty"` + + // tc defines the desired state of the application's TcPrograms. + // +unionMember + // +optional + TC *TcProgramInfoNode `json:"tc,omitempty"` + + // // tcx defines the desired state of the application's TcxPrograms. + // // +unionMember + // // +optional + // TCX *TcxProgramInfoNode `json:"tcx,omitempty"` + + // fentry defines the desired state of the application's FentryPrograms. + // +unionMember + // +optional + Fentry *FentryProgramInfoNode `json:"fentry,omitempty"` + + // // fexit defines the desired state of the application's FexitPrograms. + // // +unionMember + // // +optional + // Fexit *FexitProgramInfoNode `json:"fexit,omitempty"` + + // // kprobe defines the desired state of the application's KprobePrograms. + // // +unionMember + // // +optional + // Kprobe *KprobeProgramInfoNode `json:"kprobe,omitempty"` + + // // kretprobe defines the desired state of the application's KretprobePrograms. + // // +unionMember + // // +optional + // Kretprobe *KprobeProgramInfoNode `json:"kretprobe,omitempty"` + + // // uprobe defines the desired state of the application's UprobePrograms. + // // +unionMember + // // +optional + // Uprobe *UprobeProgramInfoNode `json:"uprobe,omitempty"` + + // // uretprobe defines the desired state of the application's UretprobePrograms. + // // +unionMember + // // +optional + // Uretprobe *UprobeProgramInfoNode `json:"uretprobe,omitempty"` + + // // tracepoint defines the desired state of the application's TracepointPrograms. + // // +unionMember + // // +optional + // Tracepoint *TracepointProgramInfoNode `json:"tracepoint,omitempty"` +} + +// BpfApplicationSpec defines the desired state of BpfApplication +type BpfApplicationNodeSpec struct { + // Programs is a list of bpf programs contained in the parent application. + // It is a map from the bpf program name to BpfApplicationProgramNode + // elements. + Programs map[string]BpfApplicationProgramNode `json:"programs,omitempty"` +} + +// BpfApplicationStatus defines the observed state of BpfApplication +type BpfApplicationNodeStatus struct { + BpfAppStatus `json:",inline"` +} + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster + +// BpfApplicationNode is the Schema for the bpfapplications API +// +kubebuilder:printcolumn:name="NodeSelector",type=string,JSONPath=`.spec.nodeselector` +// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[0].reason` +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type BpfApplicationNode struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BpfApplicationNodeSpec `json:"spec,omitempty"` + Status BpfAppStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// BpfApplicationList contains a list of BpfApplications +type BpfApplicationNodeList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BpfApplicationNode `json:"items"` +} diff --git a/apis/v1alpha1/fentryProgram_types.go b/apis/v1alpha1/fentryProgram_types.go index e48912dbc..44438fb06 100644 --- a/apis/v1alpha1/fentryProgram_types.go +++ b/apis/v1alpha1/fentryProgram_types.go @@ -73,3 +73,22 @@ type FentryProgramList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []FentryProgram `json:"items"` } + +type FentryProgramInfoNode struct { + AppProgramStatus `json:",inline"` + // The list of points to which the program should be attached. + // FentryAttachInfoNode 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 + // may be udated after the bpf program has been loaded. + // +optional + AttachPoint FentryAttachInfoNode `json:"attach_points"` +} + +type FentryAttachInfoNode struct { + AttachStatus `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 + // id. + attachId *uint32 `json:"attachid"` +} diff --git a/apis/v1alpha1/shared_types.go b/apis/v1alpha1/shared_types.go index a16c01752..d82113420 100644 --- a/apis/v1alpha1/shared_types.go +++ b/apis/v1alpha1/shared_types.go @@ -100,10 +100,11 @@ type BpfAppCommon struct { ByteCode BytecodeSelector `json:"bytecode"` } -// BpfAppStatus defines the BpfProgram status +// BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode object type BpfAppStatus struct { - // Conditions houses the global cluster state for the eBPFProgram. The explicit - // condition types are defined internally. + // For a BpfApplication object, Conditions contains the global cluster state + // for the object. For a BpfApplicationNode object, Conditions contains the + // state of the BpfApplication object on the given node. // +patchMergeKey=type // +patchStrategy=merge // +listType=map @@ -111,6 +112,38 @@ type BpfAppStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` } +// AppProgramStatus defines the status for a given bpf application program on a given node. +type AppProgramStatus struct { + // ShouldLoad reflects whether the program should be loaded. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + ShouldLoad []metav1.Condition `json:"should_load,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + // IsLoaded reflects whether the program should be loaded. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + IsLoaded []metav1.Condition `json:"is_loaded,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +// AttachStatus defines the status for one attach point for a given bpf application program +type AttachStatus struct { + // ShouldAttach reflects whether the attachment should exist. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + ShouldAttach []metav1.Condition `json:"should_attach,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + // IsAttached reflects whether the attachment exists. + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + IsAttached []metav1.Condition `json:"is_attached,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 0960d2a69..991dcab66 100644 --- a/apis/v1alpha1/tcProgram_types.go +++ b/apis/v1alpha1/tcProgram_types.go @@ -99,3 +99,46 @@ type TcProgramList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []TcProgram `json:"items"` } + +type TcProgramInfoNode struct { + AppProgramStatus `json:",inline"` + // The list of points to which the program should be attached. + // TcAttachInfoNode 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 + // may be udated after the bpf program has been loaded. + // +optional + AttachPoints []TcAttachInfoNode `json:"attach_points"` +} + +type TcAttachInfoNode struct { + AttachStatus `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 + // id. + attachId *uint32 `json:"attachid"` + + // Interface name to attach the tc program to. + ifName string `json:"ifname"` + + // Optional container pid to attach the tc program in. + // +optional + containerPid *uint32 `json:"containerpid"` + + // Priority specifies the priority of the tc program in relation to + // other programs of the same type with the same attach point. It is a value + // from 0 to 1000 where lower values have higher precedence. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=1000 + Priority int32 `json:"priority"` + + // Direction specifies the direction of traffic the tc program should + // attach to for a given network device. + // +kubebuilder:validation:Enum=ingress;egress + Direction string `json:"direction"` + + // ProceedOn allows the user to call other tc programs in chain on this exit code. + // Multiple values are supported by repeating the parameter. + // +kubebuilder:validation:MaxItems=11 + ProceedOn []TcProceedOnValue `json:"proceedon"` +} diff --git a/apis/v1alpha1/xdpProgram_types.go b/apis/v1alpha1/xdpProgram_types.go index 8184a9f8f..74aed4107 100644 --- a/apis/v1alpha1/xdpProgram_types.go +++ b/apis/v1alpha1/xdpProgram_types.go @@ -99,3 +99,41 @@ type XdpProgramList struct { metav1.ListMeta `json:"metadata,omitempty"` Items []XdpProgram `json:"items"` } + +type XdpProgramInfoNode struct { + AppProgramStatus `json:",inline"` + // The list of points to which the program should be attached. + // XdpAttachInfoNode 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"` +} + +type XdpAttachInfoNode struct { + AttachStatus `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 + // id. + AttachId *uint32 `json:"attachid"` + + // Interface name to attach the xdp program to. + IfName string `json:"ifname"` + + // Optional container pid to attach the xdp program in. + // +optional + ContainerPid *uint32 `json:"containerpid"` + + // Priority specifies the priority of the xdp program in relation to + // other programs of the same type with the same attach point. It is a value + // from 0 to 1000 where lower values have higher precedence. + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=1000 + Priority int32 `json:"priority"` + + // ProceedOn allows the user to call other xdp programs in chain on this exit code. + // Multiple values are supported by repeating the parameter. + // +kubebuilder:validation:MaxItems=6 + ProceedOn []XdpProceedOnValue `json:"proceedon"` +} diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 3ed569c9a..eb52fe1fd 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -25,6 +25,64 @@ 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 *AppProgramStatus) DeepCopyInto(out *AppProgramStatus) { + *out = *in + if in.ShouldLoad != nil { + in, out := &in.ShouldLoad, &out.ShouldLoad + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.IsLoaded != nil { + in, out := &in.IsLoaded, &out.IsLoaded + *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 AppProgramStatus. +func (in *AppProgramStatus) DeepCopy() *AppProgramStatus { + if in == nil { + return nil + } + out := new(AppProgramStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AttachStatus) DeepCopyInto(out *AttachStatus) { + *out = *in + if in.ShouldAttach != nil { + in, out := &in.ShouldAttach, &out.ShouldAttach + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.IsAttached != nil { + in, out := &in.IsAttached, &out.IsAttached + *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 AttachStatus. +func (in *AttachStatus) DeepCopy() *AttachStatus { + if in == nil { + return nil + } + out := new(AttachStatus) + in.DeepCopyInto(out) + return out +} + // 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 @@ -139,6 +197,103 @@ func (in *BpfApplicationList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfApplicationNode) DeepCopyInto(out *BpfApplicationNode) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfApplicationNode. +func (in *BpfApplicationNode) DeepCopy() *BpfApplicationNode { + if in == nil { + return nil + } + out := new(BpfApplicationNode) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BpfApplicationNode) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfApplicationNodeList) DeepCopyInto(out *BpfApplicationNodeList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BpfApplicationNode, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfApplicationNodeList. +func (in *BpfApplicationNodeList) DeepCopy() *BpfApplicationNodeList { + if in == nil { + return nil + } + out := new(BpfApplicationNodeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BpfApplicationNodeList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfApplicationNodeSpec) DeepCopyInto(out *BpfApplicationNodeSpec) { + *out = *in + if in.Programs != nil { + in, out := &in.Programs, &out.Programs + *out = make(map[string]BpfApplicationProgramNode, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfApplicationNodeSpec. +func (in *BpfApplicationNodeSpec) DeepCopy() *BpfApplicationNodeSpec { + if in == nil { + return nil + } + out := new(BpfApplicationNodeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfApplicationNodeStatus) DeepCopyInto(out *BpfApplicationNodeStatus) { + *out = *in + in.BpfAppStatus.DeepCopyInto(&out.BpfAppStatus) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfApplicationNodeStatus. +func (in *BpfApplicationNodeStatus) DeepCopy() *BpfApplicationNodeStatus { + if in == nil { + return nil + } + out := new(BpfApplicationNodeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BpfApplicationProgram) DeepCopyInto(out *BpfApplicationProgram) { *out = *in @@ -204,6 +359,36 @@ func (in *BpfApplicationProgram) DeepCopy() *BpfApplicationProgram { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BpfApplicationProgramNode) DeepCopyInto(out *BpfApplicationProgramNode) { + *out = *in + if in.XDP != nil { + in, out := &in.XDP, &out.XDP + *out = new(XdpProgramInfoNode) + (*in).DeepCopyInto(*out) + } + if in.TC != nil { + in, out := &in.TC, &out.TC + *out = new(TcProgramInfoNode) + (*in).DeepCopyInto(*out) + } + if in.Fentry != nil { + in, out := &in.Fentry, &out.Fentry + *out = new(FentryProgramInfoNode) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BpfApplicationProgramNode. +func (in *BpfApplicationProgramNode) DeepCopy() *BpfApplicationProgramNode { + if in == nil { + return nil + } + out := new(BpfApplicationProgramNode) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BpfApplicationSpec) DeepCopyInto(out *BpfApplicationSpec) { *out = *in @@ -631,6 +816,27 @@ func (in *ContainerSelector) DeepCopy() *ContainerSelector { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FentryAttachInfoNode) DeepCopyInto(out *FentryAttachInfoNode) { + *out = *in + in.AttachStatus.DeepCopyInto(&out.AttachStatus) + if in.attachId != nil { + in, out := &in.attachId, &out.attachId + *out = new(uint32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FentryAttachInfoNode. +func (in *FentryAttachInfoNode) DeepCopy() *FentryAttachInfoNode { + if in == nil { + return nil + } + out := new(FentryAttachInfoNode) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *FentryLoadInfo) DeepCopyInto(out *FentryLoadInfo) { *out = *in @@ -690,6 +896,23 @@ func (in *FentryProgramInfo) DeepCopy() *FentryProgramInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FentryProgramInfoNode) DeepCopyInto(out *FentryProgramInfoNode) { + *out = *in + in.AppProgramStatus.DeepCopyInto(&out.AppProgramStatus) + in.AttachPoint.DeepCopyInto(&out.AttachPoint) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FentryProgramInfoNode. +func (in *FentryProgramInfoNode) DeepCopy() *FentryProgramInfoNode { + if in == nil { + return nil + } + out := new(FentryProgramInfoNode) + 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 @@ -1029,6 +1252,37 @@ func (in *TcAttachInfo) DeepCopy() *TcAttachInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TcAttachInfoNode) DeepCopyInto(out *TcAttachInfoNode) { + *out = *in + in.AttachStatus.DeepCopyInto(&out.AttachStatus) + if in.attachId != nil { + in, out := &in.attachId, &out.attachId + *out = new(uint32) + **out = **in + } + if in.containerPid != nil { + in, out := &in.containerPid, &out.containerPid + *out = new(uint32) + **out = **in + } + 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 TcAttachInfoNode. +func (in *TcAttachInfoNode) DeepCopy() *TcAttachInfoNode { + if in == nil { + return nil + } + out := new(TcAttachInfoNode) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TcNsAttachInfo) DeepCopyInto(out *TcNsAttachInfo) { *out = *in @@ -1200,6 +1454,29 @@ func (in *TcProgramInfo) DeepCopy() *TcProgramInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TcProgramInfoNode) DeepCopyInto(out *TcProgramInfoNode) { + *out = *in + in.AppProgramStatus.DeepCopyInto(&out.AppProgramStatus) + if in.AttachPoints != nil { + in, out := &in.AttachPoints, &out.AttachPoints + *out = make([]TcAttachInfoNode, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TcProgramInfoNode. +func (in *TcProgramInfoNode) DeepCopy() *TcProgramInfoNode { + if in == nil { + return nil + } + out := new(TcProgramInfoNode) + 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 @@ -1857,6 +2134,37 @@ func (in *XdpAttachInfo) DeepCopy() *XdpAttachInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *XdpAttachInfoNode) DeepCopyInto(out *XdpAttachInfoNode) { + *out = *in + in.AttachStatus.DeepCopyInto(&out.AttachStatus) + if in.AttachId != nil { + in, out := &in.AttachId, &out.AttachId + *out = new(uint32) + **out = **in + } + if in.ContainerPid != nil { + in, out := &in.ContainerPid, &out.ContainerPid + *out = new(uint32) + **out = **in + } + 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 XdpAttachInfoNode. +func (in *XdpAttachInfoNode) DeepCopy() *XdpAttachInfoNode { + if in == nil { + return nil + } + out := new(XdpAttachInfoNode) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *XdpNsAttachInfo) DeepCopyInto(out *XdpNsAttachInfo) { *out = *in @@ -2028,6 +2336,29 @@ func (in *XdpProgramInfo) DeepCopy() *XdpProgramInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *XdpProgramInfoNode) DeepCopyInto(out *XdpProgramInfoNode) { + *out = *in + in.AppProgramStatus.DeepCopyInto(&out.AppProgramStatus) + if in.AttachPoints != nil { + in, out := &in.AttachPoints, &out.AttachPoints + *out = make([]XdpAttachInfoNode, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new XdpProgramInfoNode. +func (in *XdpProgramInfoNode) DeepCopy() *XdpProgramInfoNode { + if in == nil { + return nil + } + out := new(XdpProgramInfoNode) + 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 diff --git a/apis/v1alpha1/zz_generated.register.go b/apis/v1alpha1/zz_generated.register.go index 569ccddcd..36f0c2322 100644 --- a/apis/v1alpha1/zz_generated.register.go +++ b/apis/v1alpha1/zz_generated.register.go @@ -63,6 +63,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &BpfApplication{}, &BpfApplicationList{}, + &BpfApplicationNode{}, + &BpfApplicationNodeList{}, &BpfNsApplication{}, &BpfNsApplicationList{}, &BpfNsProgram{}, diff --git a/config/crd/bases/bpfman.io_bpfapplicationnodes.yaml b/config/crd/bases/bpfman.io_bpfapplicationnodes.yaml new file mode 100644 index 000000000..83da5fde9 --- /dev/null +++ b/config/crd/bases/bpfman.io_bpfapplicationnodes.yaml @@ -0,0 +1,1291 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: bpfapplicationnodes.bpfman.io +spec: + group: bpfman.io + names: + kind: BpfApplicationNode + listKind: BpfApplicationNodeList + plural: bpfapplicationnodes + singular: bpfapplicationnode + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .spec.nodeselector + name: NodeSelector + type: string + - jsonPath: .status.conditions[0].reason + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: BpfApplicationNode is the Schema for the bpfapplications API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: BpfApplicationSpec defines the desired state of BpfApplication + properties: + programs: + additionalProperties: + description: BpfApplicationProgramNode defines the desired state + of BpfApplication + properties: + fentry: + description: fentry defines the desired state of the application's + FentryPrograms. + properties: + attach_points: + description: |- + The list of points to which the program should be attached. + FentryAttachInfoNode 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 + may be udated after the bpf program has been loaded. + properties: + attachid: + description: |- + An identifier for the attach point assigned by bpfman. This field is + empty until the program is successfully attached and bpfman returns the + id. + format: int32 + type: integer + is_attached: + description: IsAttached reflects whether the attachment + exists. + 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 + should_attach: + description: ShouldAttach reflects whether the attachment + should exist. + 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 + required: + - attachid + type: object + is_loaded: + description: IsLoaded reflects whether the program should + be loaded. + 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 + should_load: + description: ShouldLoad reflects whether the program should + be loaded. + 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 + tc: + description: tc defines the desired state of the application's + TcPrograms. + properties: + attach_points: + description: |- + The list of points to which the program should be attached. + TcAttachInfoNode 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 + may be udated after the bpf program has been loaded. + items: + properties: + attachid: + description: |- + An identifier for the attach point assigned by bpfman. This field is + empty until the program is successfully attached and bpfman returns the + id. + format: int32 + type: integer + containerpid: + description: Optional container pid to attach the + tc program in. + format: int32 + type: integer + direction: + description: |- + Direction specifies the direction of traffic the tc program should + attach to for a given network device. + enum: + - ingress + - egress + type: string + ifname: + description: Interface name to attach the tc program + to. + type: string + is_attached: + description: IsAttached reflects whether the attachment + exists. + 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 + priority: + description: |- + Priority specifies the priority of the tc program in relation to + other programs of the same type with the same attach point. It is a value + from 0 to 1000 where lower values have higher precedence. + format: int32 + maximum: 1000 + minimum: 0 + type: integer + proceedon: + description: |- + ProceedOn allows the user to call other tc programs in chain on this exit code. + Multiple values are supported by repeating the parameter. + items: + enum: + - unspec + - ok + - reclassify + - shot + - pipe + - stolen + - queued + - repeat + - redirect + - trap + - dispatcher_return + type: string + maxItems: 11 + type: array + should_attach: + description: ShouldAttach reflects whether the attachment + should exist. + 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 + required: + - attachid + - direction + - ifname + - priority + - proceedon + type: object + type: array + is_loaded: + description: IsLoaded reflects whether the program should + be loaded. + 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 + should_load: + description: ShouldLoad reflects whether the program should + be loaded. + 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 + type: + description: Type specifies the bpf program type + enum: + - XDP + - TC + - TCX + - Fentry + - Fexit + - Kprobe + - Kretprobe + - Uprobe + - Uretprobe + - Tracepoint + type: string + xdp: + description: xdp defines the desired state of the application's + XdpPrograms. + properties: + attach_points: + description: |- + The list of points to which the program should be attached. + XdpAttachInfoNode 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. + items: + properties: + attachid: + description: |- + An identifier for the attach point assigned by bpfman. This field is + empty until the program is successfully attached and bpfman returns the + id. + format: int32 + type: integer + containerpid: + description: Optional container pid to attach the + xdp program in. + format: int32 + type: integer + ifname: + description: Interface name to attach the xdp program + to. + type: string + is_attached: + description: IsAttached reflects whether the attachment + exists. + 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 + priority: + description: |- + Priority specifies the priority of the xdp program in relation to + other programs of the same type with the same attach point. It is a value + from 0 to 1000 where lower values have higher precedence. + format: int32 + maximum: 1000 + minimum: 0 + type: integer + proceedon: + description: |- + ProceedOn allows the user to call other xdp programs in chain on this exit code. + Multiple values are supported by repeating the parameter. + items: + enum: + - aborted + - drop + - pass + - tx + - redirect + - dispatcher_return + type: string + maxItems: 6 + type: array + should_attach: + description: ShouldAttach reflects whether the attachment + should exist. + 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 + required: + - attachid + - ifname + - priority + - proceedon + type: object + type: array + is_loaded: + description: IsLoaded reflects whether the program should + be loaded. + 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 + should_load: + description: ShouldLoad reflects whether the program should + be loaded. + 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 + type: object + x-kubernetes-validations: + - message: xdp configuration is required when type is XDP, and forbidden + otherwise + rule: 'has(self.type) && self.type == ''XDP'' ? has(self.xdp) + : !has(self.xdp)' + - message: tc configuration is required when type is TC, and forbidden + otherwise + rule: 'has(self.type) && self.type == ''TC'' ? has(self.tc) : + !has(self.tc)' + - message: tcx configuration is required when type is TCX, and forbidden + otherwise + rule: 'has(self.type) && self.type == ''TCX'' ? has(self.tcx) + : !has(self.tcx)' + - message: fentry configuration is required when type is Fentry, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''Fentry'' ? has(self.fentry) + : !has(self.fentry)' + - message: fexit configuration is required when type is Fexit, and + forbidden otherwise + rule: 'has(self.type) && self.type == ''Fexit'' ? has(self.fexit) + : !has(self.fexit)' + - message: kprobe configuration is required when type is Kprobe, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''Kprobe'' ? has(self.kprobe) + : !has(self.kprobe)' + - message: kretprobe configuration is required when type is Kretprobe, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''Kretprobe'' ? has(self.kretprobe) + : !has(self.kretprobe)' + - message: uprobe configuration is required when type is Uprobe, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''Uprobe'' ? has(self.uprobe) + : !has(self.uprobe)' + - message: uretprobe configuration is required when type is Uretprobe, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''Uretprobe'' ? has(self.uretprobe) + : !has(self.uretprobe)' + - message: tracepoint configuration is required when type is Tracepoint, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''Tracepoint'' ? has(self.tracepoint) + : !has(self.tracepoint)' + description: |- + Programs is a list of bpf programs contained in the parent application. + It is a map from the bpf program name to BpfApplicationProgramNode + elements. + type: object + type: object + status: + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object + properties: + conditions: + description: |- + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. + 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 + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/crd/bases/bpfman.io_bpfapplications.yaml b/config/crd/bases/bpfman.io_bpfapplications.yaml index 9b84447d9..6a0c325dc 100644 --- a/config/crd/bases/bpfman.io_bpfapplications.yaml +++ b/config/crd/bases/bpfman.io_bpfapplications.yaml @@ -1527,12 +1527,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_bpfnsapplications.yaml b/config/crd/bases/bpfman.io_bpfnsapplications.yaml index 669b6edd3..2474636a2 100644 --- a/config/crd/bases/bpfman.io_bpfnsapplications.yaml +++ b/config/crd/bases/bpfman.io_bpfnsapplications.yaml @@ -1085,12 +1085,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_fentryprograms.yaml b/config/crd/bases/bpfman.io_fentryprograms.yaml index c36eec352..3e4608a4f 100644 --- a/config/crd/bases/bpfman.io_fentryprograms.yaml +++ b/config/crd/bases/bpfman.io_fentryprograms.yaml @@ -229,12 +229,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_fexitprograms.yaml b/config/crd/bases/bpfman.io_fexitprograms.yaml index ff3a4c088..e32a6ad98 100644 --- a/config/crd/bases/bpfman.io_fexitprograms.yaml +++ b/config/crd/bases/bpfman.io_fexitprograms.yaml @@ -229,12 +229,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_kprobeprograms.yaml b/config/crd/bases/bpfman.io_kprobeprograms.yaml index 541523e0b..e8cb7b881 100644 --- a/config/crd/bases/bpfman.io_kprobeprograms.yaml +++ b/config/crd/bases/bpfman.io_kprobeprograms.yaml @@ -254,12 +254,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_tcnsprograms.yaml b/config/crd/bases/bpfman.io_tcnsprograms.yaml index e86713552..8183b80d5 100644 --- a/config/crd/bases/bpfman.io_tcnsprograms.yaml +++ b/config/crd/bases/bpfman.io_tcnsprograms.yaml @@ -364,12 +364,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_tcprograms.yaml b/config/crd/bases/bpfman.io_tcprograms.yaml index 210075eb4..760b2d6fb 100644 --- a/config/crd/bases/bpfman.io_tcprograms.yaml +++ b/config/crd/bases/bpfman.io_tcprograms.yaml @@ -368,12 +368,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_tcxnsprograms.yaml b/config/crd/bases/bpfman.io_tcxnsprograms.yaml index dca655b33..8786be80d 100644 --- a/config/crd/bases/bpfman.io_tcxnsprograms.yaml +++ b/config/crd/bases/bpfman.io_tcxnsprograms.yaml @@ -342,12 +342,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_tcxprograms.yaml b/config/crd/bases/bpfman.io_tcxprograms.yaml index 0cf48abd2..41dbb6a41 100644 --- a/config/crd/bases/bpfman.io_tcxprograms.yaml +++ b/config/crd/bases/bpfman.io_tcxprograms.yaml @@ -345,12 +345,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_tracepointprograms.yaml b/config/crd/bases/bpfman.io_tracepointprograms.yaml index 41ca99e40..5dc57e510 100644 --- a/config/crd/bases/bpfman.io_tracepointprograms.yaml +++ b/config/crd/bases/bpfman.io_tracepointprograms.yaml @@ -233,12 +233,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_uprobensprograms.yaml b/config/crd/bases/bpfman.io_uprobensprograms.yaml index 7c6899509..0b3ce4f3c 100644 --- a/config/crd/bases/bpfman.io_uprobensprograms.yaml +++ b/config/crd/bases/bpfman.io_uprobensprograms.yaml @@ -336,12 +336,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_uprobeprograms.yaml b/config/crd/bases/bpfman.io_uprobeprograms.yaml index d12810757..948f71a3b 100644 --- a/config/crd/bases/bpfman.io_uprobeprograms.yaml +++ b/config/crd/bases/bpfman.io_uprobeprograms.yaml @@ -339,12 +339,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_xdpnsprograms.yaml b/config/crd/bases/bpfman.io_xdpnsprograms.yaml index f34f5e478..8b270c355 100644 --- a/config/crd/bases/bpfman.io_xdpnsprograms.yaml +++ b/config/crd/bases/bpfman.io_xdpnsprograms.yaml @@ -350,8 +350,9 @@ spec: properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/config/crd/bases/bpfman.io_xdpprograms.yaml b/config/crd/bases/bpfman.io_xdpprograms.yaml index 16540bc41..8f29077f6 100644 --- a/config/crd/bases/bpfman.io_xdpprograms.yaml +++ b/config/crd/bases/bpfman.io_xdpprograms.yaml @@ -347,12 +347,14 @@ spec: - nodeselector type: object status: - description: BpfAppStatus defines the BpfProgram status + description: BpfAppStatus reflects the status of a BpfApplication or BpfApplicationNode + object properties: conditions: description: |- - Conditions houses the global cluster state for the eBPFProgram. The explicit - condition types are defined internally. + For a BpfApplication object, Conditions contains the global cluster state + for the object. For a BpfApplicationNode object, Conditions contains the + state of the BpfApplication object on the given node. items: description: "Condition contains details for one aspect of the current state of this API Resource.\n---\nThis struct is intended for diff --git a/pkg/client/apis/v1alpha1/bpfapplicationnode.go b/pkg/client/apis/v1alpha1/bpfapplicationnode.go new file mode 100644 index 000000000..945299521 --- /dev/null +++ b/pkg/client/apis/v1alpha1/bpfapplicationnode.go @@ -0,0 +1,68 @@ +/* +Copyright 2023 The bpfman Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BpfApplicationNodeLister helps list BpfApplicationNodes. +// All objects returned here must be treated as read-only. +type BpfApplicationNodeLister interface { + // List lists all BpfApplicationNodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.BpfApplicationNode, err error) + // Get retrieves the BpfApplicationNode from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.BpfApplicationNode, error) + BpfApplicationNodeListerExpansion +} + +// bpfApplicationNodeLister implements the BpfApplicationNodeLister interface. +type bpfApplicationNodeLister struct { + indexer cache.Indexer +} + +// NewBpfApplicationNodeLister returns a new BpfApplicationNodeLister. +func NewBpfApplicationNodeLister(indexer cache.Indexer) BpfApplicationNodeLister { + return &bpfApplicationNodeLister{indexer: indexer} +} + +// List lists all BpfApplicationNodes in the indexer. +func (s *bpfApplicationNodeLister) List(selector labels.Selector) (ret []*v1alpha1.BpfApplicationNode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.BpfApplicationNode)) + }) + return ret, err +} + +// Get retrieves the BpfApplicationNode from the index for a given name. +func (s *bpfApplicationNodeLister) Get(name string) (*v1alpha1.BpfApplicationNode, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("bpfapplicationnode"), name) + } + return obj.(*v1alpha1.BpfApplicationNode), nil +} diff --git a/pkg/client/apis/v1alpha1/expansion_generated.go b/pkg/client/apis/v1alpha1/expansion_generated.go index 491e889c5..180cc3b92 100644 --- a/pkg/client/apis/v1alpha1/expansion_generated.go +++ b/pkg/client/apis/v1alpha1/expansion_generated.go @@ -22,6 +22,10 @@ package v1alpha1 // BpfApplicationLister. type BpfApplicationListerExpansion interface{} +// BpfApplicationNodeListerExpansion allows custom methods to be added to +// BpfApplicationNodeLister. +type BpfApplicationNodeListerExpansion interface{} + // BpfNsApplicationListerExpansion allows custom methods to be added to // BpfNsApplicationLister. type BpfNsApplicationListerExpansion interface{} diff --git a/pkg/client/clientset/typed/apis/v1alpha1/apis_client.go b/pkg/client/clientset/typed/apis/v1alpha1/apis_client.go index 7ec7b412d..e5d073b64 100644 --- a/pkg/client/clientset/typed/apis/v1alpha1/apis_client.go +++ b/pkg/client/clientset/typed/apis/v1alpha1/apis_client.go @@ -29,6 +29,7 @@ import ( type BpfmanV1alpha1Interface interface { RESTClient() rest.Interface BpfApplicationsGetter + BpfApplicationNodesGetter BpfNsApplicationsGetter BpfNsProgramsGetter BpfProgramsGetter @@ -55,6 +56,10 @@ func (c *BpfmanV1alpha1Client) BpfApplications() BpfApplicationInterface { return newBpfApplications(c) } +func (c *BpfmanV1alpha1Client) BpfApplicationNodes() BpfApplicationNodeInterface { + return newBpfApplicationNodes(c) +} + func (c *BpfmanV1alpha1Client) BpfNsApplications(namespace string) BpfNsApplicationInterface { return newBpfNsApplications(c, namespace) } diff --git a/pkg/client/clientset/typed/apis/v1alpha1/bpfapplicationnode.go b/pkg/client/clientset/typed/apis/v1alpha1/bpfapplicationnode.go new file mode 100644 index 000000000..7917e9661 --- /dev/null +++ b/pkg/client/clientset/typed/apis/v1alpha1/bpfapplicationnode.go @@ -0,0 +1,184 @@ +/* +Copyright 2023 The bpfman Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" + scheme "github.com/bpfman/bpfman-operator/pkg/client/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BpfApplicationNodesGetter has a method to return a BpfApplicationNodeInterface. +// A group's client should implement this interface. +type BpfApplicationNodesGetter interface { + BpfApplicationNodes() BpfApplicationNodeInterface +} + +// BpfApplicationNodeInterface has methods to work with BpfApplicationNode resources. +type BpfApplicationNodeInterface interface { + Create(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.CreateOptions) (*v1alpha1.BpfApplicationNode, error) + Update(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.UpdateOptions) (*v1alpha1.BpfApplicationNode, error) + UpdateStatus(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.UpdateOptions) (*v1alpha1.BpfApplicationNode, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.BpfApplicationNode, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BpfApplicationNodeList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BpfApplicationNode, err error) + BpfApplicationNodeExpansion +} + +// bpfApplicationNodes implements BpfApplicationNodeInterface +type bpfApplicationNodes struct { + client rest.Interface +} + +// newBpfApplicationNodes returns a BpfApplicationNodes +func newBpfApplicationNodes(c *BpfmanV1alpha1Client) *bpfApplicationNodes { + return &bpfApplicationNodes{ + client: c.RESTClient(), + } +} + +// Get takes name of the bpfApplicationNode, and returns the corresponding bpfApplicationNode object, and an error if there is any. +func (c *bpfApplicationNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BpfApplicationNode, err error) { + result = &v1alpha1.BpfApplicationNode{} + err = c.client.Get(). + Resource("bpfapplicationnodes"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BpfApplicationNodes that match those selectors. +func (c *bpfApplicationNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BpfApplicationNodeList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.BpfApplicationNodeList{} + err = c.client.Get(). + Resource("bpfapplicationnodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested bpfApplicationNodes. +func (c *bpfApplicationNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("bpfapplicationnodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a bpfApplicationNode and creates it. Returns the server's representation of the bpfApplicationNode, and an error, if there is any. +func (c *bpfApplicationNodes) Create(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.CreateOptions) (result *v1alpha1.BpfApplicationNode, err error) { + result = &v1alpha1.BpfApplicationNode{} + err = c.client.Post(). + Resource("bpfapplicationnodes"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bpfApplicationNode). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a bpfApplicationNode and updates it. Returns the server's representation of the bpfApplicationNode, and an error, if there is any. +func (c *bpfApplicationNodes) Update(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.UpdateOptions) (result *v1alpha1.BpfApplicationNode, err error) { + result = &v1alpha1.BpfApplicationNode{} + err = c.client.Put(). + Resource("bpfapplicationnodes"). + Name(bpfApplicationNode.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bpfApplicationNode). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *bpfApplicationNodes) UpdateStatus(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.UpdateOptions) (result *v1alpha1.BpfApplicationNode, err error) { + result = &v1alpha1.BpfApplicationNode{} + err = c.client.Put(). + Resource("bpfapplicationnodes"). + Name(bpfApplicationNode.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bpfApplicationNode). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the bpfApplicationNode and deletes it. Returns an error if one occurs. +func (c *bpfApplicationNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("bpfapplicationnodes"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *bpfApplicationNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("bpfapplicationnodes"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched bpfApplicationNode. +func (c *bpfApplicationNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BpfApplicationNode, err error) { + result = &v1alpha1.BpfApplicationNode{} + err = c.client.Patch(pt). + Resource("bpfapplicationnodes"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go b/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go index 9e7d2f76c..1c91439c3 100644 --- a/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go +++ b/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_apis_client.go @@ -32,6 +32,10 @@ func (c *FakeBpfmanV1alpha1) BpfApplications() v1alpha1.BpfApplicationInterface return &FakeBpfApplications{c} } +func (c *FakeBpfmanV1alpha1) BpfApplicationNodes() v1alpha1.BpfApplicationNodeInterface { + return &FakeBpfApplicationNodes{c} +} + func (c *FakeBpfmanV1alpha1) BpfNsApplications(namespace string) v1alpha1.BpfNsApplicationInterface { return &FakeBpfNsApplications{c, namespace} } diff --git a/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_bpfapplicationnode.go b/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_bpfapplicationnode.go new file mode 100644 index 000000000..5690cf258 --- /dev/null +++ b/pkg/client/clientset/typed/apis/v1alpha1/fake/fake_bpfapplicationnode.go @@ -0,0 +1,132 @@ +/* +Copyright 2023 The bpfman Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBpfApplicationNodes implements BpfApplicationNodeInterface +type FakeBpfApplicationNodes struct { + Fake *FakeBpfmanV1alpha1 +} + +var bpfapplicationnodesResource = v1alpha1.SchemeGroupVersion.WithResource("bpfapplicationnodes") + +var bpfapplicationnodesKind = v1alpha1.SchemeGroupVersion.WithKind("BpfApplicationNode") + +// Get takes name of the bpfApplicationNode, and returns the corresponding bpfApplicationNode object, and an error if there is any. +func (c *FakeBpfApplicationNodes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BpfApplicationNode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(bpfapplicationnodesResource, name), &v1alpha1.BpfApplicationNode{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BpfApplicationNode), err +} + +// List takes label and field selectors, and returns the list of BpfApplicationNodes that match those selectors. +func (c *FakeBpfApplicationNodes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BpfApplicationNodeList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(bpfapplicationnodesResource, bpfapplicationnodesKind, opts), &v1alpha1.BpfApplicationNodeList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.BpfApplicationNodeList{ListMeta: obj.(*v1alpha1.BpfApplicationNodeList).ListMeta} + for _, item := range obj.(*v1alpha1.BpfApplicationNodeList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested bpfApplicationNodes. +func (c *FakeBpfApplicationNodes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(bpfapplicationnodesResource, opts)) +} + +// Create takes the representation of a bpfApplicationNode and creates it. Returns the server's representation of the bpfApplicationNode, and an error, if there is any. +func (c *FakeBpfApplicationNodes) Create(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.CreateOptions) (result *v1alpha1.BpfApplicationNode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(bpfapplicationnodesResource, bpfApplicationNode), &v1alpha1.BpfApplicationNode{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BpfApplicationNode), err +} + +// Update takes the representation of a bpfApplicationNode and updates it. Returns the server's representation of the bpfApplicationNode, and an error, if there is any. +func (c *FakeBpfApplicationNodes) Update(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.UpdateOptions) (result *v1alpha1.BpfApplicationNode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(bpfapplicationnodesResource, bpfApplicationNode), &v1alpha1.BpfApplicationNode{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BpfApplicationNode), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBpfApplicationNodes) UpdateStatus(ctx context.Context, bpfApplicationNode *v1alpha1.BpfApplicationNode, opts v1.UpdateOptions) (*v1alpha1.BpfApplicationNode, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(bpfapplicationnodesResource, "status", bpfApplicationNode), &v1alpha1.BpfApplicationNode{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BpfApplicationNode), err +} + +// Delete takes name of the bpfApplicationNode and deletes it. Returns an error if one occurs. +func (c *FakeBpfApplicationNodes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(bpfapplicationnodesResource, name, opts), &v1alpha1.BpfApplicationNode{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBpfApplicationNodes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(bpfapplicationnodesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.BpfApplicationNodeList{}) + return err +} + +// Patch applies the patch and returns the patched bpfApplicationNode. +func (c *FakeBpfApplicationNodes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BpfApplicationNode, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bpfapplicationnodesResource, name, pt, data, subresources...), &v1alpha1.BpfApplicationNode{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.BpfApplicationNode), err +} diff --git a/pkg/client/clientset/typed/apis/v1alpha1/generated_expansion.go b/pkg/client/clientset/typed/apis/v1alpha1/generated_expansion.go index 3b956a1a6..11de54a6b 100644 --- a/pkg/client/clientset/typed/apis/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/typed/apis/v1alpha1/generated_expansion.go @@ -20,6 +20,8 @@ package v1alpha1 type BpfApplicationExpansion interface{} +type BpfApplicationNodeExpansion interface{} + type BpfNsApplicationExpansion interface{} type BpfNsProgramExpansion interface{} diff --git a/pkg/client/externalversions/apis/v1alpha1/bpfapplicationnode.go b/pkg/client/externalversions/apis/v1alpha1/bpfapplicationnode.go new file mode 100644 index 000000000..7a6c7212e --- /dev/null +++ b/pkg/client/externalversions/apis/v1alpha1/bpfapplicationnode.go @@ -0,0 +1,89 @@ +/* +Copyright 2023 The bpfman Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + apisv1alpha1 "github.com/bpfman/bpfman-operator/apis/v1alpha1" + v1alpha1 "github.com/bpfman/bpfman-operator/pkg/client/apis/v1alpha1" + clientset "github.com/bpfman/bpfman-operator/pkg/client/clientset" + internalinterfaces "github.com/bpfman/bpfman-operator/pkg/client/externalversions/internalinterfaces" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// BpfApplicationNodeInformer provides access to a shared informer and lister for +// BpfApplicationNodes. +type BpfApplicationNodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.BpfApplicationNodeLister +} + +type bpfApplicationNodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewBpfApplicationNodeInformer constructs a new informer for BpfApplicationNode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBpfApplicationNodeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBpfApplicationNodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredBpfApplicationNodeInformer constructs a new informer for BpfApplicationNode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredBpfApplicationNodeInformer(client clientset.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BpfmanV1alpha1().BpfApplicationNodes().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BpfmanV1alpha1().BpfApplicationNodes().Watch(context.TODO(), options) + }, + }, + &apisv1alpha1.BpfApplicationNode{}, + resyncPeriod, + indexers, + ) +} + +func (f *bpfApplicationNodeInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBpfApplicationNodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *bpfApplicationNodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisv1alpha1.BpfApplicationNode{}, f.defaultInformer) +} + +func (f *bpfApplicationNodeInformer) Lister() v1alpha1.BpfApplicationNodeLister { + return v1alpha1.NewBpfApplicationNodeLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/externalversions/apis/v1alpha1/interface.go b/pkg/client/externalversions/apis/v1alpha1/interface.go index 7ca2dcbec..f138e26eb 100644 --- a/pkg/client/externalversions/apis/v1alpha1/interface.go +++ b/pkg/client/externalversions/apis/v1alpha1/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // BpfApplications returns a BpfApplicationInformer. BpfApplications() BpfApplicationInformer + // BpfApplicationNodes returns a BpfApplicationNodeInformer. + BpfApplicationNodes() BpfApplicationNodeInformer // BpfNsApplications returns a BpfNsApplicationInformer. BpfNsApplications() BpfNsApplicationInformer // BpfNsPrograms returns a BpfNsProgramInformer. @@ -74,6 +76,11 @@ func (v *version) BpfApplications() BpfApplicationInformer { return &bpfApplicationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// BpfApplicationNodes returns a BpfApplicationNodeInformer. +func (v *version) BpfApplicationNodes() BpfApplicationNodeInformer { + return &bpfApplicationNodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // BpfNsApplications returns a BpfNsApplicationInformer. func (v *version) BpfNsApplications() BpfNsApplicationInformer { return &bpfNsApplicationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/externalversions/generic.go b/pkg/client/externalversions/generic.go index 2d084ef57..3b6020da3 100644 --- a/pkg/client/externalversions/generic.go +++ b/pkg/client/externalversions/generic.go @@ -55,6 +55,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=bpfman.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("bpfapplications"): return &genericInformer{resource: resource.GroupResource(), informer: f.Bpfman().V1alpha1().BpfApplications().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("bpfapplicationnodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Bpfman().V1alpha1().BpfApplicationNodes().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("bpfnsapplications"): return &genericInformer{resource: resource.GroupResource(), informer: f.Bpfman().V1alpha1().BpfNsApplications().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("bpfnsprograms"):