Skip to content

Commit

Permalink
Merge pull request #2790 from thaJeztah/fix_possible_panic
Browse files Browse the repository at this point in the history
Fix possible panic if NetworkConfig is nil
  • Loading branch information
dperny committed Jan 2, 2019
2 parents 0091d92 + 75299d3 commit 08d6e4a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,10 +1016,16 @@ func (m *Manager) becomeLeader(ctx context.Context) {
cluster = store.GetCluster(tx, clusterID)
})
if cluster.DefaultAddressPool != nil {
if m.config.NetworkConfig == nil {
m.config.NetworkConfig = &cnmallocator.NetworkConfig{}
}
m.config.NetworkConfig.DefaultAddrPool = append(m.config.NetworkConfig.DefaultAddrPool, cluster.DefaultAddressPool...)
m.config.NetworkConfig.SubnetSize = cluster.SubnetSize
}
if cluster.VXLANUDPPort != 0 {
if m.config.NetworkConfig == nil {
m.config.NetworkConfig = &cnmallocator.NetworkConfig{}
}
m.config.NetworkConfig.VXLANUDPPort = cluster.VXLANUDPPort
}
}
Expand Down

0 comments on commit 08d6e4a

Please sign in to comment.