diff --git a/cmd/proxy/cmd/proxy.go b/cmd/proxy/cmd/proxy.go index 8e80aa12..d65b4d4b 100644 --- a/cmd/proxy/cmd/proxy.go +++ b/cmd/proxy/cmd/proxy.go @@ -185,6 +185,7 @@ func (c *ClusterChecker) SetProxyInfo(e store.Store, generation int64, proxyTime UID: c.uid, Generation: generation, ProxyTimeout: proxyTimeout, + SlaveMode: cfg.slaveNode, } log.Debugf("proxyInfo dump: %s", spew.Sdump(proxyInfo)) diff --git a/cmd/stolonctl/cmd/status.go b/cmd/stolonctl/cmd/status.go index 0807f614..29db79f3 100644 --- a/cmd/stolonctl/cmd/status.go +++ b/cmd/stolonctl/cmd/status.go @@ -61,6 +61,7 @@ type SentinelStatus struct { type ProxyStatus struct { UID string `json:"uid"` Generation int64 `json:"generation"` + SlaveMode bool `json:"slaveMode"` } type KeeperStatus struct { @@ -134,9 +135,9 @@ func renderText(status Status, generateErr error) { if len(status.Proxies) == 0 { stdout("No active proxies") } else { - fmt.Fprintf(tabOut, "ID\n") + fmt.Fprintf(tabOut, "ID\tSLAVE MODE\n") for _, p := range status.Proxies { - fmt.Fprintf(tabOut, "%s\n", p.UID) + fmt.Fprintf(tabOut, "%s\t%t\n", p.UID, p.SlaveMode) tabOut.Flush() } } @@ -273,7 +274,7 @@ func generateStatus() (Status, error) { proxies := make([]ProxyStatus, 0) sort.Sort(proxiesInfoSlice) for _, pi := range proxiesInfoSlice { - proxies = append(proxies, ProxyStatus{UID: pi.UID, Generation: pi.Generation}) + proxies = append(proxies, ProxyStatus{UID: pi.UID, Generation: pi.Generation, SlaveMode: pi.SlaveMode}) } status.Proxies = proxies diff --git a/internal/cluster/member.go b/internal/cluster/member.go index f1d49259..a9d25984 100644 --- a/internal/cluster/member.go +++ b/internal/cluster/member.go @@ -143,6 +143,8 @@ type ProxyInfo struct { // It's used by the sentinel to know for how much time the // proxy should be considered active. ProxyTimeout time.Duration + + SlaveMode bool } type ProxiesInfo map[string]*ProxyInfo