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 Sep 3, 2024
1 parent cac5a59 commit 9a3cc9d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions cmd/microcloud/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,12 @@ func (c *initConfig) addPeers(sh *service.Handler) (revert.Hook, 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 @@ -785,6 +791,17 @@ func (c *initConfig) setupCluster(s *service.Handler) error {
}
}

if s.Type() == types.MicroOVN {
microOvnBootstrapConf := make(map[string]string)
if bootstrapSystem.OVNGeneveAddr != "" {
microOvnBootstrapConf["ovn-encap-ip"] = bootstrapSystem.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 9a3cc9d

Please sign in to comment.