diff --git a/apis/v1alpha1/shared_types.go b/apis/v1alpha1/shared_types.go index c31bd8eb4..e8f27de22 100644 --- a/apis/v1alpha1/shared_types.go +++ b/apis/v1alpha1/shared_types.go @@ -21,15 +21,43 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) +// Identifies interfaces that may be in a network namespace. +type NetnsInterface struct { + // Interfaces contains the interface names to which the BPF program should + // be attached. If empty, all the interfaces in the system are selected, + // except the ones listed in ExcludeInterfaces. An entry enclosed by + // slashes, such as `/br-/`, is matched as a regular expression. Otherwise + // it is matched as a case-sensitive string. + // +optional + Interfaces []string `json:"interfaces"` + + // ExcludeInterfaces contains the interface names that are excluded from + // selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + // regular expression. Otherwise it is matched as a case-sensitive string. + // +optional + ExcludeInterfaces []string `json:"excludeInterfaces"` + + // NetworkNamespaces contains a list of network namespaces in which to look + // for the listed interfaces. If emtpy, the all network namespaces in the + // system are selected. + // +optional + NetworkNamespaces *[]string `json:"networknamespaces,omitempty"` +} + // InterfaceSelector defines interface to attach to. // +kubebuilder:validation:MaxProperties=1 // +kubebuilder:validation:MinProperties=1 type InterfaceSelector struct { - // Interfaces refers to a list of network interfaces to attach the BPF + // Interfaces contains a list of network interfaces to attach the BPF // program to. // +optional Interfaces *[]string `json:"interfaces,omitempty"` + // NetnsInterfaces contains a list of network interfaces that may be + // qualified by network namespace. + // +optional + NetnsInterfaces *[]NetnsInterface `json:"netnsinterfaces,omitempty"` + // Attach BPF program to the primary interface on the node. Only 'true' accepted. // +optional PrimaryNodeInterface *bool `json:"primarynodeinterface,omitempty"` diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 80f3b52cd..ff61a5575 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -668,6 +668,17 @@ func (in *InterfaceSelector) DeepCopyInto(out *InterfaceSelector) { copy(*out, *in) } } + if in.NetnsInterfaces != nil { + in, out := &in.NetnsInterfaces, &out.NetnsInterfaces + *out = new([]NetnsInterface) + if **in != nil { + in, out := *in, *out + *out = make([]NetnsInterface, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + } if in.PrimaryNodeInterface != nil { in, out := &in.PrimaryNodeInterface, &out.PrimaryNodeInterface *out = new(bool) @@ -793,6 +804,40 @@ func (in *KprobeProgramStatus) DeepCopy() *KprobeProgramStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetnsInterface) DeepCopyInto(out *NetnsInterface) { + *out = *in + if in.Interfaces != nil { + in, out := &in.Interfaces, &out.Interfaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludeInterfaces != nil { + in, out := &in.ExcludeInterfaces, &out.ExcludeInterfaces + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NetworkNamespaces != nil { + in, out := &in.NetworkNamespaces, &out.NetworkNamespaces + *out = new([]string) + if **in != nil { + in, out := *in, *out + *out = make([]string, len(*in)) + copy(*out, *in) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetnsInterface. +func (in *NetnsInterface) DeepCopy() *NetnsInterface { + if in == nil { + return nil + } + out := new(NetnsInterface) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TcProgram) DeepCopyInto(out *TcProgram) { *out = *in diff --git a/config/crd/bases/bpfman.io_bpfapplications.yaml b/config/crd/bases/bpfman.io_bpfapplications.yaml index 9bc282ef1..e4e9f4757 100644 --- a/config/crd/bases/bpfman.io_bpfapplications.yaml +++ b/config/crd/bases/bpfman.io_bpfapplications.yaml @@ -475,11 +475,47 @@ spec: properties: interfaces: description: |- - Interfaces refers to a list of network interfaces to attach the BPF + Interfaces contains a list of network interfaces to attach the BPF program to. items: type: string type: array + netnsinterfaces: + description: |- + NetnsInterfaces contains a list of network interfaces that may be + qualified by network namespace. + items: + description: Identifies interfaces that may be in + a network namespace. + properties: + excludeInterfaces: + description: |- + ExcludeInterfaces contains the interface names that are excluded from + selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + regular expression. Otherwise it is matched as a case-sensitive string. + items: + type: string + type: array + interfaces: + description: |- + Interfaces contains the interface names to which the BPF program should + be attached. If empty, all the interfaces in the system are selected, + except the ones listed in ExcludeInterfaces. An entry enclosed by + slashes, such as `/br-/`, is matched as a regular expression. Otherwise + it is matched as a case-sensitive string. + items: + type: string + type: array + networknamespaces: + description: |- + NetworkNamespaces contains a list of network namespaces in which to look + for the listed interfaces. If emtpy, the all network namespaces in the + system are selected. + items: + type: string + type: array + type: object + type: array primarynodeinterface: description: Attach BPF program to the primary interface on the node. Only 'true' accepted. @@ -598,11 +634,47 @@ spec: properties: interfaces: description: |- - Interfaces refers to a list of network interfaces to attach the BPF + Interfaces contains a list of network interfaces to attach the BPF program to. items: type: string type: array + netnsinterfaces: + description: |- + NetnsInterfaces contains a list of network interfaces that may be + qualified by network namespace. + items: + description: Identifies interfaces that may be in + a network namespace. + properties: + excludeInterfaces: + description: |- + ExcludeInterfaces contains the interface names that are excluded from + selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + regular expression. Otherwise it is matched as a case-sensitive string. + items: + type: string + type: array + interfaces: + description: |- + Interfaces contains the interface names to which the BPF program should + be attached. If empty, all the interfaces in the system are selected, + except the ones listed in ExcludeInterfaces. An entry enclosed by + slashes, such as `/br-/`, is matched as a regular expression. Otherwise + it is matched as a case-sensitive string. + items: + type: string + type: array + networknamespaces: + description: |- + NetworkNamespaces contains a list of network namespaces in which to look + for the listed interfaces. If emtpy, the all network namespaces in the + system are selected. + items: + type: string + type: array + type: object + type: array primarynodeinterface: description: Attach BPF program to the primary interface on the node. Only 'true' accepted. @@ -1090,11 +1162,47 @@ spec: properties: interfaces: description: |- - Interfaces refers to a list of network interfaces to attach the BPF + Interfaces contains a list of network interfaces to attach the BPF program to. items: type: string type: array + netnsinterfaces: + description: |- + NetnsInterfaces contains a list of network interfaces that may be + qualified by network namespace. + items: + description: Identifies interfaces that may be in + a network namespace. + properties: + excludeInterfaces: + description: |- + ExcludeInterfaces contains the interface names that are excluded from + selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + regular expression. Otherwise it is matched as a case-sensitive string. + items: + type: string + type: array + interfaces: + description: |- + Interfaces contains the interface names to which the BPF program should + be attached. If empty, all the interfaces in the system are selected, + except the ones listed in ExcludeInterfaces. An entry enclosed by + slashes, such as `/br-/`, is matched as a regular expression. Otherwise + it is matched as a case-sensitive string. + items: + type: string + type: array + networknamespaces: + description: |- + NetworkNamespaces contains a list of network namespaces in which to look + for the listed interfaces. If emtpy, the all network namespaces in the + system are selected. + items: + type: string + type: array + type: object + type: array primarynodeinterface: description: Attach BPF program to the primary interface on the node. Only 'true' accepted. diff --git a/config/crd/bases/bpfman.io_tcprograms.yaml b/config/crd/bases/bpfman.io_tcprograms.yaml index 29df476c7..ef1793746 100644 --- a/config/crd/bases/bpfman.io_tcprograms.yaml +++ b/config/crd/bases/bpfman.io_tcprograms.yaml @@ -140,11 +140,47 @@ spec: properties: interfaces: description: |- - Interfaces refers to a list of network interfaces to attach the BPF + Interfaces contains a list of network interfaces to attach the BPF program to. items: type: string type: array + netnsinterfaces: + description: |- + NetnsInterfaces contains a list of network interfaces that may be + qualified by network namespace. + items: + description: Identifies interfaces that may be in a network + namespace. + properties: + excludeInterfaces: + description: |- + ExcludeInterfaces contains the interface names that are excluded from + selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + regular expression. Otherwise it is matched as a case-sensitive string. + items: + type: string + type: array + interfaces: + description: |- + Interfaces contains the interface names to which the BPF program should + be attached. If empty, all the interfaces in the system are selected, + except the ones listed in ExcludeInterfaces. An entry enclosed by + slashes, such as `/br-/`, is matched as a regular expression. Otherwise + it is matched as a case-sensitive string. + items: + type: string + type: array + networknamespaces: + description: |- + NetworkNamespaces contains a list of network namespaces in which to look + for the listed interfaces. If emtpy, the all network namespaces in the + system are selected. + items: + type: string + type: array + type: object + type: array primarynodeinterface: description: Attach BPF program to the primary interface on the node. Only 'true' accepted. diff --git a/config/crd/bases/bpfman.io_tcxprograms.yaml b/config/crd/bases/bpfman.io_tcxprograms.yaml index 5b813f761..4ed181833 100644 --- a/config/crd/bases/bpfman.io_tcxprograms.yaml +++ b/config/crd/bases/bpfman.io_tcxprograms.yaml @@ -140,11 +140,47 @@ spec: properties: interfaces: description: |- - Interfaces refers to a list of network interfaces to attach the BPF + Interfaces contains a list of network interfaces to attach the BPF program to. items: type: string type: array + netnsinterfaces: + description: |- + NetnsInterfaces contains a list of network interfaces that may be + qualified by network namespace. + items: + description: Identifies interfaces that may be in a network + namespace. + properties: + excludeInterfaces: + description: |- + ExcludeInterfaces contains the interface names that are excluded from + selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + regular expression. Otherwise it is matched as a case-sensitive string. + items: + type: string + type: array + interfaces: + description: |- + Interfaces contains the interface names to which the BPF program should + be attached. If empty, all the interfaces in the system are selected, + except the ones listed in ExcludeInterfaces. An entry enclosed by + slashes, such as `/br-/`, is matched as a regular expression. Otherwise + it is matched as a case-sensitive string. + items: + type: string + type: array + networknamespaces: + description: |- + NetworkNamespaces contains a list of network namespaces in which to look + for the listed interfaces. If emtpy, the all network namespaces in the + system are selected. + items: + type: string + type: array + type: object + type: array primarynodeinterface: description: Attach BPF program to the primary interface on the node. Only 'true' accepted. diff --git a/config/crd/bases/bpfman.io_xdpprograms.yaml b/config/crd/bases/bpfman.io_xdpprograms.yaml index 131fd0435..02147f6eb 100644 --- a/config/crd/bases/bpfman.io_xdpprograms.yaml +++ b/config/crd/bases/bpfman.io_xdpprograms.yaml @@ -128,11 +128,47 @@ spec: properties: interfaces: description: |- - Interfaces refers to a list of network interfaces to attach the BPF + Interfaces contains a list of network interfaces to attach the BPF program to. items: type: string type: array + netnsinterfaces: + description: |- + NetnsInterfaces contains a list of network interfaces that may be + qualified by network namespace. + items: + description: Identifies interfaces that may be in a network + namespace. + properties: + excludeInterfaces: + description: |- + ExcludeInterfaces contains the interface names that are excluded from + selection. An entry enclosed by slashes, such as `/br-/`, is matched as a + regular expression. Otherwise it is matched as a case-sensitive string. + items: + type: string + type: array + interfaces: + description: |- + Interfaces contains the interface names to which the BPF program should + be attached. If empty, all the interfaces in the system are selected, + except the ones listed in ExcludeInterfaces. An entry enclosed by + slashes, such as `/br-/`, is matched as a regular expression. Otherwise + it is matched as a case-sensitive string. + items: + type: string + type: array + networknamespaces: + description: |- + NetworkNamespaces contains a list of network namespaces in which to look + for the listed interfaces. If emtpy, the all network namespaces in the + system are selected. + items: + type: string + type: array + type: object + type: array primarynodeinterface: description: Attach BPF program to the primary interface on the node. Only 'true' accepted.