From cf5b0ebff5ec19d0d79b38bc352b7dc6fba6364c Mon Sep 17 00:00:00 2001 From: knative-automation Date: Thu, 20 May 2021 03:55:17 -0700 Subject: [PATCH] upgrade to latest dependencies (#5417) bumping knative.dev/reconciler-test d5adf72...8d70771: > 8d70771 Update actions (# 199) > a2bcdd8 Add Kafka projects to downstream tests (# 197) > 98f9e5a Update knative/community files (# 198) bumping knative.dev/pkg 4564797...67897f4: > 67897f4 Replace golint with revive (# 2126) > 1442287 Add knative-release-leads to OWNERS (# 2125) > 9b837a7 Update actions (# 2123) > 525c625 Update actions (# 2121) > 620e8d2 Allow disable via regex in chaosduck (# 2117) > 1f5a45b Update knative/community files (# 2119) Signed-off-by: Knative Automation --- go.mod | 4 +-- go.sum | 7 +++-- .../pkg/apis/duck/v1beta1/destination.go | 5 +--- .../pkg/leaderelection/chaosduck/main.go | 28 +++++++++++++++---- vendor/modules.txt | 4 +-- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index d9a268d78ec..4b6ec6fb2d5 100644 --- a/go.mod +++ b/go.mod @@ -43,8 +43,8 @@ require ( k8s.io/utils v0.0.0-20200729134348-d5654de09c73 knative.dev/hack v0.0.0-20210428122153-93ad9129c268 knative.dev/hack/schema v0.0.0-20210428122153-93ad9129c268 - knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7 - knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be + knative.dev/pkg v0.0.0-20210518131015-67897f4ec290 + knative.dev/reconciler-test v0.0.0-20210514214942-8d70771450f1 sigs.k8s.io/yaml v1.2.0 ) diff --git a/go.sum b/go.sum index da50a9b9a77..6e52d8985ec 100644 --- a/go.sum +++ b/go.sum @@ -1120,10 +1120,11 @@ knative.dev/hack v0.0.0-20210428122153-93ad9129c268 h1:lBIj9Epd9UQ55NEaHzAdY/UZb knative.dev/hack v0.0.0-20210428122153-93ad9129c268/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack/schema v0.0.0-20210428122153-93ad9129c268 h1:jGNg9Mi/BGsEEJ66ldekP5gkVRy+Yi5K3KTi9gLqQ4M= knative.dev/hack/schema v0.0.0-20210428122153-93ad9129c268/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= -knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7 h1:i4P8emOPrLctmbaPHp5eRIOqz+XTOkit7KgZeS+onKs= knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE= -knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be h1:auIvV9JfTCZ/wROftfLy9JGOK2tyZtE9M0DR2nOFOOk= -knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be/go.mod h1:ZHvzjwe5aUnWDx+u5y9EPaZ++5PM9Yapp/IvBDiS+Yk= +knative.dev/pkg v0.0.0-20210518131015-67897f4ec290 h1:JPptrA2SNKSAqsdzBkS+MTMYhGSOSJWPlu+cGKWNFjM= +knative.dev/pkg v0.0.0-20210518131015-67897f4ec290/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE= +knative.dev/reconciler-test v0.0.0-20210514214942-8d70771450f1 h1:Xf/JUzEjkkmW5ppczck49Dpi828AuIdqzZFO5DwqdHs= +knative.dev/reconciler-test v0.0.0-20210514214942-8d70771450f1/go.mod h1:ZHvzjwe5aUnWDx+u5y9EPaZ++5PM9Yapp/IvBDiS+Yk= pgregory.net/rapid v0.3.3 h1:jCjBsY4ln4Atz78QoBWxUEvAHaFyNDQg9+WU62aCn1U= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go b/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go index fe0f5d171d0..4e369b87216 100644 --- a/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go +++ b/vendor/knative.dev/pkg/apis/duck/v1beta1/destination.go @@ -136,10 +136,7 @@ func (dest *Destination) GetRef() *corev1.ObjectReference { if dest.Ref != nil { return dest.Ref } - if ref := dest.deprecatedObjectReference(); ref != nil { - return ref - } - return nil + return dest.deprecatedObjectReference() } func validateDestinationRef(ref corev1.ObjectReference) *apis.FieldError { diff --git a/vendor/knative.dev/pkg/leaderelection/chaosduck/main.go b/vendor/knative.dev/pkg/leaderelection/chaosduck/main.go index 2ad685fe31c..686b36e01f3 100644 --- a/vendor/knative.dev/pkg/leaderelection/chaosduck/main.go +++ b/vendor/knative.dev/pkg/leaderelection/chaosduck/main.go @@ -24,6 +24,7 @@ import ( "errors" "flag" "log" + "regexp" "strings" "time" @@ -44,14 +45,16 @@ import ( type components map[string]sets.String var ( - disabledComponents kflag.StringSet - tributePeriod time.Duration = 20 * time.Second - tributeFactor = 2.0 + disabledComponents kflag.StringSet + disabledComponentsRegex kflag.StringSet + tributePeriod = 20 * time.Second + tributeFactor = 2.0 ) func init() { // Note that we don't explicitly call flag.Parse() because ParseAndGetConfigOrDie below does this already. flag.Var(&disabledComponents, "disable", "A repeatable flag to disable chaos for certain components.") + flag.Var(&disabledComponentsRegex, "disableRegex", "A repeatable flag to disable chaos for components matching one of the passed regexes.") flag.DurationVar(&tributePeriod, "period", tributePeriod, "How frequently to terminate a leader pod per component (this is the base duration used with the jitter factor from -factor).") flag.Float64Var(&tributeFactor, "factor", tributeFactor, "The jitter factor to apply to the period.") } @@ -116,11 +119,25 @@ func quack(ctx context.Context, kc kubernetes.Interface, component string, leade return kc.CoreV1().Pods(system.Namespace()).Delete(ctx, tribute, metav1.DeleteOptions{}) } +// matchesAny returns true if any of the given regexes matches the given string. +func matchesAny(regexes []*regexp.Regexp, str string) bool { + for _, re := range regexes { + if re.MatchString(str) { + return true + } + } + return false +} + func main() { ctx, _ := injection.EnableInjectionOrDie(signals.NewContext(), nil) - kc := kubeclient.Get(ctx) + regexes := make([]*regexp.Regexp, 0, len(disabledComponentsRegex.Value)) + for re := range disabledComponentsRegex.Value { + regexes = append(regexes, regexp.MustCompile(re)) + } + // Until we are shutdown, build up an index of components and kill // of a leader at the specified frequency. wait.JitterUntilWithContext(ctx, func(ctx context.Context) { @@ -132,9 +149,10 @@ func main() { eg, ctx := errgroup.WithContext(ctx) for name, leaders := range components { - if disabledComponents.Value.Has(name) { + if disabledComponents.Value.Has(name) || matchesAny(regexes, name) { continue } + name, leaders := name, leaders eg.Go(func() error { return quack(ctx, kc, name, leaders) diff --git a/vendor/modules.txt b/vendor/modules.txt index 568f5e3d295..b2a2ecb1669 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -988,7 +988,7 @@ knative.dev/hack/schema/commands knative.dev/hack/schema/docs knative.dev/hack/schema/registry knative.dev/hack/schema/schema -# knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7 +# knative.dev/pkg v0.0.0-20210518131015-67897f4ec290 ## explicit knative.dev/pkg/apiextensions/storageversion knative.dev/pkg/apiextensions/storageversion/cmd/migrate @@ -1113,7 +1113,7 @@ knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/conversion knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be +# knative.dev/reconciler-test v0.0.0-20210514214942-8d70771450f1 ## explicit knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment