Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
upgrade to latest dependencies (#2167)
Browse files Browse the repository at this point in the history
bumping knative.dev/pkg 9039dc1...08fc626:
  > 08fc626 Fix comment for skipKeyError (# 2041)
  > 2bc944b Fix race: Make informed watcher start wait for Add event 🏎️ (# 2036)
bumping knative.dev/serving 472f8e2...e9ea07e:
  > e9ea07e Only use exec probe at startup time (# 10741)
  > 6dcd8a6 Extend the e2e tests to use the new weighted averaging algorithms (# 10859)
  > 9478d4e Update net-contour nightly (# 10870)
  > 8e0ac01 Update net-kourier nightly (# 10869)
  > 092ddd9 Apply security best practises to domain-mapping-webhook (# 10867)
  > cd77781 Update net-kourier nightly (# 10863)
  > 2743018 Update net-istio nightly (# 10864)
  > f397d58 Use new filter function constructors (# 10862)
  > 26fd2fc upgrade to latest dependencies (# 10866)
bumping knative.dev/eventing 2db6877...21bcd68:
  > 21bcd68 Add buckets example to config-leader-election CM (# 4993)
  > 0f2612e add test for trigger having a wrong UID (# 5004)
  > 4282f45 fix broken in-mem ns mode (# 4906)
  > 9089b8e adding code coverage to adapters v2 (# 5000)
  > eb12f8a update to breaking change for feature.T in reconciler-test (# 5003)
  > c5f92fa upgrade to latest dependencies (# 5001)
  > f220668 add more coverage (# 4999)
  > fba3dbf Use common script in GH Actions (# 4997)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation authored Mar 3, 2021
1 parent 58cd25f commit 44793ce
Show file tree
Hide file tree
Showing 6 changed files with 172 additions and 30 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ require (
k8s.io/api v0.19.7
k8s.io/apimachinery v0.19.7
k8s.io/client-go v0.19.7
knative.dev/eventing v0.21.1-0.20210228124848-2db68776f120
knative.dev/eventing v0.21.1-0.20210303094015-21bcd68a9dcb
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf
knative.dev/pkg v0.0.0-20210226182947-9039dc189ced
knative.dev/serving v0.21.1-0.20210301115148-472f8e2bacf2
knative.dev/pkg v0.0.0-20210303111915-08fc6268bf96
knative.dev/serving v0.21.1-0.20210302234615-e9ea07ee268e
sigs.k8s.io/yaml v1.2.0
)

Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1428,20 +1428,20 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73 h1:uJmqzgNWG7XyClnU/mLPBWwfKKF1K
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/caching v0.0.0-20210216192653-d1dfa6451cd1/go.mod h1:1UeUQ6zQ3vHtZRpfuAW/f5oXb11EBqICfJqIzOeOrqU=
knative.dev/eventing v0.21.1-0.20210228124848-2db68776f120 h1:FMOaAAdp0EQEQRPckjGgVtOZIuT3XxcSUcfF1bloOzQ=
knative.dev/eventing v0.21.1-0.20210228124848-2db68776f120/go.mod h1:KtN2FEhPzxyqXKxpJufdq0lzL3Iu+5qjFqBal8Lg2tQ=
knative.dev/caching v0.0.0-20210301023148-ac5fcb4a9e14/go.mod h1:xQUvJARfE+G+P7WRR4BvTPi+5k8v1KWS1Yll0sLNEUc=
knative.dev/eventing v0.21.1-0.20210303094015-21bcd68a9dcb h1:klLf4Jz657qXytcfHu6mZeDOW5C6mHBiJQfbLhoVNL0=
knative.dev/eventing v0.21.1-0.20210303094015-21bcd68a9dcb/go.mod h1:xx42mnYqB+iEMYny6/M3vbe58BZAo+uLrWbOQF5Qrm0=
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf h1:u4cY4jr2LYvhoz/1HBWEPsMiLkm0HMdDTfmmw1RE8zE=
knative.dev/hack v0.0.0-20210203173706-8368e1f6eacf/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/networking v0.0.0-20210216193011-d5e05ad323f0 h1:3TwevWoWJ/xlU1Bjzb3vtRRl1NfJWIJTkZb+1eNdW8k=
knative.dev/networking v0.0.0-20210216193011-d5e05ad323f0/go.mod h1:Crdn87hxdFd3Jj6PIyrjzGnr8OGHX35k5xo9jlOrjjA=
knative.dev/pkg v0.0.0-20210215165523-84c98f3c3e7a/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/pkg v0.0.0-20210225221047-07b5ddfaea60/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/networking v0.0.0-20210301023148-54c0eb153147 h1:dX51VdzJFfOcpbz3qvD3ohmg0A+oX/qil3r+dHbFtS8=
knative.dev/networking v0.0.0-20210301023148-54c0eb153147/go.mod h1:AZjAFUWHJp9+HCc3Zg6766X9FSptM10HaWP7Ff1U63I=
knative.dev/pkg v0.0.0-20210226182947-9039dc189ced h1:OCtTbXsJhiR35qCDxFj9Xc8sU3i87ePbc7YlHCt0al4=
knative.dev/pkg v0.0.0-20210226182947-9039dc189ced/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/reconciler-test v0.0.0-20210223181346-209f32c8cdc4/go.mod h1:RP/K5xJylB72Go6eAsXYEsQHp4zCCNMNjmsqhvq7wko=
knative.dev/serving v0.21.1-0.20210301115148-472f8e2bacf2 h1:XC/vJOFmwOAzOQXs1vCEOfk/3ya79SFhpVHGqDQToSk=
knative.dev/serving v0.21.1-0.20210301115148-472f8e2bacf2/go.mod h1:a4eAD31lUwrx8M7xu1EX7Q5tPEIcGdT/XmA3RRezV70=
knative.dev/pkg v0.0.0-20210303111915-08fc6268bf96 h1:ViIux8RD1WS59wYTE0OqpCgBO8GQkJjCleuikWGXy4c=
knative.dev/pkg v0.0.0-20210303111915-08fc6268bf96/go.mod h1:TJSdebQOWX5N2bszohOYVi0H1QtXbtlYLuMghAFBMhY=
knative.dev/reconciler-test v0.0.0-20210302173618-5f01af2a17ac/go.mod h1:70MF1WzRT29YtTBujNmB58UUlRGLlfYElOTNmO7MxdA=
knative.dev/serving v0.21.1-0.20210302234615-e9ea07ee268e h1:tShsIeRd/88BHjIx55yBTNhZ+h7oKHYLNfFobNn6twA=
knative.dev/serving v0.21.1-0.20210302234615-e9ea07ee268e/go.mod h1:SsZNgf4janJhTrWNpEiui8uUouUdDp8sKy2GOy1TuEA=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
Expand Down
54 changes: 42 additions & 12 deletions vendor/knative.dev/pkg/configmap/informer/informed_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ var _ configmap.Watcher = (*InformedWatcher)(nil)
// Asserts that InformedWatcher implements DefaultingWatcher.
var _ configmap.DefaultingWatcher = (*InformedWatcher)(nil)

// WatchWithDefault implements DefaultingWatcher.
// WatchWithDefault implements DefaultingWatcher. Adding a default for the configMap being watched means that when
// Start is called, Start will not wait for the add event from the API server.
func (i *InformedWatcher) WatchWithDefault(cm corev1.ConfigMap, o ...configmap.Observer) {
i.defaults[cm.Name] = &cm

Expand All @@ -126,31 +127,59 @@ func (i *InformedWatcher) WatchWithDefault(cm corev1.ConfigMap, o ...configmap.O
i.Watch(cm.Name, o...)
}

// Start implements Watcher.
func (i *InformedWatcher) Start(stopCh <-chan struct{}) error {
// Pretend that all the defaulted ConfigMaps were just created. This is done before we start
// the informer to ensure that if a defaulted ConfigMap does exist, then the real value is
// processed after the default one.
func (i *InformedWatcher) triggerAddEventForDefaultedConfigMaps(addConfigMapEvent func(obj interface{})) {
i.ForEach(func(k string, _ []configmap.Observer) error {
if def, ok := i.defaults[k]; ok {
i.addConfigMapEvent(def)
addConfigMapEvent(def)
}
return nil
})
}

func (i *InformedWatcher) getConfigMapNames() []string {
var configMaps []string
i.ForEach(func(k string, _ []configmap.Observer) error {
configMaps = append(configMaps, k)
return nil
})
return configMaps
}

if err := i.registerCallbackAndStartInformer(stopCh); err != nil {
// Start implements Watcher. Start will wait for all watched resources to exist and for the add event handler to be
// invoked at least once for each before continuing or for the stopCh to be signalled, whichever happens first. If
// the watched resource is defaulted, Start will invoke the add event handler directly and will not wait for a further
// add event from the API server.
func (i *InformedWatcher) Start(stopCh <-chan struct{}) error {
// using the synced callback wrapper around the add event handler will allow the caller
// to wait for the add event to be processed for all configmaps
s := newSyncedCallback(i.getConfigMapNames(), i.addConfigMapEvent)
addConfigMapEvent := func(obj interface{}) {
configMap := obj.(*corev1.ConfigMap)
s.Call(obj, configMap.Name)
}
// Pretend that all the defaulted ConfigMaps were just created. This is done before we start
// the informer to ensure that if a defaulted ConfigMap does exist, then the real value is
// processed after the default one.
i.triggerAddEventForDefaultedConfigMaps(addConfigMapEvent)

if err := i.registerCallbackAndStartInformer(addConfigMapEvent, stopCh); err != nil {
return err
}

// Wait until it has been synced (WITHOUT holing the mutex, so callbacks happen)
// Wait until the shared informer has been synced (WITHOUT holing the mutex, so callbacks happen)
if ok := cache.WaitForCacheSync(stopCh, i.informer.Informer().HasSynced); !ok {
return errors.New("error waiting for ConfigMap informer to sync")
}

return i.checkObservedResourcesExist()
if err := i.checkObservedResourcesExist(); err != nil {
return err
}

// Wait until all config maps have been at least initially processed
return s.WaitForAllKeys(stopCh)
}

func (i *InformedWatcher) registerCallbackAndStartInformer(stopCh <-chan struct{}) error {
func (i *InformedWatcher) registerCallbackAndStartInformer(addConfigMapEvent func(obj interface{}), stopCh <-chan struct{}) error {
i.Lock()
defer i.Unlock()
if i.started {
Expand All @@ -159,13 +188,14 @@ func (i *InformedWatcher) registerCallbackAndStartInformer(stopCh <-chan struct{
i.started = true

i.informer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: i.addConfigMapEvent,
AddFunc: addConfigMapEvent,
UpdateFunc: i.updateConfigMapEvent,
DeleteFunc: i.deleteConfigMapEvent,
})

// Start the shared informer factory (non-blocking).
i.sif.Start(stopCh)

return nil
}

Expand Down
112 changes: 112 additions & 0 deletions vendor/knative.dev/pkg/configmap/informer/synced_callback.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
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 informer

import (
"sync"

"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
)

// namedWaitGroup is used to increment and decrement a WaitGroup by name
type namedWaitGroup struct {
waitGroup sync.WaitGroup
keys sets.String
mu sync.Mutex
}

// newNamedWaitGroup returns an instantiated namedWaitGroup.
func newNamedWaitGroup() *namedWaitGroup {
return &namedWaitGroup{
keys: sets.NewString(),
}
}

// Add will add the key to the list of keys being tracked and increment the wait group.
// If the key has already been added, the wait group will not be incremented again.
func (n *namedWaitGroup) Add(key string) {
n.mu.Lock()
defer n.mu.Unlock()

if !n.keys.Has(key) {
n.keys.Insert(key)
n.waitGroup.Add(1)
}
}

// Done will decrement the counter if the key is present in the tracked keys. If it is not present
// it will be ignored.
func (n *namedWaitGroup) Done(key string) {
n.mu.Lock()
defer n.mu.Unlock()

if n.keys.Has(key) {
n.keys.Delete(key)
n.waitGroup.Done()
}
}

// Wait will wait for the underlying waitGroup to complete.
func (n *namedWaitGroup) Wait() {
n.waitGroup.Wait()
}

// syncedCallback can be used to wait for a callback to be called at least once for a list of keys.
type syncedCallback struct {
// namedWaitGroup will block until the callback has been called for all tracked entities
namedWaitGroup *namedWaitGroup

// callback is the callback that is intended to be called at least once for each key
// being tracked via WaitGroup
callback func(obj interface{})
}

// newSyncedCallback will return a syncedCallback that will track the provided keys.
func newSyncedCallback(keys []string, callback func(obj interface{})) *syncedCallback {
s := &syncedCallback{
callback: callback,
namedWaitGroup: newNamedWaitGroup(),
}
for _, key := range keys {
s.namedWaitGroup.Add(key)
}
return s
}

// Event is intended to be a wrapper for the actual event handler; this wrapper will signal via
// the wait group that the event handler has been called at least once for the key.
func (s *syncedCallback) Call(obj interface{}, key string) {
s.callback(obj)
s.namedWaitGroup.Done(key)
}

// WaitForAllKeys will block until s.Call has been called for all the keys we are tracking or the stop signal is
// received.
func (s *syncedCallback) WaitForAllKeys(stopCh <-chan struct{}) error {
c := make(chan struct{})
go func() {
defer close(c)
s.namedWaitGroup.Wait()
}()
select {
case <-c:
return nil
case <-stopCh:
return wait.ErrWaitTimeout
}
}
2 changes: 1 addition & 1 deletion vendor/knative.dev/pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func NewSkipKey(key string) error {
return skipKeyError{key: key}
}

// permanentError is an error that is considered not transient.
// skipKeyError is an error that indicates a key was skipped.
// We should not re-queue keys when it returns with thus error in reconcile.
type skipKeyError struct {
key string
Expand Down
8 changes: 4 additions & 4 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/pointer
k8s.io/utils/trace
# knative.dev/eventing v0.21.1-0.20210228124848-2db68776f120
# knative.dev/eventing v0.21.1-0.20210303094015-21bcd68a9dcb
## explicit
knative.dev/eventing/pkg/apis/config
knative.dev/eventing/pkg/apis/configs
Expand Down Expand Up @@ -1160,11 +1160,11 @@ knative.dev/eventing/test/upgrade/prober/wathola/sender
## explicit
knative.dev/hack
knative.dev/hack/shell
# knative.dev/networking v0.0.0-20210216193011-d5e05ad323f0
# knative.dev/networking v0.0.0-20210301023148-54c0eb153147
knative.dev/networking/pkg
knative.dev/networking/pkg/apis/networking
knative.dev/networking/pkg/apis/networking/v1alpha1
# knative.dev/pkg v0.0.0-20210226182947-9039dc189ced
# knative.dev/pkg v0.0.0-20210303111915-08fc6268bf96
## explicit
knative.dev/pkg/apiextensions/storageversion
knative.dev/pkg/apiextensions/storageversion/cmd/migrate
Expand Down Expand Up @@ -1279,7 +1279,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/serving v0.21.1-0.20210301115148-472f8e2bacf2
# knative.dev/serving v0.21.1-0.20210302234615-e9ea07ee268e
## explicit
knative.dev/serving/pkg/apis/autoscaling
knative.dev/serving/pkg/apis/autoscaling/v1alpha1
Expand Down

0 comments on commit 44793ce

Please sign in to comment.