From 1004f5b0beadc0556fd522465367ef1a863990af Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 16 Dec 2019 22:20:00 -0700 Subject: [PATCH] Update vendor for kine fix --- go.mod | 2 +- go.sum | 4 ++-- .../rancher/kine/pkg/client/client.go | 21 +++++++++++++++++++ .../kine/pkg/logstructured/sqllog/sql.go | 8 +++++++ vendor/modules.txt | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 65c7ead8e4..2e7e341d46 100644 --- a/go.mod +++ b/go.mod @@ -99,7 +99,7 @@ require ( github.com/rakelkar/gonetsh v0.0.0-20190719023240-501daadcadf8 // indirect github.com/rancher/dynamiclistener v0.2.0 github.com/rancher/helm-controller v0.3.0 - github.com/rancher/kine v0.3.1 + github.com/rancher/kine v0.3.2 github.com/rancher/remotedialer v0.2.0 github.com/rancher/wrangler v0.4.0 github.com/rancher/wrangler-api v0.4.0 diff --git a/go.sum b/go.sum index 5af3557e54..0038025915 100644 --- a/go.sum +++ b/go.sum @@ -743,8 +743,8 @@ github.com/rancher/flannel v0.11.0-k3s.1 h1:mIwnfWDafjzQgFkZeJ1AkFrrAT3EdBaA1giE github.com/rancher/flannel v0.11.0-k3s.1/go.mod h1:Hn4ZV+eq0LhLZP63xZnxdGwXEoRSxs5sxELxu27M3UA= github.com/rancher/helm-controller v0.3.0 h1:sYRpOiJc4+NmSEkft3lR2pwaEPOrPzZOTo2UjFnVF4I= github.com/rancher/helm-controller v0.3.0/go.mod h1:194LHuZRrxcD82bG1rJtOWsw98U4JbPhDWqvL7l3PAw= -github.com/rancher/kine v0.3.1 h1:gwfKz/KoyZG7Dyo/eKYb3eAKne6eSmQKE0etHTrGLLk= -github.com/rancher/kine v0.3.1/go.mod h1:xEMl0tLCva9/9me7mXJ3m9Vo6yqHgC4OU3NiK4CPrGQ= +github.com/rancher/kine v0.3.2 h1:2kP48ojBWVoZ6vlzixc9jc9uKRk7Yn1a7kWoOsJi7Sg= +github.com/rancher/kine v0.3.2/go.mod h1:xEMl0tLCva9/9me7mXJ3m9Vo6yqHgC4OU3NiK4CPrGQ= github.com/rancher/kubernetes v1.17.0-k3s.1 h1:g1xvTHOHMJxwWtseblor0gighLRHpL7Bf9MwX8HR3W0= github.com/rancher/kubernetes v1.17.0-k3s.1/go.mod h1:NbNV+69yL3eKiKDJ+ZEjqOplN3BFXKBeunzkoOy8WLo= github.com/rancher/kubernetes/staging/src/k8s.io/api v1.17.0-k3s.1 h1:L2mS7D+Kv/0ZUg9uJZcPfKuDCYcKOTprTQsK35i2hFg= diff --git a/vendor/github.com/rancher/kine/pkg/client/client.go b/vendor/github.com/rancher/kine/pkg/client/client.go index 03983c315a..8dfc8ae70d 100644 --- a/vendor/github.com/rancher/kine/pkg/client/client.go +++ b/vendor/github.com/rancher/kine/pkg/client/client.go @@ -11,6 +11,7 @@ import ( ) type Value struct { + Key []byte Data []byte Modified int64 } @@ -20,6 +21,7 @@ var ( ) type Client interface { + List(ctx context.Context, key string, rev int) ([]Value, error) Get(ctx context.Context, key string) (Value, error) Put(ctx context.Context, key string, value []byte) error Create(ctx context.Context, key string, value []byte) error @@ -51,6 +53,24 @@ func New(config endpoint.ETCDConfig) (Client, error) { }, nil } +func (c *client) List(ctx context.Context, key string, rev int) ([]Value, error) { + resp, err := c.c.Get(ctx, key, clientv3.WithPrefix(), clientv3.WithRev(int64(rev))) + if err != nil { + return nil, err + } + + var vals []Value + for _, kv := range resp.Kvs { + vals = append(vals, Value{ + Key: kv.Key, + Data: kv.Value, + Modified: kv.ModRevision, + }) + } + + return vals, nil +} + func (c *client) Get(ctx context.Context, key string) (Value, error) { resp, err := c.c.Get(ctx, key) if err != nil { @@ -59,6 +79,7 @@ func (c *client) Get(ctx context.Context, key string) (Value, error) { if len(resp.Kvs) == 1 { return Value{ + Key: resp.Kvs[0].Key, Data: resp.Kvs[0].Value, Modified: resp.Kvs[0].ModRevision, }, nil diff --git a/vendor/github.com/rancher/kine/pkg/logstructured/sqllog/sql.go b/vendor/github.com/rancher/kine/pkg/logstructured/sqllog/sql.go index ede63b12d1..ddbab8c2c6 100644 --- a/vendor/github.com/rancher/kine/pkg/logstructured/sqllog/sql.go +++ b/vendor/github.com/rancher/kine/pkg/logstructured/sqllog/sql.go @@ -172,8 +172,16 @@ func (s *SQLLog) List(ctx context.Context, prefix, startKey string, limit, revis err error ) + // It's assumed that when there is a start key that that key exists. if strings.HasSuffix(prefix, "/") { + // In the situation of a list start the startKey will not exist so set to "" + if prefix == startKey { + startKey = "" + } prefix += "%" + } else { + // Also if this isn't a list there is no reason to pass startKey + startKey = "" } if revision == 0 { diff --git a/vendor/modules.txt b/vendor/modules.txt index d1d42ba396..2c32e3cb82 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -725,7 +725,7 @@ github.com/rancher/helm-controller/pkg/generated/informers/externalversions/helm github.com/rancher/helm-controller/pkg/generated/informers/externalversions/internalinterfaces github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1 github.com/rancher/helm-controller/pkg/helm -# github.com/rancher/kine v0.3.1 +# github.com/rancher/kine v0.3.2 github.com/rancher/kine/pkg/broadcaster github.com/rancher/kine/pkg/client github.com/rancher/kine/pkg/drivers/dqlite