Пример #1
0
func newSubnetRegistry() (api.SubnetRegistry, error) {
	peers := strings.Split(opts.etcdEndpoints, ",")

	subnetPath := path.Join(opts.etcdPath, "subnets")
	subnetConfigPath := path.Join(opts.etcdPath, "config")

	var nodePath string
	if len(opts.minionPath) > 0 {
		nodePath = opts.minionPath
		log.Info("Warning: -minion-path deprecated, use -node-path")
	} else {
		nodePath = opts.nodePath
	}
	if opts.sync {
		nodePath = path.Join(opts.etcdPath, "minions")
	}

	cfg := &registry.EtcdConfig{
		Endpoints:        peers,
		Keyfile:          opts.etcdKeyfile,
		Certfile:         opts.etcdCertfile,
		CAFile:           opts.etcdCAFile,
		SubnetPath:       subnetPath,
		SubnetConfigPath: subnetConfigPath,
		NodePath:         nodePath,
	}

	return registry.NewEtcdSubnetRegistry(cfg)
}
Пример #2
0
func newSubnetRegistry() (api.SubnetRegistry, error) {
	peers := strings.Split(opts.etcdEndpoints, ",")

	subnetPath := path.Join(opts.etcdPath, "subnets")
	subnetConfigPath := path.Join(opts.etcdPath, "config")
	minionPath := opts.minionPath
	if opts.sync {
		minionPath = path.Join(opts.etcdPath, "minions")
	}

	cfg := &registry.EtcdConfig{
		Endpoints:        peers,
		Keyfile:          opts.etcdKeyfile,
		Certfile:         opts.etcdCertfile,
		CAFile:           opts.etcdCAFile,
		SubnetPath:       subnetPath,
		SubnetConfigPath: subnetConfigPath,
		MinionPath:       minionPath,
	}

	return registry.NewEtcdSubnetRegistry(cfg)
}