etcd: Add a special magic option hack
Workaround some legacy code for now.
This commit is contained in:
19
etcd/etcd.go
19
etcd/etcd.go
@@ -262,6 +262,9 @@ type EmbdEtcd struct { // EMBeddeD etcd
|
|||||||
// NoNetwork causes this to use unix:// sockets instead of TCP for
|
// NoNetwork causes this to use unix:// sockets instead of TCP for
|
||||||
// connections.
|
// connections.
|
||||||
NoNetwork bool
|
NoNetwork bool
|
||||||
|
// NoMagic turns off some things which aren't needed when used with a
|
||||||
|
// simple Seeds and NoServer option.
|
||||||
|
NoMagic bool
|
||||||
|
|
||||||
// Chooser is the implementation of the algorithm that decides which
|
// Chooser is the implementation of the algorithm that decides which
|
||||||
// hosts to add or remove to grow and shrink the cluster.
|
// hosts to add or remove to grow and shrink the cluster.
|
||||||
@@ -418,6 +421,10 @@ func (obj *EmbdEtcd) Validate() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if obj.NoMagic && !obj.NoServer {
|
||||||
|
return fmt.Errorf("we need Magic if we're a Server")
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := etcdUtil.CopyURLs(obj.Seeds); err != nil { // this will validate
|
if _, err := etcdUtil.CopyURLs(obj.Seeds); err != nil { // this will validate
|
||||||
return errwrap.Wrapf(err, "the Seeds are not valid")
|
return errwrap.Wrapf(err, "the Seeds are not valid")
|
||||||
}
|
}
|
||||||
@@ -1215,11 +1222,13 @@ func (obj *EmbdEtcd) Run() error {
|
|||||||
obj.activateExit4.Ack()
|
obj.activateExit4.Ack()
|
||||||
|
|
||||||
// startup endpoints watcher (to learn about other servers)
|
// startup endpoints watcher (to learn about other servers)
|
||||||
ctx, cancel := context.WithCancel(unblockCtx)
|
if !obj.NoMagic { // disable possibly buggy code for now
|
||||||
defer cancel() // cleanup on close...
|
ctx, cancel := context.WithCancel(unblockCtx)
|
||||||
if err := obj.runEndpoints(ctx); err != nil {
|
defer cancel() // cleanup on close...
|
||||||
obj.activateExit5.Ack()
|
if err := obj.runEndpoints(ctx); err != nil {
|
||||||
return err
|
obj.activateExit5.Ack()
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
obj.activateExit5.Ack()
|
obj.activateExit5.Ack()
|
||||||
// We don't set state, we only watch others, so nothing to defer close!
|
// We don't set state, we only watch others, so nothing to defer close!
|
||||||
|
|||||||
@@ -179,6 +179,10 @@ type Config struct {
|
|||||||
// clustering or opening tcp ports to the outside.
|
// clustering or opening tcp ports to the outside.
|
||||||
NoNetwork bool `arg:"--no-network,env:MGMT_NO_NETWORK" help:"run single node instance without clustering or opening tcp ports to the outside"`
|
NoNetwork bool `arg:"--no-network,env:MGMT_NO_NETWORK" help:"run single node instance without clustering or opening tcp ports to the outside"`
|
||||||
|
|
||||||
|
// NoMagic turns off some things which aren't needed when used with a
|
||||||
|
// simple Seeds and NoServer option.
|
||||||
|
NoMagic bool `arg:"--no-magic" help:"do not do any etcd magic (for simple clients)"`
|
||||||
|
|
||||||
// NoPgp disables pgp functionality.
|
// NoPgp disables pgp functionality.
|
||||||
NoPgp bool `arg:"--no-pgp" help:"don't create pgp keys"`
|
NoPgp bool `arg:"--no-pgp" help:"don't create pgp keys"`
|
||||||
|
|
||||||
@@ -511,6 +515,7 @@ func (obj *Main) Run() error {
|
|||||||
|
|
||||||
NoServer: obj.NoServer,
|
NoServer: obj.NoServer,
|
||||||
NoNetwork: obj.NoNetwork,
|
NoNetwork: obj.NoNetwork,
|
||||||
|
NoMagic: obj.NoMagic,
|
||||||
|
|
||||||
Chooser: &chooser.DynamicSize{
|
Chooser: &chooser.DynamicSize{
|
||||||
IdealClusterSize: obj.idealClusterSize,
|
IdealClusterSize: obj.idealClusterSize,
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ func (obj *Svc) Run(ctx context.Context) error {
|
|||||||
|
|
||||||
if obj.SetupSvcArgs.NoServer {
|
if obj.SetupSvcArgs.NoServer {
|
||||||
argv = append(argv, "--no-server")
|
argv = append(argv, "--no-server")
|
||||||
|
argv = append(argv, "--no-magic") // XXX: fix this workaround
|
||||||
}
|
}
|
||||||
|
|
||||||
argv = append(argv, "empty $OPTS")
|
argv = append(argv, "empty $OPTS")
|
||||||
|
|||||||
Reference in New Issue
Block a user