mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#526)
bumping knative.dev/pkg 7a61343...26db1ba: > 26db1ba Enable using `duckv1.WithPod` with our webhook infra. (# 2279) > 73d4fe6 Drop Retrying and EventuallyMatchesBody checks (# 2278) > bb433c9 Add tests for retriable errors to the spoof client (# 2277) > b09fa45 Declare `DefaultErrorRetryChecker` as `ErrorRetryChecker` type (# 2276) > dec98b4 fix a small lint warning (# 2270) > fbe9e7e Widen the error checker interface to allow response error checking (# 2253) Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
553240b1b3
commit
28b8b32493
2
go.mod
2
go.mod
|
@ -21,5 +21,5 @@ require (
|
|||
k8s.io/code-generator v0.21.4
|
||||
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7
|
||||
knative.dev/hack v0.0.0-20210806075220-815cd312d65c
|
||||
knative.dev/pkg v0.0.0-20210902202457-7a61343b36ca
|
||||
knative.dev/pkg v0.0.0-20210907232433-26db1ba732f6
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -978,8 +978,8 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g
|
|||
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/hack v0.0.0-20210806075220-815cd312d65c h1:nOXoDWAAItwr4o0dp3nHr6skgpVD4IvME/UX84YNl5k=
|
||||
knative.dev/hack v0.0.0-20210806075220-815cd312d65c/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
|
||||
knative.dev/pkg v0.0.0-20210902202457-7a61343b36ca h1:1tsBZgj1FheRcDQrIReteUiU/afjTZG8j5hTM3iBkJQ=
|
||||
knative.dev/pkg v0.0.0-20210902202457-7a61343b36ca/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8=
|
||||
knative.dev/pkg v0.0.0-20210907232433-26db1ba732f6 h1:nLHaEQP+SNW4E6zsgSS6wwpHNpSpag8vw8SSsH4ILw8=
|
||||
knative.dev/pkg v0.0.0-20210907232433-26db1ba732f6/go.mod h1:jMSqkNMsrzuy+XR4Yr/BMy7SDVbUOl3KKB6+5MR+ZU8=
|
||||
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=
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// PodSpecDefaulter is a callback to validate a PodSpecable.
|
||||
type PodSpecDefaulter func(context.Context, *WithPod)
|
||||
|
||||
// SetDefaults implements apis.Defaultable
|
||||
func (wp *WithPod) SetDefaults(ctx context.Context) {
|
||||
if psd := GetPodSpecDefaulter(ctx); psd != nil {
|
||||
psd(ctx, wp)
|
||||
}
|
||||
}
|
||||
|
||||
// psvKey is used for associating a PodSpecDefaulter with a context.Context
|
||||
type psdKey struct{}
|
||||
|
||||
func WithPodSpecDefaulter(ctx context.Context, psd PodSpecDefaulter) context.Context {
|
||||
return context.WithValue(ctx, psdKey{}, psd)
|
||||
}
|
||||
|
||||
// GetPodSpecDefaulter extracts the PodSpecDefaulter from the context.
|
||||
func GetPodSpecDefaulter(ctx context.Context) PodSpecDefaulter {
|
||||
untyped := ctx.Value(psdKey{})
|
||||
if untyped == nil {
|
||||
return nil
|
||||
}
|
||||
return untyped.(PodSpecDefaulter)
|
||||
}
|
|
@ -45,6 +45,9 @@ type WithPod struct {
|
|||
Spec WithPodSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
var _ apis.Validatable = (*WithPod)(nil)
|
||||
var _ apis.Defaultable = (*WithPod)(nil)
|
||||
|
||||
// WithPodSpec is the shell around the PodSpecable within WithPod.
|
||||
type WithPodSpec struct {
|
||||
Template PodSpecable `json:"template,omitempty"`
|
||||
|
@ -57,13 +60,13 @@ var (
|
|||
)
|
||||
|
||||
// GetFullType implements duck.Implementable
|
||||
func (*PodSpecable) GetFullType() ducktypes.Populatable {
|
||||
func (wp *PodSpecable) GetFullType() ducktypes.Populatable {
|
||||
return &WithPod{}
|
||||
}
|
||||
|
||||
// Populate implements duck.Populatable
|
||||
func (t *WithPod) Populate() {
|
||||
t.Spec.Template = PodSpecable{
|
||||
func (wp *WithPod) Populate() {
|
||||
wp.Spec.Template = PodSpecable{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
|
@ -79,7 +82,7 @@ func (t *WithPod) Populate() {
|
|||
}
|
||||
|
||||
// GetListType implements apis.Listable
|
||||
func (*WithPod) GetListType() runtime.Object {
|
||||
func (wp *WithPod) GetListType() runtime.Object {
|
||||
return &WithPodList{}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
Copyright 2021 The Knative Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"knative.dev/pkg/apis"
|
||||
)
|
||||
|
||||
// PodSpecValidator is a callback to validate a PodSpecable.
|
||||
type PodSpecValidator func(context.Context, *WithPod) *apis.FieldError
|
||||
|
||||
// Validate implements apis.Validatable
|
||||
func (wp *WithPod) Validate(ctx context.Context) *apis.FieldError {
|
||||
if psv := GetPodSpecValidator(ctx); psv != nil {
|
||||
return psv(ctx, wp)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// psvKey is used for associating a PodSpecValidator with a context.Context
|
||||
type psvKey struct{}
|
||||
|
||||
func WithPodSpecValidator(ctx context.Context, psv PodSpecValidator) context.Context {
|
||||
return context.WithValue(ctx, psvKey{}, psv)
|
||||
}
|
||||
|
||||
// GetPodSpecValidator extracts the PodSpecValidator from the context.
|
||||
func GetPodSpecValidator(ctx context.Context) PodSpecValidator {
|
||||
untyped := ctx.Value(psvKey{})
|
||||
if untyped == nil {
|
||||
return nil
|
||||
}
|
||||
return untyped.(PodSpecValidator)
|
||||
}
|
|
@ -612,7 +612,7 @@ k8s.io/utils/trace
|
|||
# knative.dev/hack v0.0.0-20210806075220-815cd312d65c
|
||||
## explicit
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20210902202457-7a61343b36ca
|
||||
# knative.dev/pkg v0.0.0-20210907232433-26db1ba732f6
|
||||
## explicit
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
Loading…
Reference in New Issue