diff --git a/pkg/etcd/etcdprocess.go b/pkg/etcd/etcdprocess.go index 5630008b..67fdaab5 100644 --- a/pkg/etcd/etcdprocess.go +++ b/pkg/etcd/etcdprocess.go @@ -100,6 +100,9 @@ type etcdProcess struct { // ListenMetricsURLs is the set of urls we should listen for metrics on ListenMetricsURLs []string + + // IgnoreListenMetricsURLs if this is set, we will not set Metrics URL even if ENV is set. + IgnoreListenMetricsURLs bool } func (p *etcdProcess) ExitState() (error, *os.ProcessState) { @@ -269,6 +272,10 @@ func (p *etcdProcess) Start() error { } } + //IgnoreListenMetricsURLs + if p.IgnoreListenMetricsURLs { + delete(env, "ETCD_LISTEN_METRICS_URLS") + } for k, v := range env { c.Env = append(c.Env, k+"="+v) } diff --git a/pkg/etcd/restore.go b/pkg/etcd/restore.go index d25d1fac..9c9801c3 100644 --- a/pkg/etcd/restore.go +++ b/pkg/etcd/restore.go @@ -163,9 +163,10 @@ func RunEtcdFromBackup(backupStore backup.Store, backupName string, basedir stri ClusterToken: clusterToken, Nodes: []*protoetcd.EtcdNode{myNode}, }, - MyNodeName: myNodeName, - ListenAddress: "127.0.0.1", - DisableTLS: false, + IgnoreListenMetricsURLs: true, // Do not Set ListenMetricsURLs for restore to avoid port conflicts + MyNodeName: myNodeName, + ListenAddress: "127.0.0.1", + DisableTLS: false, } var etcdClientsCA *pki.Keypair