upgrade to latest dependencies (#635)

bumping knative.dev/pkg 2d552be...2451664:
  > 2451664 Switch to iota/fmt.Stringer-based diagnostic levels. (# 2511)
  > ea3c8cb Fix timeout test on darwin and log dial destination on timeout. (# 2510)
  > af54d73 Support fetching configs from `ctx`. (# 2505)
  > 5f5455f Use the updated action that infers the module name (# 2509)
  > 4fced01 Use knative/action/go/downstream-test (# 2507)
  > 16b36b7 Add support for admission webhook warnings. (# 2498)
  > 6ec9c1a Fix linting (# 2506)
  > 5c8cc3c Ignore migration of CRDs that aren't installed (# 2493)
bumping knative.dev/hack 5f47386...46c77f1:
  > 46c77f1 Skip passing enable-ha flag to test script (# 173)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2022-05-04 09:49:59 -04:00 committed by GitHub
parent fbd3e15507
commit dd8e0ef373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 152 additions and 16 deletions

4
go.mod
View File

@ -10,6 +10,6 @@ require (
k8s.io/client-go v0.23.5
k8s.io/code-generator v0.23.5
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
knative.dev/hack v0.0.0-20220427014036-5f473869d377
knative.dev/pkg v0.0.0-20220427171752-2d552be030f6
knative.dev/hack v0.0.0-20220503220458-46c77f157e20
knative.dev/pkg v0.0.0-20220503223858-245166458ef4
)

7
go.sum
View File

@ -1147,10 +1147,11 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/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/hack v0.0.0-20220427014036-5f473869d377 h1:NMJG3LkOZ5Xut7TzbxtwaQAmT8ZBfDMxwCkoatZv8ms=
knative.dev/hack v0.0.0-20220427014036-5f473869d377/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20220427171752-2d552be030f6 h1:Qj5aQiYQFOFXAWp1+pw8k/o++PMuzEeLVpAYt70gxIU=
knative.dev/pkg v0.0.0-20220427171752-2d552be030f6/go.mod h1:NXK3p/UMCbFybBM9xQGii3TuMN/WKHByXcYsTwZ6Y6U=
knative.dev/hack v0.0.0-20220503220458-46c77f157e20 h1:g9TC+gRRwodYevEk+KFlF2Dj8sqHVXdn48m1jDIwEs0=
knative.dev/hack v0.0.0-20220503220458-46c77f157e20/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20220503223858-245166458ef4 h1:i5QWSGVD9dB0xmvBBYMVo+Hm5eamhyc8uU/+OHNkR3s=
knative.dev/pkg v0.0.0-20220503223858-245166458ef4/go.mod h1:NXK3p/UMCbFybBM9xQGii3TuMN/WKHByXcYsTwZ6Y6U=
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=

View File

@ -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
# Avoid double-parsing
if (( parse_script_flags )); then
e2e_script_command+=("$1")
fi
shift
done
continue

View File

@ -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)) {

View File

@ -28,17 +28,53 @@ 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("<UNKNOWN: %d>", 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 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
}
@ -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 ---

View File

@ -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,

View File

@ -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),

View File

@ -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 {

4
vendor/modules.txt vendored
View File

@ -600,10 +600,10 @@ k8s.io/utils/integer
k8s.io/utils/internal/third_party/forked/golang/net
k8s.io/utils/net
k8s.io/utils/trace
# knative.dev/hack v0.0.0-20220427014036-5f473869d377
# knative.dev/hack v0.0.0-20220503220458-46c77f157e20
## explicit
knative.dev/hack
# knative.dev/pkg v0.0.0-20220427171752-2d552be030f6
# knative.dev/pkg v0.0.0-20220503223858-245166458ef4
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck