mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#436)
bumping knative.dev/pkg 0f8d8de...bbe0bb3: > bbe0bb3 Implement getter machinery to generically fetch all injected clients (# 2054) > 85bc723 Add benchmark for metrics recording (# 2052) > cc278e1 upgrade to latest dependencies (# 2053) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
5353694c29
commit
9dc5ceb7b9
2
go.mod
2
go.mod
|
@ -18,5 +18,5 @@ require (
|
||||||
k8s.io/code-generator v0.19.7
|
k8s.io/code-generator v0.19.7
|
||||||
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
|
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
|
||||||
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a
|
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a
|
||||||
knative.dev/pkg v0.0.0-20210309024624-0f8d8de5949d
|
knative.dev/pkg v0.0.0-20210310173525-bbe0bb3eb1e0
|
||||||
)
|
)
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -1186,12 +1186,10 @@ k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL
|
||||||
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=
|
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=
|
||||||
k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K8Hf8whTseBgJcg=
|
k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K8Hf8whTseBgJcg=
|
||||||
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||||
knative.dev/hack v0.0.0-20210305150220-f99a25560134 h1:lUllAp28TkevQIgWrsjow8ZLnXJy3AraRzGFm/ffD2c=
|
|
||||||
knative.dev/hack v0.0.0-20210305150220-f99a25560134/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
|
||||||
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a h1:0UGKyvFzY1Czu0lP9+0IrJhwtKe2oNLI2GYa7MIQ5c0=
|
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a h1:0UGKyvFzY1Czu0lP9+0IrJhwtKe2oNLI2GYa7MIQ5c0=
|
||||||
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||||
knative.dev/pkg v0.0.0-20210309024624-0f8d8de5949d h1:2Uc3qyLRLIYOqJrGGKFkJc69X+cxlhoH3jk7p4b4KFM=
|
knative.dev/pkg v0.0.0-20210310173525-bbe0bb3eb1e0 h1:j1YS+xEsmRLnhmrSwr6Skg3xsJcQpUGFzkoGtAaBx6I=
|
||||||
knative.dev/pkg v0.0.0-20210309024624-0f8d8de5949d/go.mod h1:fP690UCcs5x+qQVhjJxNcm97OWIiUdFC1dqbD3Gsp64=
|
knative.dev/pkg v0.0.0-20210310173525-bbe0bb3eb1e0/go.mod h1:pn/vClSL/iCW40TlFR91EhtmMmsyPQR2V2LavDAOOMs=
|
||||||
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
|
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||||
|
|
|
@ -29,6 +29,9 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
injection.Default.RegisterClient(withClient)
|
injection.Default.RegisterClient(withClient)
|
||||||
|
injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} {
|
||||||
|
return Get(ctx)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key is used as the key for associating information with a context.Context.
|
// Key is used as the key for associating information with a context.Context.
|
||||||
|
|
|
@ -31,6 +31,9 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
injection.Fake.RegisterClient(withClient)
|
injection.Fake.RegisterClient(withClient)
|
||||||
|
injection.Fake.RegisterClientFetcher(func(ctx context.Context) interface{} {
|
||||||
|
return Get(ctx)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func withClient(ctx context.Context, cfg *rest.Config) context.Context {
|
func withClient(ctx context.Context, cfg *rest.Config) context.Context {
|
||||||
|
|
|
@ -66,7 +66,11 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io
|
||||||
"clientSetNewForConfigOrDie": c.Universe.Function(types.Name{Package: g.clientSetPackage, Name: "NewForConfigOrDie"}),
|
"clientSetNewForConfigOrDie": c.Universe.Function(types.Name{Package: g.clientSetPackage, Name: "NewForConfigOrDie"}),
|
||||||
"clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}),
|
"clientSetInterface": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}),
|
||||||
"injectionRegisterClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterClient"}),
|
"injectionRegisterClient": c.Universe.Function(types.Name{Package: "knative.dev/pkg/injection", Name: "Default.RegisterClient"}),
|
||||||
"restConfig": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}),
|
"injectionRegisterClientFetcher": c.Universe.Function(types.Name{
|
||||||
|
Package: "knative.dev/pkg/injection",
|
||||||
|
Name: "Default.RegisterClientFetcher",
|
||||||
|
}),
|
||||||
|
"restConfig": c.Universe.Type(types.Name{Package: "k8s.io/client-go/rest", Name: "Config"}),
|
||||||
"loggingFromContext": c.Universe.Function(types.Name{
|
"loggingFromContext": c.Universe.Function(types.Name{
|
||||||
Package: "knative.dev/pkg/logging",
|
Package: "knative.dev/pkg/logging",
|
||||||
Name: "FromContext",
|
Name: "FromContext",
|
||||||
|
@ -85,6 +89,9 @@ func (g *clientGenerator) GenerateType(c *generator.Context, t *types.Type, w io
|
||||||
var injectionClient = `
|
var injectionClient = `
|
||||||
func init() {
|
func init() {
|
||||||
{{.injectionRegisterClient|raw}}(withClient)
|
{{.injectionRegisterClient|raw}}(withClient)
|
||||||
|
{{.injectionRegisterClientFetcher|raw}}(func(ctx context.Context) interface{} {
|
||||||
|
return Get(ctx)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key is used as the key for associating information with a context.Context.
|
// Key is used as the key for associating information with a context.Context.
|
||||||
|
|
|
@ -71,6 +71,10 @@ func (g *fakeClientGenerator) GenerateType(c *generator.Context, t *types.Type,
|
||||||
Package: "knative.dev/pkg/injection",
|
Package: "knative.dev/pkg/injection",
|
||||||
Name: "Fake.RegisterClient",
|
Name: "Fake.RegisterClient",
|
||||||
}),
|
}),
|
||||||
|
"injectionRegisterClientFetcher": c.Universe.Function(types.Name{
|
||||||
|
Package: "knative.dev/pkg/injection",
|
||||||
|
Name: "Fake.RegisterClientFetcher",
|
||||||
|
}),
|
||||||
"loggingFromContext": c.Universe.Function(types.Name{
|
"loggingFromContext": c.Universe.Function(types.Name{
|
||||||
Package: "knative.dev/pkg/logging",
|
Package: "knative.dev/pkg/logging",
|
||||||
Name: "FromContext",
|
Name: "FromContext",
|
||||||
|
@ -91,6 +95,9 @@ func (g *fakeClientGenerator) GenerateType(c *generator.Context, t *types.Type,
|
||||||
var injectionFakeClient = `
|
var injectionFakeClient = `
|
||||||
func init() {
|
func init() {
|
||||||
{{.injectionRegisterClient|raw}}(withClient)
|
{{.injectionRegisterClient|raw}}(withClient)
|
||||||
|
{{.injectionRegisterClientFetcher|raw}}(func(ctx context.Context) interface{} {
|
||||||
|
return Get(ctx)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func withClient(ctx {{.contextContext|raw}}, cfg *{{.restConfig|raw}}) {{.contextContext|raw}} {
|
func withClient(ctx {{.contextContext|raw}}, cfg *{{.restConfig|raw}}) {{.contextContext|raw}} {
|
||||||
|
|
|
@ -26,6 +26,10 @@ import (
|
||||||
// client type to a context.
|
// client type to a context.
|
||||||
type ClientInjector func(context.Context, *rest.Config) context.Context
|
type ClientInjector func(context.Context, *rest.Config) context.Context
|
||||||
|
|
||||||
|
// ClientFetcher holds the type of a callback that returns a particular client type
|
||||||
|
// from a context.
|
||||||
|
type ClientFetcher func(context.Context) interface{}
|
||||||
|
|
||||||
func (i *impl) RegisterClient(ci ClientInjector) {
|
func (i *impl) RegisterClient(ci ClientInjector) {
|
||||||
i.m.Lock()
|
i.m.Lock()
|
||||||
defer i.m.Unlock()
|
defer i.m.Unlock()
|
||||||
|
@ -40,3 +44,21 @@ func (i *impl) GetClients() []ClientInjector {
|
||||||
// Copy the slice before returning.
|
// Copy the slice before returning.
|
||||||
return append(i.clients[:0:0], i.clients...)
|
return append(i.clients[:0:0], i.clients...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *impl) RegisterClientFetcher(f ClientFetcher) {
|
||||||
|
i.m.Lock()
|
||||||
|
defer i.m.Unlock()
|
||||||
|
|
||||||
|
i.clientFetchers = append(i.clientFetchers, f)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *impl) FetchAllClients(ctx context.Context) []interface{} {
|
||||||
|
i.m.RLock()
|
||||||
|
defer i.m.RUnlock()
|
||||||
|
|
||||||
|
clients := make([]interface{}, 0, len(i.clientFetchers))
|
||||||
|
for _, f := range i.clientFetchers {
|
||||||
|
clients = append(clients, f(ctx))
|
||||||
|
}
|
||||||
|
return clients
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,13 @@ type Interface interface {
|
||||||
// GetClients fetches all of the registered client injectors.
|
// GetClients fetches all of the registered client injectors.
|
||||||
GetClients() []ClientInjector
|
GetClients() []ClientInjector
|
||||||
|
|
||||||
|
// RegisterClientFetcher registers a new callback that fetches a client from
|
||||||
|
// a given context.
|
||||||
|
RegisterClientFetcher(ClientFetcher)
|
||||||
|
|
||||||
|
// FetchAllClients returns all known clients from the given context.
|
||||||
|
FetchAllClients(context.Context) []interface{}
|
||||||
|
|
||||||
// RegisterInformerFactory registers a new injector callback for associating
|
// RegisterInformerFactory registers a new injector callback for associating
|
||||||
// a new informer factory with a context.
|
// a new informer factory with a context.
|
||||||
RegisterInformerFactory(InformerFactoryInjector)
|
RegisterInformerFactory(InformerFactoryInjector)
|
||||||
|
@ -92,6 +99,7 @@ type impl struct {
|
||||||
m sync.RWMutex
|
m sync.RWMutex
|
||||||
|
|
||||||
clients []ClientInjector
|
clients []ClientInjector
|
||||||
|
clientFetchers []ClientFetcher
|
||||||
factories []InformerFactoryInjector
|
factories []InformerFactoryInjector
|
||||||
informers []InformerInjector
|
informers []InformerInjector
|
||||||
filteredInformers []FilteredInformersInjector
|
filteredInformers []FilteredInformersInjector
|
||||||
|
|
|
@ -658,7 +658,7 @@ k8s.io/utils/trace
|
||||||
# knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a
|
# knative.dev/hack v0.0.0-20210309141825-9b73a256fd9a
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/hack
|
knative.dev/hack
|
||||||
# knative.dev/pkg v0.0.0-20210309024624-0f8d8de5949d
|
# knative.dev/pkg v0.0.0-20210310173525-bbe0bb3eb1e0
|
||||||
## explicit
|
## explicit
|
||||||
knative.dev/pkg/apis
|
knative.dev/pkg/apis
|
||||||
knative.dev/pkg/apis/duck
|
knative.dev/pkg/apis/duck
|
||||||
|
|
Loading…
Reference in New Issue