Skip to content

Commit

Permalink
moved external-access handling to initMgmtNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Feb 22, 2022
1 parent 99cab72 commit 858076d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 10 additions & 1 deletion clab/clab.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,18 @@ func (c *CLab) initMgmtNetwork() error {
if c.Config.Mgmt.Network == "" {
c.Config.Mgmt.Network = dockerNetName
}

if c.Config.Mgmt.IPv4Subnet == "" && c.Config.Mgmt.IPv6Subnet == "" {
c.Config.Mgmt.IPv4Subnet = dockerNetIPv4Addr
c.Config.Mgmt.IPv6Subnet = dockerNetIPv6Addr
}
log.Debugf("New mgmt params are %+v", c.Config.Mgmt)

// by default external access is enabled if not set by a user
if c.Config.Mgmt.ExternalAccess == nil {
c.Config.Mgmt.ExternalAccess = new(bool)
*c.Config.Mgmt.ExternalAccess = true
}

// init docker network mtu
if c.Config.Mgmt.MTU == "" {
m, err := utils.DefaultNetMTU()
Expand All @@ -156,6 +163,8 @@ func (c *CLab) initMgmtNetwork() error {
c.Config.Mgmt.MTU = m
}

log.Debugf("New mgmt params are %+v", c.Config.Mgmt)

return nil
}

Expand Down
6 changes: 0 additions & 6 deletions clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,6 @@ func (*CLab) CheckResources() error {

// sets defaults after the topology has been parsed
func (c *CLab) setDefaults() {
// by default external access is enabled if not set by a user
if c.Config.Mgmt.ExternalAccess == nil {
c.Config.Mgmt.ExternalAccess = new(bool)
*c.Config.Mgmt.ExternalAccess = true
}

for _, n := range c.Nodes {
// Injecting the env var with expected number of links
numLinks := map[string]string{
Expand Down

0 comments on commit 858076d

Please sign in to comment.