diff --git a/cmd/jpictl/dns.go b/cmd/jpictl/dns.go index f3a2cbe..da7da0c 100644 --- a/cmd/jpictl/dns.go +++ b/cmd/jpictl/dns.go @@ -52,7 +52,7 @@ func populateDNSManager(mgr *dns.Manager, m *cluster.Cluster) error { m.ForEachZone(func(z *cluster.Zone) bool { z.ForEachMachine(func(p *cluster.Machine) bool { - err = mgr.AddHost(ctx, z.Name, p.ID, true, p.PublicAddresses...) + err = mgr.AddHost(ctx, z.Name, p.ID, p.Active(), p.PublicAddresses...) return err != nil }) diff --git a/pkg/cluster/machine.go b/pkg/cluster/machine.go index 46ac7e9..a2b8665 100644 --- a/pkg/cluster/machine.go +++ b/pkg/cluster/machine.go @@ -15,6 +15,7 @@ type Machine struct { ID int Name string `json:"-" yaml:"-"` + Inactive bool `json:"inactive,omitempty" yaml:"inactive,omitempty"` CephMonitor bool `json:"ceph_monitor,omitempty" yaml:"ceph_monitor,omitempty"` PublicAddresses []netip.Addr `json:"public,omitempty" yaml:"public,omitempty"` Rings []*RingInfo `json:"rings,omitempty" yaml:"rings,omitempty"` @@ -43,6 +44,11 @@ func (m *Machine) FullName() string { return strings.Join(name, ".") } +// Active indicates the machine is to be included in regions' DNS entries +func (m *Machine) Active() bool { + return !m.Inactive +} + // IsGateway tells if the Machine is a ring0 gateway func (m *Machine) IsGateway() bool { _, ok := m.getRingInfo(0) diff --git a/pkg/cluster/regions.go b/pkg/cluster/regions.go index 3384ca5..71a1399 100644 --- a/pkg/cluster/regions.go +++ b/pkg/cluster/regions.go @@ -32,7 +32,9 @@ func (r *Region) ForEachMachine(fn func(*Machine) bool) { var term bool z.ForEachMachine(func(p *Machine) bool { - term = fn(p) + if p.Active() { + term = fn(p) + } return term })