backport of commit 425b1e333d008f37fe517ee3c886e8fe96c3e5ce (#23885)
Co-authored-by: Josh Black <raskchanky@gmail.com>
This commit is contained in:
parent
bc19a6d305
commit
435363ef2a
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
storage/etcd: etcd should only return keys when calling List()
|
||||||
|
```
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
metrics "github.com/armon/go-metrics"
|
"github.com/armon/go-metrics"
|
||||||
log "github.com/hashicorp/go-hclog"
|
log "github.com/hashicorp/go-hclog"
|
||||||
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
||||||
"github.com/hashicorp/go-secure-stdlib/strutil"
|
"github.com/hashicorp/go-secure-stdlib/strutil"
|
||||||
|
@ -238,7 +238,7 @@ func (c *EtcdBackend) List(ctx context.Context, prefix string) ([]string, error)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), c.requestTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), c.requestTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
prefix = path.Join(c.path, prefix) + "/"
|
prefix = path.Join(c.path, prefix) + "/"
|
||||||
resp, err := c.etcd.Get(ctx, prefix, clientv3.WithPrefix())
|
resp, err := c.etcd.Get(ctx, prefix, clientv3.WithPrefix(), clientv3.WithKeysOnly())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func TestEtcd3Backend(t *testing.T) {
|
||||||
"username": "root",
|
"username": "root",
|
||||||
"password": "insecure",
|
"password": "insecure",
|
||||||
|
|
||||||
// Syncing adverticed client urls should be disabled since docker port mapping confuses the client.
|
// Syncing advertised client urls should be disabled since docker port mapping confuses the client.
|
||||||
"sync": "false",
|
"sync": "false",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue