upgrade to latest dependencies (#495)

bumping knative.dev/pkg dd0db4b...51cfaab:
  > 51cfaab Added inverse functions for the ptr package (# 2172)
  > cf1994e Update community files (# 2171)
  > 4cdacd0 add concurrency for each controller (# 2160)
  > e117baa Replace reference to obsolete xip.io service (# 2169)
  > a1bc850 Print proper warning logs from API warnings (# 2168)
  > a421cf1 upgrade to latest dependencies (# 2167)
  > 6b252df Update community files (# 2165)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2021-06-30 19:57:02 -07:00 committed by GitHub
parent bf65d6a42f
commit e6e703d955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 51 additions and 5 deletions

2
go.mod
View File

@ -20,5 +20,5 @@ require (
k8s.io/code-generator v0.20.7 k8s.io/code-generator v0.20.7
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd
knative.dev/hack v0.0.0-20210622141627-e28525d8d260 knative.dev/hack v0.0.0-20210622141627-e28525d8d260
knative.dev/pkg v0.0.0-20210622173328-dd0db4b05c80 knative.dev/pkg v0.0.0-20210628225612-51cfaabbcdf6
) )

4
go.sum
View File

@ -1064,8 +1064,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= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/hack v0.0.0-20210622141627-e28525d8d260 h1:f2eMtOubAOc/Q7JlvFPDKXiPlJVK+VpX2Cot8hRzCgQ= knative.dev/hack v0.0.0-20210622141627-e28525d8d260 h1:f2eMtOubAOc/Q7JlvFPDKXiPlJVK+VpX2Cot8hRzCgQ=
knative.dev/hack v0.0.0-20210622141627-e28525d8d260/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack v0.0.0-20210622141627-e28525d8d260/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20210622173328-dd0db4b05c80 h1:GHJ3lglE0/YHfBMMJqluqUNLOmsNXh7s7DBnfrkpRMM= knative.dev/pkg v0.0.0-20210628225612-51cfaabbcdf6 h1:DEZJpuiDMEzdJQZI0+ZAqsLe5uwsHHYOgrjcg0Sv8wA=
knative.dev/pkg v0.0.0-20210622173328-dd0db4b05c80/go.mod h1:kGegTnbZ+ljFjAE3E1+8wgaH2LMv8qYi+72o3F3cbdc= knative.dev/pkg v0.0.0-20210628225612-51cfaabbcdf6/go.mod h1:kGegTnbZ+ljFjAE3E1+8wgaH2LMv8qYi+72o3F3cbdc=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= 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/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

View File

@ -57,6 +57,7 @@ var (
// when processing the controller's workqueue. Controller binaries // when processing the controller's workqueue. Controller binaries
// may adjust this process-wide default. For finer control, invoke // may adjust this process-wide default. For finer control, invoke
// Run on the controller directly. // Run on the controller directly.
// TODO rename the const to Concurrency and deprecated this
DefaultThreadsPerController = 2 DefaultThreadsPerController = 2
) )
@ -203,6 +204,9 @@ type Impl struct {
// which are not required to complete at the highest priority. // which are not required to complete at the highest priority.
workQueue *twoLaneQueue workQueue *twoLaneQueue
// Concurrency - The number of workers to use when processing the controller's workqueue.
Concurrency int
// Sugared logger is easier to use but is not as performant as the // Sugared logger is easier to use but is not as performant as the
// raw logger. In performance critical paths, call logger.Desugar() // raw logger. In performance critical paths, call logger.Desugar()
// and use the returned raw logger instead. In addition to the // and use the returned raw logger instead. In addition to the
@ -221,6 +225,7 @@ type ControllerOptions struct { //nolint // for backcompat.
Logger *zap.SugaredLogger Logger *zap.SugaredLogger
Reporter StatsReporter Reporter StatsReporter
RateLimiter workqueue.RateLimiter RateLimiter workqueue.RateLimiter
Concurrency int
} }
// NewImpl instantiates an instance of our controller that will feed work to the // NewImpl instantiates an instance of our controller that will feed work to the
@ -244,12 +249,16 @@ func NewImplFull(r Reconciler, options ControllerOptions) *Impl {
if options.Reporter == nil { if options.Reporter == nil {
options.Reporter = MustNewStatsReporter(options.WorkQueueName, options.Logger) options.Reporter = MustNewStatsReporter(options.WorkQueueName, options.Logger)
} }
if options.Concurrency == 0 {
options.Concurrency = DefaultThreadsPerController
}
return &Impl{ return &Impl{
Name: options.WorkQueueName, Name: options.WorkQueueName,
Reconciler: r, Reconciler: r,
workQueue: newTwoLaneWorkQueue(options.WorkQueueName, options.RateLimiter), workQueue: newTwoLaneWorkQueue(options.WorkQueueName, options.RateLimiter),
logger: options.Logger, logger: options.Logger,
statsReporter: options.Reporter, statsReporter: options.Reporter,
Concurrency: options.Concurrency,
} }
} }
@ -723,9 +732,10 @@ func StartAll(ctx context.Context, controllers ...*Impl) {
// Start all of the controllers. // Start all of the controllers.
for _, ctrlr := range controllers { for _, ctrlr := range controllers {
wg.Add(1) wg.Add(1)
concurrency := ctrlr.Concurrency
go func(c *Impl) { go func(c *Impl) {
defer wg.Done() defer wg.Done()
c.RunContext(ctx, DefaultThreadsPerController) c.RunContext(ctx, concurrency)
}(ctrlr) }(ctrlr)
} }
wg.Wait() wg.Wait()

View File

@ -38,6 +38,9 @@ type Options struct {
// DemoteFunc configures the demote function this reconciler uses // DemoteFunc configures the demote function this reconciler uses
DemoteFunc func(b reconciler.Bucket) DemoteFunc func(b reconciler.Bucket)
// Concurrency - The number of workers to use when processing the controller's workqueue.
Concurrency int
} }
// OptionsFn is a callback method signature that accepts an Impl and returns // OptionsFn is a callback method signature that accepts an Impl and returns

View File

@ -0,0 +1,33 @@
/*
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 logging
import "go.uber.org/zap"
// WarningHandler is a warning handler to forward client-go's warning logs into a zap logger.
type WarningHandler struct {
Logger *zap.SugaredLogger
}
func (h *WarningHandler) HandleWarningHeader(code int, agent string, message string) {
// This condition is copied from K8s' default WarningLogger.
if code != 299 || len(message) == 0 {
return
}
h.Logger.Warn("API Warning: " + message)
}

2
vendor/modules.txt vendored
View File

@ -673,7 +673,7 @@ k8s.io/utils/trace
# knative.dev/hack v0.0.0-20210622141627-e28525d8d260 # knative.dev/hack v0.0.0-20210622141627-e28525d8d260
## explicit ## explicit
knative.dev/hack knative.dev/hack
# knative.dev/pkg v0.0.0-20210622173328-dd0db4b05c80 # knative.dev/pkg v0.0.0-20210628225612-51cfaabbcdf6
## explicit ## explicit
knative.dev/pkg/apis knative.dev/pkg/apis
knative.dev/pkg/apis/duck knative.dev/pkg/apis/duck