etcd.go 17 KB

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