From 070524f686133b63081bb6b24c05fd7e952f66b0 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Tue, 12 Nov 2024 18:18:47 +0100 Subject: [PATCH] Add network get-config command --- go/cmd/entrypoint/network.go | 14 ++++++++++++++ go/daemon/daecommon/config.go | 4 ---- go/daemon/network/garage.go | 7 +------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/go/cmd/entrypoint/network.go b/go/cmd/entrypoint/network.go index 9c4542a..955db7b 100644 --- a/go/cmd/entrypoint/network.go +++ b/go/cmd/entrypoint/network.go @@ -106,6 +106,19 @@ var subCmdNetworkList = subCmd{ }), } +var subCmdNetworkGetConfig = subCmd{ + name: "get-config", + descr: "Displays the currently active configuration for a joined network", + do: doWithOutput(func(ctx subCmdCtx) (any, error) { + ctx, err := ctx.withParsedFlags() + if err != nil { + return nil, fmt.Errorf("parsing flags: %w", err) + } + + return newDaemonRPCClient().GetConfig(ctx) + }), +} + var subCmdNetwork = subCmd{ name: "network", descr: "Sub-commands related to network membership", @@ -115,6 +128,7 @@ var subCmdNetwork = subCmd{ subCmdNetworkCreate, subCmdNetworkJoin, subCmdNetworkList, + subCmdNetworkGetConfig, ) }, } diff --git a/go/daemon/daecommon/config.go b/go/daemon/daecommon/config.go index a58a87b..ab897e7 100644 --- a/go/daemon/daecommon/config.go +++ b/go/daemon/daecommon/config.go @@ -55,10 +55,6 @@ type ConfigStorageAllocation struct { S3APIPort int `yaml:"s3_api_port"` RPCPort int `yaml:"rpc_port"` AdminPort int `yaml:"admin_port"` - - // Zone is a secret option which makes it easier to test garage bugs, but - // which we don't want users to otherwise know about. - Zone string `yaml:"zone"` } // Annotate implements the mctx.Annotator interface. diff --git a/go/daemon/network/garage.go b/go/daemon/network/garage.go index 28bff19..cb6458c 100644 --- a/go/daemon/network/garage.go +++ b/go/daemon/network/garage.go @@ -103,15 +103,10 @@ func garageApplyLayout( id := daecommon.BootstrapGarageHostForAlloc(currHost, alloc).ID roleIDs[id] = struct{}{} - zone := string(hostName) - if alloc.Zone != "" { - zone = alloc.Zone - } - roles[i] = garage.Role{ ID: id, Capacity: alloc.Capacity * 1_000_000_000, - Zone: zone, + Zone: string(hostName), Tags: []string{}, } }