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

fix: fix Conntrack GC running in Retina default #1323

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 13 additions & 0 deletions pkg/plugin/common/common_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,16 @@ func NewPerfReader(l *log.ZapLogger, m *ebpf.Map, max, min int) (*perf.Reader, e
}
return nil, errors.New("failed to create perf reader")
}

// IsPluginEnabled checks if a given plugin is enabled in the config
func IsPluginEnabled(enabledPlugins []string, pluginName string) bool {
if enabledPlugins == nil {
return false
}
for _, plugin := range enabledPlugins {
if plugin == pluginName {
return true
}
}
return false
}
6 changes: 6 additions & 0 deletions pkg/plugin/conntrack/conntrack_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@

// Run starts the Conntrack garbage collection loop.
func (ct *Conntrack) Run(ctx context.Context) error {
// Check if packetparser plugin is enabled
if !plugincommon.IsPluginEnabled(ct.cfg.EnabledPlugins, "packetparser") {

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, amd64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg) (typecheck)

Check failure on line 97 in pkg/plugin/conntrack/conntrack_linux.go

View workflow job for this annotation

GitHub Actions / Lint (linux, arm64)

ct.cfg undefined (type *Conntrack has no field or method cfg)) (typecheck)
ct.l.Info("Skipping Conntrack GC loop as packetparser plugin is not enabled")
return nil
}

ticker := time.NewTicker(ct.gcFrequency)
defer ticker.Stop()

Expand Down
Loading