mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#550)
bumping knative.dev/pkg caa95fe...819d556: > 819d556 Allow configuring bounded staleness for dynamic injection. (# 2323) > ba2b2b1 upgrade to latest dependencies (# 2319) bumping knative.dev/hack ced8ce7...02860f5: > 02860f5 Update community files (# 87) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
540eb6cbbf
commit
139fa31c7f
4
go.mod
4
go.mod
|
@ -20,6 +20,6 @@ require (
|
|||
k8s.io/client-go v0.21.4
|
||||
k8s.io/code-generator v0.21.4
|
||||
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7
|
||||
knative.dev/hack v0.0.0-20211019034732-ced8ce706528
|
||||
knative.dev/pkg v0.0.0-20211019101734-caa95feec115
|
||||
knative.dev/hack v0.0.0-20211025203920-02860f59a556
|
||||
knative.dev/pkg v0.0.0-20211025151738-819d556cdaa5
|
||||
)
|
||||
|
|
8
go.sum
8
go.sum
|
@ -1084,11 +1084,11 @@ k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 h1:vEx13qjvaZ4yfObSSXW7Br
|
|||
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE=
|
||||
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw=
|
||||
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/hack v0.0.0-20211018110626-47ac3b032e60/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/hack v0.0.0-20211019034732-ced8ce706528 h1:P3PuBxLnxESTnQL9Iv00wqFVL1a88MDj2zXDCQmvTvk=
|
||||
knative.dev/hack v0.0.0-20211019034732-ced8ce706528/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/pkg v0.0.0-20211019101734-caa95feec115 h1:rLX/wIB3FcitSin6QuW9r1QhsUcu+E3GHd99X9/0X+0=
|
||||
knative.dev/pkg v0.0.0-20211019101734-caa95feec115/go.mod h1:FXppOkebhp8SBDFI0vVqmcwC98KBxodLheaVansP5r4=
|
||||
knative.dev/hack v0.0.0-20211025203920-02860f59a556 h1:fO82ok0MvecmFmN1zGhCAw08uIiielhgN8NTdVVZEec=
|
||||
knative.dev/hack v0.0.0-20211025203920-02860f59a556/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/pkg v0.0.0-20211025151738-819d556cdaa5 h1:CxOkd21mpg0SJ0NzvwbxhVL/yE7jw6JegEriOzFvgG8=
|
||||
knative.dev/pkg v0.0.0-20211025151738-819d556cdaa5/go.mod h1:Q3PrYqZsnHU9rNJhyH/zhVdTojGfEqrkNnNG4arrJgE=
|
||||
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/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
|
|
|
@ -50,7 +50,7 @@ func withInformer(ctx context.Context) (context.Context, controller.Informer) {
|
|||
}
|
||||
|
||||
func withDynamicInformer(ctx context.Context) context.Context {
|
||||
inf := &wrapper{client: client.Get(ctx)}
|
||||
inf := &wrapper{client: client.Get(ctx), resourceVersion: injection.GetResourceVersion(ctx)}
|
||||
return context.WithValue(ctx, Key{}, inf)
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,8 @@ type wrapper struct {
|
|||
client versioned.Interface
|
||||
|
||||
namespace string
|
||||
|
||||
resourceVersion string
|
||||
}
|
||||
|
||||
var _ v1alpha1.ImageInformer = (*wrapper)(nil)
|
||||
|
@ -82,13 +84,21 @@ func (w *wrapper) Lister() cachingv1alpha1.ImageLister {
|
|||
}
|
||||
|
||||
func (w *wrapper) Images(namespace string) cachingv1alpha1.ImageNamespaceLister {
|
||||
return &wrapper{client: w.client, namespace: namespace}
|
||||
return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion}
|
||||
}
|
||||
|
||||
// SetResourceVersion allows consumers to adjust the minimum resourceVersion
|
||||
// used by the underlying client. It is not accessible via the standard
|
||||
// lister interface, but can be accessed through a user-defined interface and
|
||||
// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter)
|
||||
func (w *wrapper) SetResourceVersion(resourceVersion string) {
|
||||
w.resourceVersion = resourceVersion
|
||||
}
|
||||
|
||||
func (w *wrapper) List(selector labels.Selector) (ret []*apiscachingv1alpha1.Image, err error) {
|
||||
lo, err := w.client.CachingV1alpha1().Images(w.namespace).List(context.TODO(), v1.ListOptions{
|
||||
LabelSelector: selector.String(),
|
||||
// TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria.
|
||||
LabelSelector: selector.String(),
|
||||
ResourceVersion: w.resourceVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -101,6 +111,6 @@ func (w *wrapper) List(selector labels.Selector) (ret []*apiscachingv1alpha1.Ima
|
|||
|
||||
func (w *wrapper) Get(name string) (*apiscachingv1alpha1.Image, error) {
|
||||
return w.client.CachingV1alpha1().Images(w.namespace).Get(context.TODO(), name, v1.GetOptions{
|
||||
// TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria.
|
||||
ResourceVersion: w.resourceVersion,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -143,6 +143,10 @@ func (g *injectionGenerator) GenerateType(c *generator.Context, t *types.Type, w
|
|||
Name: "NewSharedIndexInformer",
|
||||
}),
|
||||
"Namespaced": !tags.NonNamespaced,
|
||||
"injectionGetResourceVersion": c.Universe.Function(types.Name{
|
||||
Package: "knative.dev/pkg/injection",
|
||||
Name: "GetResourceVersion",
|
||||
}),
|
||||
}
|
||||
|
||||
sw.Do(injectionInformer, m)
|
||||
|
@ -166,7 +170,7 @@ func withInformer(ctx {{.contextContext|raw}}) ({{.contextContext|raw}}, {{.cont
|
|||
}
|
||||
|
||||
func withDynamicInformer(ctx {{.contextContext|raw}}) {{.contextContext|raw}} {
|
||||
inf := &wrapper{client: {{ .clientGet|raw }}(ctx)}
|
||||
inf := &wrapper{client: {{ .clientGet|raw }}(ctx), resourceVersion: {{ .injectionGetResourceVersion|raw }}(ctx)}
|
||||
return {{ .contextWithValue|raw }}(ctx, Key{}, inf)
|
||||
}
|
||||
|
||||
|
@ -185,6 +189,7 @@ type wrapper struct {
|
|||
{{ if .Namespaced }}
|
||||
namespace string
|
||||
{{ end }}
|
||||
resourceVersion string
|
||||
}
|
||||
|
||||
var _ {{.informersTypedInformer|raw}} = (*wrapper)(nil)
|
||||
|
@ -200,14 +205,22 @@ func (w *wrapper) Lister() {{ .resourceLister|raw }} {
|
|||
|
||||
{{if .Namespaced}}
|
||||
func (w *wrapper) {{ .type|publicPlural }}(namespace string) {{ .resourceNamespaceLister|raw }} {
|
||||
return &wrapper{client: w.client, namespace: namespace}
|
||||
return &wrapper{client: w.client, namespace: namespace, resourceVersion: w.resourceVersion}
|
||||
}
|
||||
{{end}}
|
||||
|
||||
// SetResourceVersion allows consumers to adjust the minimum resourceVersion
|
||||
// used by the underlying client. It is not accessible via the standard
|
||||
// lister interface, but can be accessed through a user-defined interface and
|
||||
// an implementation check e.g. rvs, ok := foo.(ResourceVersionSetter)
|
||||
func (w *wrapper) SetResourceVersion(resourceVersion string) {
|
||||
w.resourceVersion = resourceVersion
|
||||
}
|
||||
|
||||
func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw }}, err error) {
|
||||
lo, err := w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).List({{ .contextTODO|raw }}(), {{ .metav1ListOptions|raw }}{
|
||||
LabelSelector: selector.String(),
|
||||
// TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria.
|
||||
ResourceVersion: w.resourceVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -220,7 +233,7 @@ func (w *wrapper) List(selector {{ .labelsSelector|raw }}) (ret []*{{ .type|raw
|
|||
|
||||
func (w *wrapper) Get(name string) (*{{ .type|raw }}, error) {
|
||||
return w.client.{{.groupGoName}}{{.versionGoName}}().{{.type|publicPlural}}({{if .Namespaced}}w.namespace{{end}}).Get({{ .contextTODO|raw }}(), name, {{ .metav1GetOptions|raw }}{
|
||||
// TODO(mattmoor): Incorporate resourceVersion bounds based on staleness criteria.
|
||||
ResourceVersion: w.resourceVersion,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -66,3 +66,20 @@ func GetConfig(ctx context.Context) *rest.Config {
|
|||
}
|
||||
return value.(*rest.Config)
|
||||
}
|
||||
|
||||
// rvKey is the key that the resource version is associated with.
|
||||
type rvKey struct{}
|
||||
|
||||
// WithResourceVersion associates a resource version with the context.
|
||||
func WithResourceVersion(ctx context.Context, resourceVersion string) context.Context {
|
||||
return context.WithValue(ctx, rvKey{}, resourceVersion)
|
||||
}
|
||||
|
||||
// GetResourceVersion gets the resource version associated with the context.
|
||||
func GetResourceVersion(ctx context.Context) string {
|
||||
value := ctx.Value(rvKey{})
|
||||
if value == nil {
|
||||
return ""
|
||||
}
|
||||
return value.(string)
|
||||
}
|
||||
|
|
|
@ -610,10 +610,10 @@ k8s.io/kube-openapi/pkg/util/sets
|
|||
k8s.io/utils/buffer
|
||||
k8s.io/utils/integer
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/hack v0.0.0-20211019034732-ced8ce706528
|
||||
# knative.dev/hack v0.0.0-20211025203920-02860f59a556
|
||||
## explicit
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20211019101734-caa95feec115
|
||||
# knative.dev/pkg v0.0.0-20211025151738-819d556cdaa5
|
||||
## explicit
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
Loading…
Reference in New Issue