etcd.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. // Copyright 2015 The etcd Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package etcdmain
  15. import (
  16. "encoding/json"
  17. "fmt"
  18. "io/ioutil"
  19. "net/http"
  20. "os"
  21. "path/filepath"
  22. "reflect"
  23. "runtime"
  24. "strings"
  25. "time"
  26. "go.etcd.io/etcd/embed"
  27. "go.etcd.io/etcd/etcdserver"
  28. "go.etcd.io/etcd/etcdserver/api/etcdhttp"
  29. "go.etcd.io/etcd/etcdserver/api/v2discovery"
  30. "go.etcd.io/etcd/pkg/fileutil"
  31. pkgioutil "go.etcd.io/etcd/pkg/ioutil"
  32. "go.etcd.io/etcd/pkg/osutil"
  33. "go.etcd.io/etcd/pkg/transport"
  34. "go.etcd.io/etcd/pkg/types"
  35. "go.etcd.io/etcd/proxy/httpproxy"
  36. "go.etcd.io/etcd/version"
  37. "github.com/coreos/pkg/capnslog"
  38. "go.uber.org/zap"
  39. "google.golang.org/grpc"
  40. )
  41. type dirType string
  42. var plog = capnslog.NewPackageLogger("go.etcd.io/etcd", "etcdmain")
  43. var (
  44. dirMember = dirType("member")
  45. dirProxy = dirType("proxy")
  46. dirEmpty = dirType("empty")
  47. )
  48. func startEtcdOrProxyV2() {
  49. grpc.EnableTracing = false
  50. cfg := newConfig()
  51. defaultInitialCluster := cfg.ec.InitialCluster
  52. err := cfg.parse(os.Args[1:])
  53. if err != nil {
  54. lg := cfg.ec.GetLogger()
  55. if lg != nil {
  56. lg.Warn("failed to verify flags", zap.Error(err))
  57. } else {
  58. plog.Errorf("error verifying flags, %v. See 'etcd --help'.", err)
  59. }
  60. switch err {
  61. case embed.ErrUnsetAdvertiseClientURLsFlag:
  62. if lg != nil {
  63. lg.Warn("advertise client URLs are not set", zap.Error(err))
  64. } else {
  65. plog.Errorf("When listening on specific address(es), this etcd process must advertise accessible url(s) to each connected client.")
  66. }
  67. }
  68. os.Exit(1)
  69. }
  70. lg := cfg.ec.GetLogger()
  71. if lg == nil {
  72. // TODO: remove in 3.5
  73. plog.Infof("etcd Version: %s\n", version.Version)
  74. plog.Infof("Git SHA: %s\n", version.GitSHA)
  75. plog.Infof("Go Version: %s\n", runtime.Version())
  76. plog.Infof("Go OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
  77. plog.Infof("setting maximum number of CPUs to %d, total number of available CPUs is %d", runtime.GOMAXPROCS(0), runtime.NumCPU())
  78. }
  79. defer func() {
  80. logger := cfg.ec.GetLogger()
  81. if logger != nil {
  82. logger.Sync()
  83. }
  84. }()
  85. defaultHost, dhErr := (&cfg.ec).UpdateDefaultClusterFromName(defaultInitialCluster)
  86. if defaultHost != "" {
  87. if lg != nil {
  88. lg.Info(
  89. "detected default host for advertise",
  90. zap.String("host", defaultHost),
  91. )
  92. } else {
  93. plog.Infof("advertising using detected default host %q", defaultHost)
  94. }
  95. }
  96. if dhErr != nil {
  97. if lg != nil {
  98. lg.Info("failed to detect default host", zap.Error(dhErr))
  99. } else {
  100. plog.Noticef("failed to detect default host (%v)", dhErr)
  101. }
  102. }
  103. if cfg.ec.Dir == "" {
  104. cfg.ec.Dir = fmt.Sprintf("%v.etcd", cfg.ec.Name)
  105. if lg != nil {
  106. lg.Warn(
  107. "'data-dir' was empty; using default",
  108. zap.String("data-dir", cfg.ec.Dir),
  109. )
  110. } else {
  111. plog.Warningf("no data-dir provided, using default data-dir ./%s", cfg.ec.Dir)
  112. }
  113. }
  114. var stopped <-chan struct{}
  115. var errc <-chan error
  116. which := identifyDataDirOrDie(cfg.ec.GetLogger(), cfg.ec.Dir)
  117. if which != dirEmpty {
  118. if lg != nil {
  119. lg.Info(
  120. "server has been already initialized",
  121. zap.String("data-dir", cfg.ec.Dir),
  122. zap.String("dir-type", string(which)),
  123. )
  124. } else {
  125. plog.Noticef("the server is already initialized as %v before, starting as etcd %v...", which, which)
  126. }
  127. switch which {
  128. case dirMember:
  129. stopped, errc, err = startEtcd(&cfg.ec)
  130. case dirProxy:
  131. err = startProxy(cfg)
  132. default:
  133. if lg != nil {
  134. lg.Panic(
  135. "unknown directory type",
  136. zap.String("dir-type", string(which)),
  137. )
  138. } else {
  139. plog.Panicf("unhandled dir type %v", which)
  140. }
  141. }
  142. } else {
  143. shouldProxy := cfg.isProxy()
  144. if !shouldProxy {
  145. stopped, errc, err = startEtcd(&cfg.ec)
  146. if derr, ok := err.(*etcdserver.DiscoveryError); ok && derr.Err == v2discovery.ErrFullCluster {
  147. if cfg.shouldFallbackToProxy() {
  148. if lg != nil {
  149. lg.Warn(
  150. "discovery cluster is full, falling back to proxy",
  151. zap.String("fallback-proxy", fallbackFlagProxy),
  152. zap.Error(err),
  153. )
  154. } else {
  155. plog.Noticef("discovery cluster full, falling back to %s", fallbackFlagProxy)
  156. }
  157. shouldProxy = true
  158. }
  159. } else if err != nil {
  160. if lg != nil {
  161. lg.Warn("failed to start etcd", zap.Error(err))
  162. }
  163. }
  164. }
  165. if shouldProxy {
  166. err = startProxy(cfg)
  167. }
  168. }
  169. if err != nil {
  170. if derr, ok := err.(*etcdserver.DiscoveryError); ok {
  171. switch derr.Err {
  172. case v2discovery.ErrDuplicateID:
  173. if lg != nil {
  174. lg.Warn(
  175. "member has been registered with discovery service",
  176. zap.String("name", cfg.ec.Name),
  177. zap.String("discovery-token", cfg.ec.Durl),
  178. zap.Error(derr.Err),
  179. )
  180. lg.Warn(
  181. "but could not find valid cluster configuration",
  182. zap.String("data-dir", cfg.ec.Dir),
  183. )
  184. lg.Warn("check data dir if previous bootstrap succeeded")
  185. lg.Warn("or use a new discovery token if previous bootstrap failed")
  186. } else {
  187. plog.Errorf("member %q has previously registered with discovery service token (%s).", cfg.ec.Name, cfg.ec.Durl)
  188. plog.Errorf("But etcd could not find valid cluster configuration in the given data dir (%s).", cfg.ec.Dir)
  189. plog.Infof("Please check the given data dir path if the previous bootstrap succeeded")
  190. plog.Infof("or use a new discovery token if the previous bootstrap failed.")
  191. }
  192. case v2discovery.ErrDuplicateName:
  193. if lg != nil {
  194. lg.Warn(
  195. "member with duplicated name has already been registered",
  196. zap.String("discovery-token", cfg.ec.Durl),
  197. zap.Error(derr.Err),
  198. )
  199. lg.Warn("cURL the discovery token URL for details")
  200. lg.Warn("do not reuse discovery token; generate a new one to bootstrap a cluster")
  201. } else {
  202. plog.Errorf("member with duplicated name has registered with discovery service token(%s).", cfg.ec.Durl)
  203. plog.Errorf("please check (cURL) the discovery token for more information.")
  204. plog.Errorf("please do not reuse the discovery token and generate a new one to bootstrap the cluster.")
  205. }
  206. default:
  207. if lg != nil {
  208. lg.Warn(
  209. "failed to bootstrap; discovery token was already used",
  210. zap.String("discovery-token", cfg.ec.Durl),
  211. zap.Error(err),
  212. )
  213. lg.Warn("do not reuse discovery token; generate a new one to bootstrap a cluster")
  214. } else {
  215. plog.Errorf("%v", err)
  216. plog.Infof("discovery token %s was used, but failed to bootstrap the cluster.", cfg.ec.Durl)
  217. plog.Infof("please generate a new discovery token and try to bootstrap again.")
  218. }
  219. }
  220. os.Exit(1)
  221. }
  222. if strings.Contains(err.Error(), "include") && strings.Contains(err.Error(), "--initial-cluster") {
  223. if lg != nil {
  224. lg.Warn("failed to start", zap.Error(err))
  225. } else {
  226. plog.Infof("%v", err)
  227. }
  228. if cfg.ec.InitialCluster == cfg.ec.InitialClusterFromName(cfg.ec.Name) {
  229. if lg != nil {
  230. lg.Warn("forgot to set --initial-cluster?")
  231. } else {
  232. plog.Infof("forgot to set --initial-cluster flag?")
  233. }
  234. }
  235. if types.URLs(cfg.ec.APUrls).String() == embed.DefaultInitialAdvertisePeerURLs {
  236. if lg != nil {
  237. lg.Warn("forgot to set --initial-advertise-peer-urls?")
  238. } else {
  239. plog.Infof("forgot to set --initial-advertise-peer-urls flag?")
  240. }
  241. }
  242. if cfg.ec.InitialCluster == cfg.ec.InitialClusterFromName(cfg.ec.Name) && len(cfg.ec.Durl) == 0 {
  243. if lg != nil {
  244. lg.Warn("--discovery flag is not set")
  245. } else {
  246. plog.Infof("if you want to use discovery service, please set --discovery flag.")
  247. }
  248. }
  249. os.Exit(1)
  250. }
  251. if lg != nil {
  252. lg.Fatal("discovery failed", zap.Error(err))
  253. } else {
  254. plog.Fatalf("%v", err)
  255. }
  256. }
  257. osutil.HandleInterrupts(lg)
  258. // At this point, the initialization of etcd is done.
  259. // The listeners are listening on the TCP ports and ready
  260. // for accepting connections. The etcd instance should be
  261. // joined with the cluster and ready to serve incoming
  262. // connections.
  263. notifySystemd(lg)
  264. select {
  265. case lerr := <-errc:
  266. // fatal out on listener errors
  267. if lg != nil {
  268. lg.Fatal("listener failed", zap.Error(err))
  269. } else {
  270. plog.Fatal(lerr)
  271. }
  272. case <-stopped:
  273. }
  274. osutil.Exit(0)
  275. }
  276. // startEtcd runs StartEtcd in addition to hooks needed for standalone etcd.
  277. func startEtcd(cfg *embed.Config) (<-chan struct{}, <-chan error, error) {
  278. e, err := embed.StartEtcd(cfg)
  279. if err != nil {
  280. return nil, nil, err
  281. }
  282. osutil.RegisterInterruptHandler(e.Close)
  283. select {
  284. case <-e.Server.ReadyNotify(): // wait for e.Server to join the cluster
  285. case <-e.Server.StopNotify(): // publish aborted from 'ErrStopped'
  286. }
  287. return e.Server.StopNotify(), e.Err(), nil
  288. }
  289. // startProxy launches an HTTP proxy for client communication which proxies to other etcd nodes.
  290. func startProxy(cfg *config) error {
  291. lg := cfg.ec.GetLogger()
  292. if lg != nil {
  293. lg.Info("v2 API proxy starting")
  294. } else {
  295. plog.Notice("proxy: this proxy supports v2 API only!")
  296. }
  297. clientTLSInfo := cfg.ec.ClientTLSInfo
  298. if clientTLSInfo.Empty() {
  299. // Support old proxy behavior of defaulting to PeerTLSInfo
  300. // for both client and peer connections.
  301. clientTLSInfo = cfg.ec.PeerTLSInfo
  302. }
  303. clientTLSInfo.InsecureSkipVerify = cfg.ec.ClientAutoTLS
  304. cfg.ec.PeerTLSInfo.InsecureSkipVerify = cfg.ec.PeerAutoTLS
  305. pt, err := transport.NewTimeoutTransport(
  306. clientTLSInfo,
  307. time.Duration(cfg.cp.ProxyDialTimeoutMs)*time.Millisecond,
  308. time.Duration(cfg.cp.ProxyReadTimeoutMs)*time.Millisecond,
  309. time.Duration(cfg.cp.ProxyWriteTimeoutMs)*time.Millisecond,
  310. )
  311. if err != nil {
  312. return err
  313. }
  314. pt.MaxIdleConnsPerHost = httpproxy.DefaultMaxIdleConnsPerHost
  315. if err = cfg.ec.PeerSelfCert(); err != nil {
  316. if lg != nil {
  317. lg.Fatal("failed to get self-signed certs for peer", zap.Error(err))
  318. } else {
  319. plog.Fatalf("could not get certs (%v)", err)
  320. }
  321. }
  322. tr, err := transport.NewTimeoutTransport(
  323. cfg.ec.PeerTLSInfo,
  324. time.Duration(cfg.cp.ProxyDialTimeoutMs)*time.Millisecond,
  325. time.Duration(cfg.cp.ProxyReadTimeoutMs)*time.Millisecond,
  326. time.Duration(cfg.cp.ProxyWriteTimeoutMs)*time.Millisecond,
  327. )
  328. if err != nil {
  329. return err
  330. }
  331. cfg.ec.Dir = filepath.Join(cfg.ec.Dir, "proxy")
  332. err = os.MkdirAll(cfg.ec.Dir, fileutil.PrivateDirMode)
  333. if err != nil {
  334. return err
  335. }
  336. var peerURLs []string
  337. clusterfile := filepath.Join(cfg.ec.Dir, "cluster")
  338. b, err := ioutil.ReadFile(clusterfile)
  339. switch {
  340. case err == nil:
  341. if cfg.ec.Durl != "" {
  342. if lg != nil {
  343. lg.Warn(
  344. "discovery token ignored since the proxy has already been initialized; valid cluster file found",
  345. zap.String("cluster-file", clusterfile),
  346. )
  347. } else {
  348. plog.Warningf("discovery token ignored since the proxy has already been initialized. Valid cluster file found at %q", clusterfile)
  349. }
  350. }
  351. if cfg.ec.DNSCluster != "" {
  352. if lg != nil {
  353. lg.Warn(
  354. "DNS SRV discovery ignored since the proxy has already been initialized; valid cluster file found",
  355. zap.String("cluster-file", clusterfile),
  356. )
  357. } else {
  358. plog.Warningf("DNS SRV discovery ignored since the proxy has already been initialized. Valid cluster file found at %q", clusterfile)
  359. }
  360. }
  361. urls := struct{ PeerURLs []string }{}
  362. err = json.Unmarshal(b, &urls)
  363. if err != nil {
  364. return err
  365. }
  366. peerURLs = urls.PeerURLs
  367. if lg != nil {
  368. lg.Info(
  369. "proxy using peer URLS from cluster file",
  370. zap.Strings("peer-urls", peerURLs),
  371. zap.String("cluster-file", clusterfile),
  372. )
  373. } else {
  374. plog.Infof("proxy: using peer urls %v from cluster file %q", peerURLs, clusterfile)
  375. }
  376. case os.IsNotExist(err):
  377. var urlsmap types.URLsMap
  378. urlsmap, _, err = cfg.ec.PeerURLsMapAndToken("proxy")
  379. if err != nil {
  380. return fmt.Errorf("error setting up initial cluster: %v", err)
  381. }
  382. if cfg.ec.Durl != "" {
  383. var s string
  384. s, err = v2discovery.GetCluster(lg, cfg.ec.Durl, cfg.ec.Dproxy)
  385. if err != nil {
  386. return err
  387. }
  388. if urlsmap, err = types.NewURLsMap(s); err != nil {
  389. return err
  390. }
  391. }
  392. peerURLs = urlsmap.URLs()
  393. if lg != nil {
  394. lg.Info("proxy using peer URLS", zap.Strings("peer-urls", peerURLs))
  395. } else {
  396. plog.Infof("proxy: using peer urls %v ", peerURLs)
  397. }
  398. default:
  399. return err
  400. }
  401. clientURLs := []string{}
  402. uf := func() []string {
  403. gcls, gerr := etcdserver.GetClusterFromRemotePeers(lg, peerURLs, tr)
  404. if gerr != nil {
  405. if lg != nil {
  406. lg.Warn(
  407. "failed to get cluster from remote peers",
  408. zap.Strings("peer-urls", peerURLs),
  409. zap.Error(gerr),
  410. )
  411. } else {
  412. plog.Warningf("proxy: %v", gerr)
  413. }
  414. return []string{}
  415. }
  416. clientURLs = gcls.ClientURLs()
  417. urls := struct{ PeerURLs []string }{gcls.PeerURLs()}
  418. b, jerr := json.Marshal(urls)
  419. if jerr != nil {
  420. if lg != nil {
  421. lg.Warn("proxy failed to marshal peer URLs", zap.Error(jerr))
  422. } else {
  423. plog.Warningf("proxy: error on marshal peer urls %s", jerr)
  424. }
  425. return clientURLs
  426. }
  427. err = pkgioutil.WriteAndSyncFile(clusterfile+".bak", b, 0600)
  428. if err != nil {
  429. if lg != nil {
  430. lg.Warn("proxy failed to write cluster file", zap.Error(err))
  431. } else {
  432. plog.Warningf("proxy: error on writing urls %s", err)
  433. }
  434. return clientURLs
  435. }
  436. err = os.Rename(clusterfile+".bak", clusterfile)
  437. if err != nil {
  438. if lg != nil {
  439. lg.Warn(
  440. "proxy failed to rename cluster file",
  441. zap.String("path", clusterfile),
  442. zap.Error(err),
  443. )
  444. } else {
  445. plog.Warningf("proxy: error on updating clusterfile %s", err)
  446. }
  447. return clientURLs
  448. }
  449. if !reflect.DeepEqual(gcls.PeerURLs(), peerURLs) {
  450. if lg != nil {
  451. lg.Info(
  452. "proxy updated peer URLs",
  453. zap.Strings("from", peerURLs),
  454. zap.Strings("to", gcls.PeerURLs()),
  455. )
  456. } else {
  457. plog.Noticef("proxy: updated peer urls in cluster file from %v to %v", peerURLs, gcls.PeerURLs())
  458. }
  459. }
  460. peerURLs = gcls.PeerURLs()
  461. return clientURLs
  462. }
  463. ph := httpproxy.NewHandler(pt, uf, time.Duration(cfg.cp.ProxyFailureWaitMs)*time.Millisecond, time.Duration(cfg.cp.ProxyRefreshIntervalMs)*time.Millisecond)
  464. ph = embed.WrapCORS(cfg.ec.CORS, ph)
  465. if cfg.isReadonlyProxy() {
  466. ph = httpproxy.NewReadonlyHandler(ph)
  467. }
  468. // setup self signed certs when serving https
  469. cHosts, cTLS := []string{}, false
  470. for _, u := range cfg.ec.LCUrls {
  471. cHosts = append(cHosts, u.Host)
  472. cTLS = cTLS || u.Scheme == "https"
  473. }
  474. for _, u := range cfg.ec.ACUrls {
  475. cHosts = append(cHosts, u.Host)
  476. cTLS = cTLS || u.Scheme == "https"
  477. }
  478. listenerTLS := cfg.ec.ClientTLSInfo
  479. if cfg.ec.ClientAutoTLS && cTLS {
  480. listenerTLS, err = transport.SelfCert(cfg.ec.GetLogger(), filepath.Join(cfg.ec.Dir, "clientCerts"), cHosts)
  481. if err != nil {
  482. if lg != nil {
  483. lg.Fatal("failed to initialize self-signed client cert", zap.Error(err))
  484. } else {
  485. plog.Fatalf("proxy: could not initialize self-signed client certs (%v)", err)
  486. }
  487. }
  488. }
  489. // Start a proxy server goroutine for each listen address
  490. for _, u := range cfg.ec.LCUrls {
  491. l, err := transport.NewListener(u.Host, u.Scheme, &listenerTLS)
  492. if err != nil {
  493. return err
  494. }
  495. host := u.String()
  496. go func() {
  497. if lg != nil {
  498. lg.Info("v2 proxy started listening on client requests", zap.String("host", host))
  499. } else {
  500. plog.Infof("v2 proxy started listening on client requests on %q", host)
  501. }
  502. mux := http.NewServeMux()
  503. etcdhttp.HandlePrometheus(mux) // v2 proxy just uses the same port
  504. mux.Handle("/", ph)
  505. plog.Fatal(http.Serve(l, mux))
  506. }()
  507. }
  508. return nil
  509. }
  510. // identifyDataDirOrDie returns the type of the data dir.
  511. // Dies if the datadir is invalid.
  512. func identifyDataDirOrDie(lg *zap.Logger, dir string) dirType {
  513. names, err := fileutil.ReadDir(dir)
  514. if err != nil {
  515. if os.IsNotExist(err) {
  516. return dirEmpty
  517. }
  518. if lg != nil {
  519. lg.Fatal("failed to list data directory", zap.String("dir", dir), zap.Error(err))
  520. } else {
  521. plog.Fatalf("error listing data dir: %s", dir)
  522. }
  523. }
  524. var m, p bool
  525. for _, name := range names {
  526. switch dirType(name) {
  527. case dirMember:
  528. m = true
  529. case dirProxy:
  530. p = true
  531. default:
  532. if lg != nil {
  533. lg.Warn(
  534. "found invalid file under data directory",
  535. zap.String("filename", name),
  536. zap.String("data-dir", dir),
  537. )
  538. } else {
  539. plog.Warningf("found invalid file/dir %s under data dir %s (Ignore this if you are upgrading etcd)", name, dir)
  540. }
  541. }
  542. }
  543. if m && p {
  544. if lg != nil {
  545. lg.Fatal("invalid datadir; both member and proxy directories exist")
  546. } else {
  547. plog.Fatal("invalid datadir. Both member and proxy directories exist.")
  548. }
  549. }
  550. if m {
  551. return dirMember
  552. }
  553. if p {
  554. return dirProxy
  555. }
  556. return dirEmpty
  557. }
  558. func checkSupportArch() {
  559. // TODO qualify arm64
  560. if runtime.GOARCH == "amd64" || runtime.GOARCH == "ppc64le" {
  561. return
  562. }
  563. // unsupported arch only configured via environment variable
  564. // so unset here to not parse through flag
  565. defer os.Unsetenv("ETCD_UNSUPPORTED_ARCH")
  566. if env, ok := os.LookupEnv("ETCD_UNSUPPORTED_ARCH"); ok && env == runtime.GOARCH {
  567. fmt.Printf("running etcd on unsupported architecture %q since ETCD_UNSUPPORTED_ARCH is set\n", env)
  568. return
  569. }
  570. fmt.Printf("etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=%s set\n", runtime.GOARCH)
  571. os.Exit(1)
  572. }