pkg/mesh: allow fully disabling CNI
This commit fixes the issue encountered in #36, where the CNI config is touched even though CNI management is disabled. Fixes: #36 Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
parent
409d738124
commit
e08920c4fb
@ -304,10 +304,12 @@ func (m *Mesh) Run() error {
|
|||||||
return fmt.Errorf("failed to initialize node backend: %v", err)
|
return fmt.Errorf("failed to initialize node backend: %v", err)
|
||||||
}
|
}
|
||||||
// Try to set the CNI config quickly.
|
// Try to set the CNI config quickly.
|
||||||
if n, err := m.Nodes().Get(m.hostname); err == nil {
|
if m.cni {
|
||||||
if n != nil && n.Subnet != nil {
|
if n, err := m.Nodes().Get(m.hostname); err == nil {
|
||||||
m.nodes[m.hostname] = n
|
m.nodes[m.hostname] = n
|
||||||
m.updateCNIConfig()
|
m.updateCNIConfig()
|
||||||
|
} else {
|
||||||
|
level.Warn(m.logger).Log("error", fmt.Errorf("failed to get node %q: %v", m.hostname, err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := m.Peers().Init(m.stop); err != nil {
|
if err := m.Peers().Init(m.stop); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user