Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for attaching BPF programs inside network namespaces #342

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion apis/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,omitempty"`

// 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,omitempty"`

// NetworkNamespaces contains a list of network namespaces in which to look
// for the listed interfaces. If empty, 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"`
Expand Down
53 changes: 53 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ metadata:
capabilities: Basic Install
categories: OpenShift Optional
containerImage: quay.io/bpfman/bpfman-operator:latest
createdAt: "2024-10-21T11:51:40Z"
createdAt: "2024-11-19T12:24:39Z"
features.operators.openshift.io/cnf: "false"
features.operators.openshift.io/cni: "false"
features.operators.openshift.io/csi: "true"
Expand Down
114 changes: 111 additions & 3 deletions bundle/manifests/bpfman.io_bpfapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 empty, 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.
Expand Down Expand Up @@ -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 empty, 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.
Expand Down Expand Up @@ -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 empty, 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.
Expand Down
38 changes: 37 additions & 1 deletion bundle/manifests/bpfman.io_tcprograms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 empty, 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.
Expand Down
38 changes: 37 additions & 1 deletion bundle/manifests/bpfman.io_tcxprograms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 empty, 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.
Expand Down
Loading
Loading