Skip to content

Commit

Permalink
daemon/cni: correctly handle empty chaining mode
Browse files Browse the repository at this point in the history
There was a logic error when handling an unset chaining mode.

Signed-off-by: Casey Callendrello <cdc@isovalent.com>
  • Loading branch information
squeed committed May 3, 2023
1 parent 73cf477 commit 0f75ecd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 4 additions & 0 deletions daemon/cmd/cni/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ func newConfigManager(log logrus.FieldLogger, cfg Config, debug bool) *cniConfig
cfg.CNIChainingMode = "generic-veth"
}

if cfg.CNIChainingMode == "" {
cfg.CNIChainingMode = "none"
}

c := &cniConfigManager{
config: cfg,
debug: debug,
Expand Down
6 changes: 1 addition & 5 deletions daemon/cmd/cni/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,7 @@ func (c *cniConfigManager) renderCNIConf() (cniConfig []byte, err error) {
return nil, err
}
} else {
mode := c.config.CNIChainingMode
if mode == "" {
mode = "none"
}
c.log.Infof("Generating CNI configuration file with mode %s", mode)
c.log.Infof("Generating CNI configuration file with mode %s", c.config.CNIChainingMode)
tmpl := cniConfigs[c.config.CNIChainingMode]
cniConfig = []byte(c.renderCNITemplate(tmpl))
}
Expand Down

0 comments on commit 0f75ecd

Please sign in to comment.