Skip to content

Commit

Permalink
crio: filter out systemd related components
Browse files Browse the repository at this point in the history
Do not allow registration of systemd related services.
  • Loading branch information
rphillips committed Oct 12, 2021
1 parent 167d846 commit 1a1eae0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions container/crio/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import (
// The namespace under which crio aliases are unique.
const CrioNamespace = "crio"

// The namespace systemd runs components under.
const SystemdNamespace = "system-systemd"

// Regexp that identifies CRI-O cgroups
var crioCgroupRegexp = regexp.MustCompile(`([a-z0-9]{64})`)

Expand Down Expand Up @@ -114,6 +117,9 @@ func (f *crioFactory) CanHandleAndAccept(name string) (bool, bool, error) {
if !strings.HasPrefix(path.Base(name), CrioNamespace) {
return false, false, nil
}
if strings.HasPrefix(path.Base(name), SystemdNamespace) {
return true, false, nil
}
// if the container is not associated with CRI-O, we can't handle it or accept it.
if !isContainerName(name) {
return false, false, nil
Expand Down

0 comments on commit 1a1eae0

Please sign in to comment.