Skip to content

Commit

Permalink
microcloud/cmd/microcloud: apply config for when a custom encaps Gene…
Browse files Browse the repository at this point in the history
…ve IP is needed

Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Aug 3, 2024
1 parent 19b5cde commit 5a97ed7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions cmd/microcloud/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ func (c *initConfig) addPeers(sh *service.Handler) error {
LXDConfig: info.JoinConfig,
CephConfig: info.MicroCephDisks,
}

if info.OVNGeneveAddr != "" {
p := joinConfig[peer]
p.OVNConfig = map[string]string{"ovn-encap-ip": info.OVNGeneveAddr}
joinConfig[peer] = p
}
}

clusterSize := map[types.ServiceType]int{}
Expand Down Expand Up @@ -739,6 +745,20 @@ func (c *initConfig) setupCluster(s *service.Handler) error {
}
}

if s.Type() == types.MicroOVN {
microOvnBootstrapConf := make(map[string]string)
for _, system := range c.systems {
// If the system needs to be bootstrapped with a custom ovn encapsulation ip for geneve, add it to the init config.
if system.OVNGeneveAddr != "" {
microOvnBootstrapConf["ovn-encap-ip"] = system.OVNGeneveAddr
}
}

if len(microOvnBootstrapConf) > 0 {
s.SetConfig(microOvnBootstrapConf)
}
}

// set a 2 minute timeout to bootstrap a service in case the node is slow.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
Expand Down
2 changes: 1 addition & 1 deletion service/microovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s OVNService) Client() (*client.Client, error) {

// Bootstrap bootstraps the MicroOVN daemon on the default port.
func (s OVNService) Bootstrap(ctx context.Context) error {
err := s.m.NewCluster(ctx, s.name, util.CanonicalNetworkAddress(s.address, s.port), nil)
err := s.m.NewCluster(ctx, s.name, util.CanonicalNetworkAddress(s.address, s.port), s.config)
if err != nil {
return err
}
Expand Down

0 comments on commit 5a97ed7

Please sign in to comment.