diff --git a/entrypoint/src/bootstrap/garage.go b/entrypoint/src/bootstrap/garage.go index 2711ba0..91d23cf 100644 --- a/entrypoint/src/bootstrap/garage.go +++ b/entrypoint/src/bootstrap/garage.go @@ -11,10 +11,6 @@ func (b Bootstrap) GaragePeers() []garage.RemotePeer { for _, host := range b.Hosts { - if host.Garage == nil { - continue - } - for _, instance := range host.Garage.Instances { peer := garage.RemotePeer{ @@ -49,7 +45,7 @@ func (b Bootstrap) ChooseGaragePeer() garage.RemotePeer { thisHost := b.ThisHost() - if thisHost.Garage != nil && len(thisHost.Garage.Instances) > 0 { + if len(thisHost.Garage.Instances) > 0 { inst := thisHost.Garage.Instances[0] return garage.RemotePeer{ diff --git a/entrypoint/src/bootstrap/hosts.go b/entrypoint/src/bootstrap/hosts.go index badf38d..4fcbd84 100644 --- a/entrypoint/src/bootstrap/hosts.go +++ b/entrypoint/src/bootstrap/hosts.go @@ -58,9 +58,9 @@ type GarageHost struct { // Host consolidates all information about a single host from the bootstrap // file. type Host struct { - Name string `yaml:"name"` - Nebula NebulaHost `yaml:"nebula"` - Garage *GarageHost `yaml:"garage,omitempty"` + Name string `yaml:"name"` + Nebula NebulaHost `yaml:"nebula"` + Garage GarageHost `yaml:"garage,omitempty"` } // IP returns the IP address encoded in the Host's nebula certificate, or panics diff --git a/entrypoint/src/cmd/entrypoint/daemon_util.go b/entrypoint/src/cmd/entrypoint/daemon_util.go index 9fd2518..5d3340f 100644 --- a/entrypoint/src/cmd/entrypoint/daemon_util.go +++ b/entrypoint/src/cmd/entrypoint/daemon_util.go @@ -26,8 +26,6 @@ func mergeDaemonConfigIntoBootstrap( if allocs := daemonConfig.Storage.Allocations; len(allocs) > 0 { - host.Garage = new(bootstrap.GarageHost) - for _, alloc := range allocs { id, err := garage.InitAlloc(alloc.MetaPath) diff --git a/entrypoint/src/cmd/entrypoint/hosts.go b/entrypoint/src/cmd/entrypoint/hosts.go index b2f894e..0e5642a 100644 --- a/entrypoint/src/cmd/entrypoint/hosts.go +++ b/entrypoint/src/cmd/entrypoint/hosts.go @@ -38,8 +38,24 @@ var subCmdHostsList = subCmd{ return fmt.Errorf("retrieving hosts from garage: %w", err) } - hosts := make([]bootstrap.Host, 0, len(hostsMap)) - for _, host := range hostsMap { + type host struct { + Name string `yaml:"name"` + Nebula struct { + IP string `yaml:"ip"` + } `yaml:"nebula"` + Garage bootstrap.GarageHost `yaml:"garage,omitempty"` + } + + hosts := make([]host, 0, len(hostsMap)) + for _, h := range hostsMap { + + host := host{ + Name: h.Name, + Garage: h.Garage, + } + + host.Nebula.IP = h.IP().String() + hosts = append(hosts, host) }