diff --git a/go.mod b/go.mod index 07ee8b495..35f9c6122 100644 --- a/go.mod +++ b/go.mod @@ -21,11 +21,11 @@ require ( k8s.io/cli-runtime v0.23.4 k8s.io/client-go v0.23.5 k8s.io/code-generator v0.23.5 - knative.dev/eventing v0.31.1-0.20220428204853-01f56122bf2a - knative.dev/hack v0.0.0-20220427014036-5f473869d377 - knative.dev/networking v0.0.0-20220429044653-591d2bb63aae - knative.dev/pkg v0.0.0-20220428192552-5c8cc3c9efd3 - knative.dev/serving v0.31.1-0.20220429200154-f6cb424aaae3 + knative.dev/eventing v0.31.1-0.20220509144032-9af98709e92b + knative.dev/hack v0.0.0-20220506160929-a8076b0510ed + knative.dev/networking v0.0.0-20220505013701-91dcb36802a9 + knative.dev/pkg v0.0.0-20220505013700-a8b7d99374a3 + knative.dev/serving v0.31.1-0.20220510145433-f726b1db1b0a sigs.k8s.io/yaml v1.3.0 ) @@ -107,7 +107,6 @@ require ( go.opencensus.io v0.23.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect go.uber.org/atomic v1.9.0 // indirect - go.uber.org/goleak v1.1.12 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.19.1 // indirect golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect diff --git a/go.sum b/go.sum index baa3ab2ac..c710ec04c 100644 --- a/go.sum +++ b/go.sum @@ -2268,22 +2268,25 @@ k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc= k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -knative.dev/caching v0.0.0-20220428025253-fbd3e15507cf/go.mod h1:KrKJ/aoy/mwlQcSvHidBRPlJn1rRhZlPbqPHbxGtuz4= -knative.dev/eventing v0.31.1-0.20220428204853-01f56122bf2a h1:WLiDXHa9k97/lDmwBqgPuzI/6zQL4agrTH+jYjw1vFM= -knative.dev/eventing v0.31.1-0.20220428204853-01f56122bf2a/go.mod h1:jdXjZKlLMwEj2KFKatzbqKWyOJAjUtn3072V3SkKIGI= -knative.dev/hack v0.0.0-20220411131823-6ffd8417de7c/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/hack v0.0.0-20220427014036-5f473869d377 h1:NMJG3LkOZ5Xut7TzbxtwaQAmT8ZBfDMxwCkoatZv8ms= +knative.dev/caching v0.0.0-20220504134959-dd8e0ef37355/go.mod h1:AoEBl6LxEVEHZNkuu/s34Z/ffIFX8SQBJ7+puQXkczU= +knative.dev/eventing v0.31.1-0.20220509144032-9af98709e92b h1:Pn78o0BAvZY5KBdYpt0zFuOOQHXzI6WOaQT+R78wx3E= +knative.dev/eventing v0.31.1-0.20220509144032-9af98709e92b/go.mod h1:aqiJ8eEXtXBz3vERz/2lbkRjA1jbG6yXujaEGHqKLgs= knative.dev/hack v0.0.0-20220427014036-5f473869d377/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/hack/schema v0.0.0-20220427014036-5f473869d377/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= -knative.dev/networking v0.0.0-20220429044653-591d2bb63aae h1:zdQdJdTDzqudH+FJVFfGt+3N3zqqljZpF0mCIV/CX2Y= -knative.dev/networking v0.0.0-20220429044653-591d2bb63aae/go.mod h1:SocyTv3I1HLDCOcLTKgdRrciOg3m0fNxd0BfqOEWv20= -knative.dev/pkg v0.0.0-20220427013826-1f681e126af6/go.mod h1:j2MeD8s+JoCu1vegX80GbRXV/xd20Jm1NznxBYtVXiM= -knative.dev/pkg v0.0.0-20220427171752-2d552be030f6/go.mod h1:NXK3p/UMCbFybBM9xQGii3TuMN/WKHByXcYsTwZ6Y6U= -knative.dev/pkg v0.0.0-20220428192552-5c8cc3c9efd3 h1:wznCcHq6F1QNC8MGqekF+L4EpjMLwmFv+WQKds9qM1g= -knative.dev/pkg v0.0.0-20220428192552-5c8cc3c9efd3/go.mod h1:NXK3p/UMCbFybBM9xQGii3TuMN/WKHByXcYsTwZ6Y6U= -knative.dev/reconciler-test v0.0.0-20220427134652-f14902d1c7a5/go.mod h1:IZTJfC1sgr70/39NIne/MmaNbDWRHwT6cWvJB3AeHIU= -knative.dev/serving v0.31.1-0.20220429200154-f6cb424aaae3 h1:4zcGmn2hgyUn4GH69wPGXSADb6QFUfCi/7DofUnDWjY= -knative.dev/serving v0.31.1-0.20220429200154-f6cb424aaae3/go.mod h1:0QD86J9/jjo9p8EBGdegLYG3n5HP75RMBORtoXs7/Lo= +knative.dev/hack v0.0.0-20220503220458-46c77f157e20/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= +knative.dev/hack v0.0.0-20220505013956-ccf82ad03f32/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= +knative.dev/hack v0.0.0-20220506160929-a8076b0510ed h1:6mFHY1IFMRnO9O1z9q6xL9mAy6Gpm8SmRQ2KbahXKz0= +knative.dev/hack v0.0.0-20220506160929-a8076b0510ed/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= +knative.dev/hack/schema v0.0.0-20220506160929-a8076b0510ed/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= +knative.dev/networking v0.0.0-20220504043559-8d5dcbeeea2a/go.mod h1:+H5KnK/r/4/WtRRacuQuuGEjCn0961q2o7gwl+FoZfo= +knative.dev/networking v0.0.0-20220505013701-91dcb36802a9 h1:3/5bRIjG/cHKCQVmD/lMVCFKaym1U+0+Hlah25sF8c8= +knative.dev/networking v0.0.0-20220505013701-91dcb36802a9/go.mod h1:+H5KnK/r/4/WtRRacuQuuGEjCn0961q2o7gwl+FoZfo= +knative.dev/pkg v0.0.0-20220503223858-245166458ef4/go.mod h1:NXK3p/UMCbFybBM9xQGii3TuMN/WKHByXcYsTwZ6Y6U= +knative.dev/pkg v0.0.0-20220504135159-0719b405eca5/go.mod h1:mRzBIY8eoQurpADZ4+3LzNuucKOBhsSvhX6lXqMVpIc= +knative.dev/pkg v0.0.0-20220505013700-a8b7d99374a3 h1:odf5hudTbupqdYDsxeqofZtMsZuU0FqPZqWI6xETYIA= +knative.dev/pkg v0.0.0-20220505013700-a8b7d99374a3/go.mod h1:mRzBIY8eoQurpADZ4+3LzNuucKOBhsSvhX6lXqMVpIc= +knative.dev/reconciler-test v0.0.0-20220505183729-e295cedfd97b/go.mod h1:blANTpykbOpFykGxucL/8RkU8hH4WmZRWaxifP8heF4= +knative.dev/serving v0.31.1-0.20220510145433-f726b1db1b0a h1:M2wdCCJPQYWtqNT4HzRXKSyyWvgSzv1+RVMWNsIF5As= +knative.dev/serving v0.31.1-0.20220510145433-f726b1db1b0a/go.mod h1:p3hhjSBFUOGgyapoypIGLgHp9dJvdIH3ZiJz+DCtbic= mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= diff --git a/vendor/knative.dev/hack/e2e-tests.sh b/vendor/knative.dev/hack/e2e-tests.sh index 9178eac2c..57222f32c 100644 --- a/vendor/knative.dev/hack/e2e-tests.sh +++ b/vendor/knative.dev/hack/e2e-tests.sh @@ -137,13 +137,17 @@ CLOUD_PROVIDER="gke" function initialize() { local run_tests=0 local custom_flags=() + local parse_script_flags=0 E2E_SCRIPT="$(get_canonical_path "$0")" local e2e_script_command=( "${E2E_SCRIPT}" "--run-tests" ) + for i in "$@"; do + if [[ $i == "--run-tests" ]]; then parse_script_flags=1; fi + done + cd "${REPO_ROOT_DIR}" while [[ $# -ne 0 ]]; do local parameter=$1 - # TODO(chizhg): remove parse_flags logic if no repos are using it. # Try parsing flag as a custom one. if function_exists parse_flags; then parse_flags "$@" @@ -152,7 +156,10 @@ function initialize() { # Skip parsed flag (and possibly argument) and continue # Also save it to it's passed through to the test script for ((i=1;i<=skip;i++)); do - e2e_script_command+=("$1") + # Avoid double-parsing + if (( parse_script_flags )); then + e2e_script_command+=("$1") + fi shift done continue diff --git a/vendor/knative.dev/pkg/apis/deprecated.go b/vendor/knative.dev/pkg/apis/deprecated.go index fb73306fa..8f07e71b3 100644 --- a/vendor/knative.dev/pkg/apis/deprecated.go +++ b/vendor/knative.dev/pkg/apis/deprecated.go @@ -36,12 +36,15 @@ func CheckDeprecated(ctx context.Context, obj interface{}) *FieldError { // CheckDeprecatedUpdate checks whether the provided named deprecated fields // are set in a context where deprecation is disallowed. // This is a json shallow check. We will recursively check inlined structs. -func CheckDeprecatedUpdate(ctx context.Context, obj, original interface{}) *FieldError { +func CheckDeprecatedUpdate(ctx context.Context, obj, original interface{}) (errs *FieldError) { if IsDeprecatedAllowed(ctx) { + // TODO: We should still run through the validation here, but do + // something like: + // defer func() { + // errs = errs.At(WarningLevel) + // }() return nil } - - var errs *FieldError objFields, objInlined := getPrefixedNamedFieldValues(deprecatedPrefix, obj) if nonZero(reflect.ValueOf(original)) { diff --git a/vendor/knative.dev/pkg/apis/field_error.go b/vendor/knative.dev/pkg/apis/field_error.go index 5ea51c0e4..ddd4838af 100644 --- a/vendor/knative.dev/pkg/apis/field_error.go +++ b/vendor/knative.dev/pkg/apis/field_error.go @@ -28,18 +28,54 @@ import ( // a problem with the current field itself. const CurrentField = "" +// DiagnosticLevel is used to signal the severity of a particular diagnostic +// in the form of a FieldError. +type DiagnosticLevel int + +const ( + // ErrorLevel is used to signify fatal/blocking diagnostics, e.g. those + // that should block admission in a validating admission webhook. + ErrorLevel DiagnosticLevel = iota + + // WarningLevel is used to signify information/non-blocking diagnostics, + // e.g. those that should be surfaced as warnings in a validating admission + // webhook. + WarningLevel +) + +func (dl DiagnosticLevel) String() string { + switch dl { + case ErrorLevel: + return "Error" + case WarningLevel: + return "Warning" + + default: + return fmt.Sprintf("", dl) + } +} + // FieldError is used to propagate the context of errors pertaining to // specific fields in a manner suitable for use in a recursive walk, so // that errors contain the appropriate field context. // FieldError methods are non-mutating. // +k8s:deepcopy-gen=true type FieldError struct { + // Message holds the main diagnostic message carried by this FieldError Message string - Paths []string + + // Paths holds a list of paths to which this diagnostic pertains + Paths []string + + // Level holds the severity of the diagnostic. + // If empty, this defaults to ErrorLevel. + Level DiagnosticLevel + // Details contains an optional longer payload. // +optional Details string - errors []FieldError + + errors []FieldError } // FieldError implements error @@ -60,6 +96,7 @@ func (fe *FieldError) ViaField(prefix ...string) *FieldError { // along using .Also(). newErr := &FieldError{ Message: fe.Message, + Level: fe.Level, Details: fe.Details, } @@ -107,6 +144,54 @@ func (fe *FieldError) ViaFieldKey(field, key string) *FieldError { return fe.ViaKey(key).ViaField(field) } +// At is a way to alter the level of the diagnostics held in this FieldError. +// ErrMissingField("foo").At(WarningLevel) +func (fe *FieldError) At(l DiagnosticLevel) *FieldError { + if fe == nil { + return nil + } + // Copy over message and details, paths will be updated and errors come + // along using .Also(). + newErr := &FieldError{ + Message: fe.Message, + Level: l, + Details: fe.Details, + Paths: fe.Paths, + } + + for _, e := range fe.errors { + newErr = newErr.Also(e.At(l)) + } + return newErr +} + +// Filter is a way to access the set of diagnostics having a particular level. +// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil { +// return err +// } +func (fe *FieldError) Filter(l DiagnosticLevel) *FieldError { + if fe == nil { + return nil + } + var newErr *FieldError + if l == fe.Level { + newErr = &FieldError{ + Message: fe.Message, + Level: fe.Level, + Details: fe.Details, + Paths: fe.Paths, + } + } + + for _, e := range fe.errors { + newErr = newErr.Also(e.Filter(l)) + } + if newErr.isEmpty() { + return nil + } + return newErr +} + // Also collects errors, returns a new collection of existing errors and new errors. func (fe *FieldError) Also(errs ...*FieldError) *FieldError { // Avoid doing any work, if we don't have to. @@ -154,6 +239,7 @@ func (fe *FieldError) normalized() []*FieldError { if fe.Message != "" { errors = append(errors, &FieldError{ Message: fe.Message, + Level: fe.Level, Paths: fe.Paths, Details: fe.Details, }) @@ -274,6 +360,9 @@ func merge(errs []*FieldError) []*FieldError { // Sort the flattened map. sort.Slice(newErrs, func(i, j int) bool { if newErrs[i].Message == newErrs[j].Message { + if newErrs[i].Details == newErrs[j].Details { + return newErrs[i].Level < newErrs[j].Level + } return newErrs[i].Details < newErrs[j].Details } return newErrs[i].Message < newErrs[j].Message @@ -285,7 +374,7 @@ func merge(errs []*FieldError) []*FieldError { // key returns the key using the fields .Message and .Details. func key(err *FieldError) string { - return fmt.Sprintf("%s-%s", err.Message, err.Details) + return fmt.Sprintf("%s-%s-%s", err.Level, err.Message, err.Details) } // Public helpers --- diff --git a/vendor/knative.dev/pkg/leaderelection/config.go b/vendor/knative.dev/pkg/leaderelection/config.go index 11010014a..ba6e0c60f 100644 --- a/vendor/knative.dev/pkg/leaderelection/config.go +++ b/vendor/knative.dev/pkg/leaderelection/config.go @@ -17,6 +17,7 @@ limitations under the License. package leaderelection import ( + "context" "fmt" "os" "strconv" @@ -88,6 +89,24 @@ type Config struct { LeaseNamesPrefixMapping map[string]string } +type lecfg struct{} + +// WithConfig associates a leader election configuration with the +// context. +func WithConfig(ctx context.Context, cfg *Config) context.Context { + return context.WithValue(ctx, lecfg{}, cfg) +} + +// GetConfig gets the leader election config from the provided +// context. +func GetConfig(ctx context.Context) *Config { + untyped := ctx.Value(lecfg{}) + if untyped == nil { + return nil + } + return untyped.(*Config) +} + func (c *Config) GetComponentConfig(name string) ComponentConfig { return ComponentConfig{ Component: name, diff --git a/vendor/knative.dev/pkg/logging/config.go b/vendor/knative.dev/pkg/logging/config.go index 5dbf0a4e4..2cf81a822 100644 --- a/vendor/knative.dev/pkg/logging/config.go +++ b/vendor/knative.dev/pkg/logging/config.go @@ -17,6 +17,7 @@ limitations under the License. package logging import ( + "context" "encoding/json" "errors" "fmt" @@ -136,6 +137,22 @@ type Config struct { LoggingLevel map[string]zapcore.Level } +type lcfg struct{} + +// WithConfig associates a logging configuration with the context. +func WithConfig(ctx context.Context, cfg *Config) context.Context { + return context.WithValue(ctx, lcfg{}, cfg) +} + +// GetConfig gets the logging config from the provided context. +func GetConfig(ctx context.Context) *Config { + untyped := ctx.Value(lcfg{}) + if untyped == nil { + return nil + } + return untyped.(*Config) +} + func defaultConfig() *Config { return &Config{ LoggingLevel: make(map[string]zapcore.Level), diff --git a/vendor/knative.dev/pkg/network/transports.go b/vendor/knative.dev/pkg/network/transports.go index c97d0052e..d48cd6215 100644 --- a/vendor/knative.dev/pkg/network/transports.go +++ b/vendor/knative.dev/pkg/network/transports.go @@ -113,7 +113,7 @@ func dialBackOffHelper(ctx context.Context, network, address string, bo wait.Bac return c, nil } elapsed := time.Since(start) - return nil, fmt.Errorf("%w after %.2fs", ErrTimeoutDialing, elapsed.Seconds()) + return nil, fmt.Errorf("%w %s after %.2fs", ErrTimeoutDialing, address, elapsed.Seconds()) } func newHTTPTransport(disableKeepAlives, disableCompression bool, maxIdle, maxIdlePerHost int) http.RoundTripper { diff --git a/vendor/modules.txt b/vendor/modules.txt index 84b58b21d..fdb6c27d2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -354,8 +354,6 @@ go.starlark.net/syntax # go.uber.org/atomic v1.9.0 ## explicit; go 1.13 go.uber.org/atomic -# go.uber.org/goleak v1.1.12 -## explicit; go 1.13 # go.uber.org/multierr v1.6.0 ## explicit; go 1.12 go.uber.org/multierr @@ -894,7 +892,7 @@ k8s.io/utils/internal/third_party/forked/golang/net k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/trace -# knative.dev/eventing v0.31.1-0.20220428204853-01f56122bf2a +# knative.dev/eventing v0.31.1-0.20220509144032-9af98709e92b ## explicit; go 1.16 knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/duck @@ -922,10 +920,10 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake -# knative.dev/hack v0.0.0-20220427014036-5f473869d377 +# knative.dev/hack v0.0.0-20220506160929-a8076b0510ed ## explicit; go 1.14 knative.dev/hack -# knative.dev/networking v0.0.0-20220429044653-591d2bb63aae +# knative.dev/networking v0.0.0-20220505013701-91dcb36802a9 ## explicit; go 1.16 knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking @@ -933,7 +931,7 @@ knative.dev/networking/pkg/apis/networking/v1alpha1 knative.dev/networking/pkg/client/clientset/versioned knative.dev/networking/pkg/client/clientset/versioned/scheme knative.dev/networking/pkg/client/clientset/versioned/typed/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20220428192552-5c8cc3c9efd3 +# knative.dev/pkg v0.0.0-20220505013700-a8b7d99374a3 ## explicit; go 1.17 knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -983,7 +981,7 @@ knative.dev/pkg/tracing/config knative.dev/pkg/tracing/propagation knative.dev/pkg/tracing/propagation/tracecontextb3 knative.dev/pkg/tracker -# knative.dev/serving v0.31.1-0.20220429200154-f6cb424aaae3 +# knative.dev/serving v0.31.1-0.20220510145433-f726b1db1b0a ## explicit; go 1.17 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1