integ/kubernetes/etcd/centos/files/bz1350875-disaster-recovery-with-copies.patch
Al Bailey 65ab88f214 Add spec file for building etcd 3.2.24
etcd 3.2.24 is the required version for kubernetes 1.13

There is no 3.2.24 src rpm, so the github archive is used as
the source code.

The original spec file and additional files are
from the etcd 3.2.22 src rpm in centos.

Story: 2005198
Task: 30405
Depends-On: I8f7061a9577941c257046721dbf5e957375691ab
Change-Id: Iab65a3bcd9e9d3f9968515c35675119bb06b9a54
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
2019-04-10 12:51:55 -05:00

57 lines
1.9 KiB
Diff

From 7ad700a716c2122c3b6db6677a6f717919b88926 Mon Sep 17 00:00:00 2001
From: Jan Chaloupka <jchaloup@redhat.com>
Date: Tue, 2 May 2017 09:56:02 +0200
Subject: [PATCH] bz1350875-disaster-recovery-with-copies:
---
etcdctl/ctlv2/command/backup_command.go | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/etcdctl/ctlv2/command/backup_command.go b/etcdctl/ctlv2/command/backup_command.go
index feda4b1..e77791f 100644
--- a/etcdctl/ctlv2/command/backup_command.go
+++ b/etcdctl/ctlv2/command/backup_command.go
@@ -18,6 +18,7 @@ import (
"fmt"
"log"
"path/filepath"
+ "strconv"
"time"
"github.com/coreos/etcd/etcdserver/etcdserverpb"
@@ -40,6 +41,9 @@ func NewBackupCommand() cli.Command {
cli.StringFlag{Name: "wal-dir", Value: "", Usage: "Path to the etcd wal dir"},
cli.StringFlag{Name: "backup-dir", Value: "", Usage: "Path to the backup dir"},
cli.StringFlag{Name: "backup-wal-dir", Value: "", Usage: "Path to the backup wal dir"},
+ cli.BoolFlag{Name: "keep-cluster-id", Usage: "Do not rewrite the cluster id"},
+ cli.StringFlag{Name: "node-id", Value: "", Usage: "Use custom node id instead of a random value"},
+
},
Action: handleBackup,
}
@@ -99,8 +103,19 @@ func handleBackup(c *cli.Context) error {
var metadata etcdserverpb.Metadata
pbutil.MustUnmarshal(&metadata, wmetadata)
idgen := idutil.NewGenerator(0, time.Now())
- metadata.NodeID = idgen.Next()
- metadata.ClusterID = idgen.Next()
+ explicitNodeId := c.String("node-id")
+ if explicitNodeId != "" {
+ metadata.NodeID, err = strconv.ParseUint(explicitNodeId, 16, 64)
+ if err != nil {
+ log.Fatal(err)
+ }
+ } else {
+ metadata.NodeID = idgen.Next()
+ }
+ keepClusterId := c.Bool("keep-cluster-id")
+ if !keepClusterId {
+ metadata.ClusterID = idgen.Next()
+ }
neww, err := wal.Create(destWAL, pbutil.MustMarshal(&metadata))
if err != nil {
--
2.7.4