Skip to content
Open
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
82 changes: 60 additions & 22 deletions apis/v1alpha1/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,63 +28,89 @@ import (

// Config holds the configuration for bpfman-operator.
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="Progressing",type="string",JSONPath=".status.conditions[?(@.type=='Progressing')].status"
// +kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.conditions[?(@.type=='Available')].status"
type Config struct {
metav1.TypeMeta `json:",inline"`
metav1.TypeMeta `json:",inline"`
// metadata is the object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ConfigSpec `json:"spec,omitempty"`
// spec defines the desired state of the bpfman-operator.
// +required
Spec ConfigSpec `json:"spec,omitzero"`
// status reflects the observed state of the bpfman-operator.
// +optional
Status ConfigStatus `json:"status,omitempty"`
}

// Spec defines the desired state of the bpfman-operator.
// spec defines the desired state of the bpfman-operator.
type ConfigSpec struct {
// Agent holds the configuration for the bpfman agent.
// agent specifies the configuration for the bpfman agent DaemonSet.
// +required
Agent AgentSpec `json:"agent,omitempty"`
// Configuration holds the content of bpfman.toml.
Agent AgentSpec `json:"agent,omitzero"`
// configuration specifies the content of bpfman.toml configuration file used by the bpfman DaemonSet.
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
Configuration string `json:"configuration"`
// Image holds the image of the bpfman DaemonSets.
// +kubebuilder:validation:MaxLength=65536
Configuration string `json:"configuration,omitempty"`
// image specifies the container image for the bpfman DaemonSet.
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
Image string `json:"image"`
// LogLevel holds the log level for the bpfman-operator.
// +kubebuilder:validation:MaxLength=1023
Image string `json:"image,omitempty"`
// logLevel specifies the log level for the bpfman DaemonSet via the RUST_LOG environment variable.
// The RUST_LOG environment variable controls logging with the syntax: RUST_LOG=[target][=][level][,...].
// For further information, see https://docs.rs/env_logger/latest/env_logger/.
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=1024
LogLevel string `json:"logLevel,omitempty"`
// Namespace holds the namespace where bpfman-operator resources shall be
// deployed.
// namespace specifies the namespace where bpfman-operator resources will be deployed.
// If not specified, resources will be deployed in the default bpfman namespace.
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
Namespace string `json:"namespace,omitempty"`
}

// AgentSpec defines the desired state of the bpfman agent.
type AgentSpec struct {
// HealthProbePort holds the health probe bind port for the bpfman agent.
// healthProbePort specifies the port on which the bpfman agent's health probe endpoint will listen.
// If unspecified, the default port will be used.
// +optional
// +kubebuilder:default=8175
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
HealthProbePort int `json:"healthProbePort"`
// Image holds the image for the bpfman agent.
HealthProbePort int32 `json:"healthProbePort,omitempty"`
// image specifies the container image for the bpfman agent DaemonSet.
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
Image string `json:"image"`
// LogLevel holds the log level for the bpfman agent.
// +kubebuilder:validation:MaxLength=1023
Image string `json:"image,omitempty"`
// logLevel specifies the verbosity of logs produced by the bpfman agent.
// Valid values are: "info", "debug", "trace".
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
// +kubebuilder:validation:Enum=info;debug;trace
LogLevel string `json:"logLevel,omitempty"`
}

// status reflects the status of the bpfman-operator configuration.
type ConfigStatus struct {
// conditions store the status conditions of the bpfman-operator.
// conditions represents the current state conditions of the bpfman-operator and its components.
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=1023
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`

// components represents the operational status of each individual bpfman-operator component such as the deployed
// DaemonSets.
// +optional
Components map[string]ConfigComponentStatus `json:"components,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -94,3 +120,15 @@ type ConfigList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []Config `json:"items"`
}

// ConfigComponentStatus holds the status of a single Config component.
type ConfigComponentStatus string

const (
// ConfigStatusUnknown indicates the component state cannot be determined.
ConfigStatusUnknown ConfigComponentStatus = "Unknown"
// ConfigStatusProgressing indicates the component is being updated or reconciled.
ConfigStatusProgressing ConfigComponentStatus = "Progressing"
// ConfigStatusReady indicates the component is fully operational and ready.
ConfigStatusReady ConfigComponentStatus = "Ready"
)
7 changes: 7 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.

17 changes: 16 additions & 1 deletion bundle/manifests/bpfman-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ metadata:
capabilities: Basic Install
categories: OpenShift Optional
containerImage: quay.io/bpfman/bpfman-operator:latest
createdAt: "2025-09-26T11:09:36Z"
createdAt: "2025-10-21T13:05:28Z"
description: The bpfman Operator is designed to manage eBPF programs for applications.
features.operators.openshift.io/cnf: "false"
features.operators.openshift.io/cni: "false"
Expand Down Expand Up @@ -1502,6 +1502,14 @@ spec:
- configs/finalizers
verbs:
- update
- apiGroups:
- bpfman.io
resources:
- configs/status
verbs:
- get
- patch
- update
- apiGroups:
- ""
resources:
Expand All @@ -1514,6 +1522,13 @@ spec:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- ""
resources:
Expand Down
74 changes: 56 additions & 18 deletions bundle/manifests/bpfman.io_configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .status.conditions[?(@.type=='Progressing')].status
name: Progressing
type: string
- jsonPath: .status.conditions[?(@.type=='Available')].status
name: Available
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand All @@ -41,53 +47,82 @@ spec:
metadata:
type: object
spec:
description: Spec defines the desired state of the bpfman-operator.
description: spec defines the desired state of the bpfman-operator.
properties:
agent:
description: Agent holds the configuration for the bpfman agent.
description: agent specifies the configuration for the bpfman agent
DaemonSet.
properties:
healthProbePort:
default: 8175
description: HealthProbePort holds the health probe bind port
for the bpfman agent.
description: |-
healthProbePort specifies the port on which the bpfman agent's health probe endpoint will listen.
If unspecified, the default port will be used.
format: int32
maximum: 65535
minimum: 1
type: integer
image:
description: Image holds the image for the bpfman agent.
description: image specifies the container image for the bpfman
agent DaemonSet.
maxLength: 1023
minLength: 1
type: string
logLevel:
description: LogLevel holds the log level for the bpfman agent.
description: |-
logLevel specifies the verbosity of logs produced by the bpfman agent.
Valid values are: "info", "debug", "trace".
enum:
- info
- debug
- trace
maxLength: 256
minLength: 1
type: string
required:
- image
type: object
configuration:
description: Configuration holds the content of bpfman.toml.
description: configuration specifies the content of bpfman.toml configuration
file used by the bpfman DaemonSet.
maxLength: 65536
minLength: 1
type: string
image:
description: Image holds the image of the bpfman DaemonSets.
description: image specifies the container image for the bpfman DaemonSet.
maxLength: 1023
minLength: 1
type: string
logLevel:
description: LogLevel holds the log level for the bpfman-operator.
description: |-
logLevel specifies the log level for the bpfman DaemonSet via the RUST_LOG environment variable.
The RUST_LOG environment variable controls logging with the syntax: RUST_LOG=[target][=][level][,...].
For further information, see https://docs.rs/env_logger/latest/env_logger/.
maxLength: 1024
minLength: 1
type: string
namespace:
description: |-
Namespace holds the namespace where bpfman-operator resources shall be
deployed.
namespace specifies the namespace where bpfman-operator resources will be deployed.
If not specified, resources will be deployed in the default bpfman namespace.
maxLength: 256
minLength: 1
type: string
required:
- configuration
- image
- agent
type: object
status:
description: status reflects the status of the bpfman-operator configuration.
description: status reflects the observed state of the bpfman-operator.
properties:
components:
additionalProperties:
description: ConfigComponentStatus holds the status of a single
Config component.
type: string
description: |-
components represents the operational status of each individual bpfman-operator component such as the deployed
DaemonSets.
type: object
conditions:
description: conditions store the status conditions of the bpfman-operator.
description: conditions represents the current state conditions of
the bpfman-operator and its components.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
Expand Down Expand Up @@ -155,11 +190,14 @@ spec:
- status
- type
type: object
maxItems: 1023
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
type: object
required:
- spec
type: object
served: true
storage: true
Expand Down
1 change: 1 addition & 0 deletions cmd/bpfman-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func main() {
CsiDriverDS: internal.BpfmanCsiDriverPath,
RestrictedSCC: internal.BpfmanRestrictedSCCPath,
IsOpenshift: isOpenshift,
Recorder: mgr.GetEventRecorderFor("config-controller"),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create bpfmanConfig controller")
os.Exit(1)
Expand Down
Loading
Loading