Skip to content

Commit 349d011

Browse files
mhilsk8s-ci-robot
authored andcommitted
be more robust if version parsing fails
1 parent 82146e5 commit 349d011

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

internal/pkg/daemon/bpfrecorder/bpfrecorder.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,9 @@ func (b *BpfRecorder) findBtfPath() (string, error) {
720720

721721
arch, version, err := b.Uname()
722722
if err != nil {
723-
return "", fmt.Errorf("uname syscall failed: %w", err)
723+
b.logger.Error(err, "failed to get kernel version, continuing without BTF...")
724+
725+
return "", nil
724726
}
725727

726728
btfArch, ok := btfOsVersion[arch]

internal/pkg/daemon/enricher/auditsource/bpf.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ import (
3232
"sigs.k8s.io/security-profiles-operator/internal/pkg/util"
3333
)
3434

35-
func BpfSupported() error {
35+
func BpfSupported(logger logr.Logger) error {
3636
_, version, err := util.Uname()
3737
if err != nil {
38-
return fmt.Errorf("uname failed: %w", err)
38+
logger.Error(err, "failed to get kernel version to check BPF support, continuing anyway...")
39+
40+
return nil
3941
}
4042

4143
minVersion := semver.Version{Major: 5, Minor: 19}
@@ -52,7 +54,7 @@ type BpfSource struct {
5254
}
5355

5456
func NewBpfSource(logger logr.Logger) (*BpfSource, error) {
55-
if err := BpfSupported(); err != nil {
57+
if err := BpfSupported(logger); err != nil {
5658
return nil, err
5759
}
5860

0 commit comments

Comments
 (0)