etcd backend listing should only require keys (#23872)

* listing should only require keys

* correct misspelling

* add changelog
This commit is contained in:
Josh Black
2023-10-27 09:17:50 -07:00
committed by GitHub
parent 29d8929824
commit 425b1e333d
3 changed files with 6 additions and 3 deletions

3
changelog/23872.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:improvement
storage/etcd: etcd should only return keys when calling List()
```

View File

@@ -14,7 +14,7 @@ import (
"sync"
"time"
metrics "github.com/armon/go-metrics"
"github.com/armon/go-metrics"
log "github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-secure-stdlib/parseutil"
"github.com/hashicorp/go-secure-stdlib/strutil"
@@ -247,7 +247,7 @@ func (c *EtcdBackend) List(ctx context.Context, prefix string) ([]string, error)
ctx, cancel := context.WithTimeout(context.Background(), c.requestTimeout)
defer cancel()
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 {
return nil, err
}

View File

@@ -26,7 +26,7 @@ func TestEtcd3Backend(t *testing.T) {
"username": "root",
"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",
}