mirror of https://github.com/k3s-io/k3s
commit
ba30690c18
2
go.mod
2
go.mod
|
@ -99,7 +99,7 @@ require (
|
||||||
github.com/rakelkar/gonetsh v0.0.0-20190719023240-501daadcadf8 // indirect
|
github.com/rakelkar/gonetsh v0.0.0-20190719023240-501daadcadf8 // indirect
|
||||||
github.com/rancher/dynamiclistener v0.2.0
|
github.com/rancher/dynamiclistener v0.2.0
|
||||||
github.com/rancher/helm-controller v0.3.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/remotedialer v0.2.0
|
||||||
github.com/rancher/wrangler v0.4.0
|
github.com/rancher/wrangler v0.4.0
|
||||||
github.com/rancher/wrangler-api v0.4.0
|
github.com/rancher/wrangler-api v0.4.0
|
||||||
|
|
4
go.sum
4
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/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 h1:sYRpOiJc4+NmSEkft3lR2pwaEPOrPzZOTo2UjFnVF4I=
|
||||||
github.com/rancher/helm-controller v0.3.0/go.mod h1:194LHuZRrxcD82bG1rJtOWsw98U4JbPhDWqvL7l3PAw=
|
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.2 h1:2kP48ojBWVoZ6vlzixc9jc9uKRk7Yn1a7kWoOsJi7Sg=
|
||||||
github.com/rancher/kine v0.3.1/go.mod h1:xEMl0tLCva9/9me7mXJ3m9Vo6yqHgC4OU3NiK4CPrGQ=
|
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 h1:g1xvTHOHMJxwWtseblor0gighLRHpL7Bf9MwX8HR3W0=
|
||||||
github.com/rancher/kubernetes v1.17.0-k3s.1/go.mod h1:NbNV+69yL3eKiKDJ+ZEjqOplN3BFXKBeunzkoOy8WLo=
|
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=
|
github.com/rancher/kubernetes/staging/src/k8s.io/api v1.17.0-k3s.1 h1:L2mS7D+Kv/0ZUg9uJZcPfKuDCYcKOTprTQsK35i2hFg=
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Value struct {
|
type Value struct {
|
||||||
|
Key []byte
|
||||||
Data []byte
|
Data []byte
|
||||||
Modified int64
|
Modified int64
|
||||||
}
|
}
|
||||||
|
@ -20,6 +21,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client interface {
|
type Client interface {
|
||||||
|
List(ctx context.Context, key string, rev int) ([]Value, error)
|
||||||
Get(ctx context.Context, key string) (Value, error)
|
Get(ctx context.Context, key string) (Value, error)
|
||||||
Put(ctx context.Context, key string, value []byte) error
|
Put(ctx context.Context, key string, value []byte) error
|
||||||
Create(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
|
}, 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) {
|
func (c *client) Get(ctx context.Context, key string) (Value, error) {
|
||||||
resp, err := c.c.Get(ctx, key)
|
resp, err := c.c.Get(ctx, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -59,6 +79,7 @@ func (c *client) Get(ctx context.Context, key string) (Value, error) {
|
||||||
|
|
||||||
if len(resp.Kvs) == 1 {
|
if len(resp.Kvs) == 1 {
|
||||||
return Value{
|
return Value{
|
||||||
|
Key: resp.Kvs[0].Key,
|
||||||
Data: resp.Kvs[0].Value,
|
Data: resp.Kvs[0].Value,
|
||||||
Modified: resp.Kvs[0].ModRevision,
|
Modified: resp.Kvs[0].ModRevision,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
@ -172,8 +172,16 @@ func (s *SQLLog) List(ctx context.Context, prefix, startKey string, limit, revis
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// It's assumed that when there is a start key that that key exists.
|
||||||
if strings.HasSuffix(prefix, "/") {
|
if strings.HasSuffix(prefix, "/") {
|
||||||
|
// In the situation of a list start the startKey will not exist so set to ""
|
||||||
|
if prefix == startKey {
|
||||||
|
startKey = ""
|
||||||
|
}
|
||||||
prefix += "%"
|
prefix += "%"
|
||||||
|
} else {
|
||||||
|
// Also if this isn't a list there is no reason to pass startKey
|
||||||
|
startKey = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if revision == 0 {
|
if revision == 0 {
|
||||||
|
|
|
@ -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/informers/externalversions/internalinterfaces
|
||||||
github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1
|
github.com/rancher/helm-controller/pkg/generated/listers/helm.cattle.io/v1
|
||||||
github.com/rancher/helm-controller/pkg/helm
|
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/broadcaster
|
||||||
github.com/rancher/kine/pkg/client
|
github.com/rancher/kine/pkg/client
|
||||||
github.com/rancher/kine/pkg/drivers/dqlite
|
github.com/rancher/kine/pkg/drivers/dqlite
|
||||||
|
|
Loading…
Reference in New Issue