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

cni: don't overwrite CNI changes when cni.exclusive is false #26773

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 14 additions & 9 deletions daemon/cmd/cni/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,20 @@ func (c *cniConfigManager) Start(hive.HookContext) error {
return nil
}

var err error

c.watcher, err = fsnotify.NewWatcher()
if err != nil {
c.log.Warnf("Failed to create watcher: %v", err)
} else {
if err := c.watcher.Add(c.cniConfDir); err != nil {
c.log.Warnf("Failed to watch CNI configuration directory %s: %v", c.cniConfDir, err)
c.watcher = nil
// Watch the CNI configuration directory, and regenerate CNI config
// if necessary.
// Don't watch for changes if cni-exclusive is false. This is to allow
// rewriting of the Cilium CNI configuration by another plugin (e.g. Istio).
if c.config.CNIExclusive {
var err error
c.watcher, err = fsnotify.NewWatcher()
if err != nil {
c.log.Warnf("Failed to create watcher: %v", err)
} else {
if err := c.watcher.Add(c.cniConfDir); err != nil {
c.log.Warnf("Failed to watch CNI configuration directory %s: %v", c.cniConfDir, err)
c.watcher = nil
}
}
}

Expand Down