Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HA in etcd off by default. #1909

Merged
merged 1 commit into from
Sep 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion physical/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -70,6 +71,7 @@ type EtcdBackend struct {
kAPI client.KeysAPI
permitPool *PermitPool
logger log.Logger
haEnabled bool
}

// newEtcdBackend constructs a etcd backend using a given machine address.
Expand Down Expand Up @@ -104,6 +106,12 @@ func newEtcdBackend(conf map[string]string, logger log.Logger) (Backend, error)
}
}

haEnabled := os.Getenv("ETCD_HA_ENABLED")
if haEnabled == "" {
haEnabled = conf["ha_enabled"]
}
haEnabledBool, _ := strconv.ParseBool(haEnabled)

// Create a new client from the supplied address and attempt to sync with the
// cluster.
var cTransport client.CancelableTransport
Expand Down Expand Up @@ -181,6 +189,7 @@ func newEtcdBackend(conf map[string]string, logger log.Logger) (Backend, error)
kAPI: kAPI,
permitPool: NewPermitPool(DefaultParallelOperations),
logger: logger,
haEnabled: haEnabledBool,
}, nil
}

Expand Down Expand Up @@ -317,7 +326,7 @@ func (c *EtcdBackend) LockWith(key, value string) (Lock, error) {
// HAEnabled indicates whether the HA functionality should be exposed.
// Currently always returns true.
func (e *EtcdBackend) HAEnabled() bool {
return true
return e.haEnabled
}

// EtcdLock emplements a lock using and etcd backend.
Expand Down
6 changes: 6 additions & 0 deletions website/source/docs/config/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ For etcd, the following options are supported:
"y", or "true". Defaults to on. Set to false if your etcd cluster is
behind a proxy server and syncing causes Vault to fail.

* `ha_enabled` (optional) - Setting this to `"1"`, `"t"`, or `"true"` will
enable HA mode. _This is currently *known broken*._ This option can also be
provided via the environment variable `ETCD_HA_ENABLED`. If you are
upgrading from a version of Vault where HA support was enabled by default,
it is _very important_ that you set this parameter _before_ upgrading!

* `username` (optional) - Username to use when authenticating with the etcd
server. May also be specified via the ETCD_USERNAME environment variable.

Expand Down