mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
commit
324952c12a
@ -199,7 +199,7 @@ To start etcd automatically using custom settings at startup in Linux, using a [
|
||||
|
||||
### --enable-v2
|
||||
+ Accept etcd V2 client requests
|
||||
+ default: true
|
||||
+ default: false
|
||||
+ env variable: ETCD_ENABLE_V2
|
||||
|
||||
## Proxy flags
|
||||
|
@ -69,9 +69,8 @@ const (
|
||||
// It's enabled by default.
|
||||
DefaultStrictReconfigCheck = true
|
||||
// DefaultEnableV2 is the default value for "--enable-v2" flag.
|
||||
// v2 is enabled by default.
|
||||
// TODO: disable v2 when deprecated.
|
||||
DefaultEnableV2 = true
|
||||
// v2 API is disabled by default.
|
||||
DefaultEnableV2 = false
|
||||
|
||||
// maxElectionMs specifies the maximum value of election timeout.
|
||||
// More details are listed in ../Documentation/tuning.md#time-parameters.
|
||||
|
@ -1980,6 +1980,12 @@ func (s *EtcdServer) sync(timeout time.Duration) {
|
||||
// static clientURLs of the server.
|
||||
// The function keeps attempting to register until it succeeds,
|
||||
// or its server is stopped.
|
||||
//
|
||||
// Use v2 store to encode member attributes, and apply through Raft
|
||||
// but does not go through v2 API endpoint, which means even with v2
|
||||
// client handler disabled (e.g. --enable-v2=false), cluster can still
|
||||
// process publish requests through rafthttp
|
||||
// TODO: Deprecate v2 store
|
||||
func (s *EtcdServer) publish(timeout time.Duration) {
|
||||
b, err := json.Marshal(s.attributes)
|
||||
if err != nil {
|
||||
|
@ -131,6 +131,7 @@ type etcdProcessClusterConfig struct {
|
||||
initialToken string
|
||||
quotaBackendBytes int64
|
||||
noStrictReconfig bool
|
||||
enableV2 bool
|
||||
initialCorruptCheck bool
|
||||
authTokenOpts string
|
||||
}
|
||||
@ -241,6 +242,9 @@ func (cfg *etcdProcessClusterConfig) etcdServerProcessConfigs() []*etcdServerPro
|
||||
if cfg.noStrictReconfig {
|
||||
args = append(args, "--strict-reconfig-check=false")
|
||||
}
|
||||
if cfg.enableV2 {
|
||||
args = append(args, "--enable-v2")
|
||||
}
|
||||
if cfg.initialCorruptCheck {
|
||||
args = append(args, "--experimental-initial-corrupt-check")
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ func testCtlV2Set(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
cfg.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, cfg, quorum)
|
||||
defer func() {
|
||||
if errC := epc.Close(); errC != nil {
|
||||
@ -61,6 +62,7 @@ func testCtlV2Mk(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
cfg.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, cfg, quorum)
|
||||
defer func() {
|
||||
if errC := epc.Close(); errC != nil {
|
||||
@ -89,6 +91,7 @@ func testCtlV2Rm(t *testing.T, cfg *etcdProcessClusterConfig) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
cfg.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, cfg, true)
|
||||
defer func() {
|
||||
if errC := epc.Close(); errC != nil {
|
||||
@ -118,6 +121,7 @@ func testCtlV2Ls(t *testing.T, cfg *etcdProcessClusterConfig, quorum bool) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
cfg.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, cfg, quorum)
|
||||
defer func() {
|
||||
if errC := epc.Close(); errC != nil {
|
||||
@ -144,6 +148,7 @@ func testCtlV2Watch(t *testing.T, cfg *etcdProcessClusterConfig, noSync bool) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
cfg.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, cfg, true)
|
||||
defer func() {
|
||||
if errC := epc.Close(); errC != nil {
|
||||
@ -172,7 +177,9 @@ func TestCtlV2GetRoleUser(t *testing.T) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
||||
copied := configNoTLS
|
||||
copied.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, &copied, false)
|
||||
defer func() {
|
||||
if err := epc.Close(); err != nil {
|
||||
t.Fatalf("error closing etcd processes (%v)", err)
|
||||
@ -207,7 +214,9 @@ func testCtlV2UserList(t *testing.T, username string) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
||||
copied := configNoTLS
|
||||
copied.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, &copied, false)
|
||||
defer func() {
|
||||
if err := epc.Close(); err != nil {
|
||||
t.Fatalf("error closing etcd processes (%v)", err)
|
||||
@ -227,7 +236,9 @@ func TestCtlV2RoleList(t *testing.T) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
||||
copied := configNoTLS
|
||||
copied.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, &copied, false)
|
||||
defer func() {
|
||||
if err := epc.Close(); err != nil {
|
||||
t.Fatalf("error closing etcd processes (%v)", err)
|
||||
@ -261,6 +272,7 @@ func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
|
||||
|
||||
etcdCfg := configNoTLS
|
||||
etcdCfg.snapshotCount = snapCount
|
||||
etcdCfg.enableV2 = true
|
||||
epc1 := setupEtcdctlTest(t, &etcdCfg, false)
|
||||
|
||||
// v3 put before v2 set so snapshot happens after v3 operations to confirm
|
||||
@ -293,6 +305,7 @@ func testCtlV2Backup(t *testing.T, snapCount int, v3 bool) {
|
||||
cfg2.dataDirPath = backupDir
|
||||
cfg2.keepDataDir = true
|
||||
cfg2.forceNewCluster = true
|
||||
cfg2.enableV2 = true
|
||||
epc2 := setupEtcdctlTest(t, &cfg2, false)
|
||||
|
||||
// check if backup went through correctly
|
||||
@ -333,7 +346,7 @@ func TestCtlV2AuthWithCommonName(t *testing.T) {
|
||||
|
||||
copiedCfg := configClientTLS
|
||||
copiedCfg.clientCertAuthEnabled = true
|
||||
|
||||
copiedCfg.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, &copiedCfg, false)
|
||||
defer func() {
|
||||
if err := epc.Close(); err != nil {
|
||||
@ -368,7 +381,10 @@ func TestCtlV2ClusterHealth(t *testing.T) {
|
||||
os.Setenv("ETCDCTL_API", "2")
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
epc := setupEtcdctlTest(t, &configNoTLS, true)
|
||||
|
||||
copied := configNoTLS
|
||||
copied.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, &copied, true)
|
||||
defer func() {
|
||||
if err := epc.Close(); err != nil {
|
||||
t.Fatalf("error closing etcd processes (%v)", err)
|
||||
|
@ -37,6 +37,7 @@ func testCurlPutGet(t *testing.T, cfg *etcdProcessClusterConfig) {
|
||||
// stale reads that will break the test
|
||||
cfg = configStandalone(*cfg)
|
||||
|
||||
cfg.enableV2 = true
|
||||
epc, err := newEtcdProcessCluster(cfg)
|
||||
if err != nil {
|
||||
t.Fatalf("could not start etcd process cluster (%v)", err)
|
||||
@ -69,7 +70,9 @@ func TestV2CurlIssue5182(t *testing.T) {
|
||||
defer os.Unsetenv("ETCDCTL_API")
|
||||
defer testutil.AfterTest(t)
|
||||
|
||||
epc := setupEtcdctlTest(t, &configNoTLS, false)
|
||||
copied := configNoTLS
|
||||
copied.enableV2 = true
|
||||
epc := setupEtcdctlTest(t, &copied, false)
|
||||
defer func() {
|
||||
if err := epc.Close(); err != nil {
|
||||
t.Fatalf("error closing etcd processes (%v)", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user