From df70952f710c7097baded4327584f7911580b672 Mon Sep 17 00:00:00 2001 From: Gabriel Mougard Date: Tue, 2 Apr 2024 15:39:55 +0200 Subject: [PATCH] microcloud/cmd/microcloud: Apply Ceph dedicated network config to MicroCeph service If a dedicated Ceph network has been required, we choose this subnet for the `public` and `cluster` traffic. Signed-off-by: Gabriel Mougard --- microcloud/cmd/microcloud/main_init.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/microcloud/cmd/microcloud/main_init.go b/microcloud/cmd/microcloud/main_init.go index 83d9650eb..9aba5a6b4 100644 --- a/microcloud/cmd/microcloud/main_init.go +++ b/microcloud/cmd/microcloud/main_init.go @@ -418,10 +418,21 @@ func AddPeers(sh *service.Handler, systems map[string]InitSystem) error { // setupCluster Bootstraps the cluster if necessary, adds all peers to the cluster, and completes any post cluster // configuration. func setupCluster(s *service.Handler, systems map[string]InitSystem) error { - _, bootstrap := systems[s.Name] + bootstapSystem, bootstrap := systems[s.Name] if bootstrap { fmt.Println("Initializing a new cluster") err := s.RunConcurrent(true, false, func(s service.Service) error { + if s.Type() == types.MicroCeph && bootstapSystem.MicroCephNetworkSubnet != "" { + // When choosing a dedicated ceph network, + // make the public and cluster traffic flow through the same interfaces. + microCephBootstrapConf := map[string]string{ + "PublicNet": bootstapSystem.MicroCephNetworkSubnet, + "ClusterNet": bootstapSystem.MicroCephNetworkSubnet, + } + + s.SetConfig(microCephBootstrapConf) + } + err := s.Bootstrap(context.Background()) if err != nil { return fmt.Errorf("Failed to bootstrap local %s: %w", s.Type(), err)