feat: support etcd v3.

This commit is contained in:
Fernandez Ludovic 2019-10-09 03:08:04 +02:00
parent 0ce281d820
commit e309f6b7a8
2 changed files with 18 additions and 3 deletions

View File

@ -22,6 +22,7 @@ func init() {
kvCmd.AddCommand(etcdCmd)
etcdCmd.Flags().Int("sync-period", 0, "Sync period for etcd in seconds.")
etcdCmd.Flags().String("etcd-version", "etcd", "The etcd version can be: 'etcd' or 'etcdv3'.")
}
func etcdRun(baseConfig *dumper.BaseConfig, cmd *cobra.Command) error {
@ -36,7 +37,20 @@ func etcdRun(baseConfig *dumper.BaseConfig, cmd *cobra.Command) error {
}
config.Options.SyncPeriod = time.Duration(synPeriod) * time.Second
config.Backend = store.ETCD
backend, err := cmd.Flags().GetString("etcd-version")
if err != nil {
return err
}
switch backend {
case "etcd":
config.Backend = store.ETCD
case "etcdv3":
config.Backend = store.ETCDV3
default:
config.Backend = store.ETCD
}
etcd.Register()
return kv.Dump(config, baseConfig)

View File

@ -13,8 +13,9 @@ traefik-certs-dumper kv etcd [flags]
### Options
```
-h, --help help for etcd
--sync-period int Sync period for etcd in seconds.
--etcd-version string The etcd version can be: 'etcd' or 'etcdv3'. (default "etcd")
-h, --help help for etcd
--sync-period int Sync period for etcd in seconds.
```
### Options inherited from parent commands