rebase: bump sigs.k8s.io/controller-runtime from 0.10.2 to 0.10.3

Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.10.2 to 0.10.3.
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.10.2...v0.10.3)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2021-11-15 20:30:19 +00:00 committed by mergify[bot]
parent 5524b2d538
commit ecd5d2d46c
8 changed files with 32 additions and 23 deletions

2
go.mod
View File

@ -33,7 +33,7 @@ require (
k8s.io/kubernetes v1.22.3 k8s.io/kubernetes v1.22.3
k8s.io/mount-utils v0.22.2 k8s.io/mount-utils v0.22.2
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
sigs.k8s.io/controller-runtime v0.10.2 sigs.k8s.io/controller-runtime v0.10.3
) )
replace ( replace (

4
go.sum
View File

@ -1644,8 +1644,8 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 h1:fmRfl9WJ4ApJn7LxNuED4m0t18qivVQOxP6aAYG9J6c= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 h1:fmRfl9WJ4ApJn7LxNuED4m0t18qivVQOxP6aAYG9J6c=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I= sigs.k8s.io/controller-runtime v0.2.2/go.mod h1:9dyohw3ZtoXQuV1e766PHUn+cmrRCIcBh6XIMFNMZ+I=
sigs.k8s.io/controller-runtime v0.10.2 h1:jW8qiY+yMnnPx6O9hu63tgcwaKzd1yLYui+mpvClOOc= sigs.k8s.io/controller-runtime v0.10.3 h1:s5Ttmw/B4AuIbwrXD3sfBkXwnPMMWrqpVj4WRt1dano=
sigs.k8s.io/controller-runtime v0.10.2/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= sigs.k8s.io/controller-runtime v0.10.3/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY=
sigs.k8s.io/kustomize/api v0.8.11/go.mod h1:a77Ls36JdfCWojpUqR6m60pdGY1AYFix4AH83nJtY1g= sigs.k8s.io/kustomize/api v0.8.11/go.mod h1:a77Ls36JdfCWojpUqR6m60pdGY1AYFix4AH83nJtY1g=
sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqwEJqCKN9sSR0xSs= sigs.k8s.io/kustomize/cmd/config v0.9.13/go.mod h1:7547FLF8W/lTaDf0BDqFTbZxM9zqwEJqCKN9sSR0xSs=
sigs.k8s.io/kustomize/kustomize/v4 v4.2.0/go.mod h1:MOkR6fmhwG7hEDRXBYELTi5GSFcLwfqwzTRHW3kv5go= sigs.k8s.io/kustomize/kustomize/v4 v4.2.0/go.mod h1:MOkR6fmhwG7hEDRXBYELTi5GSFcLwfqwzTRHW3kv5go=

2
vendor/modules.txt vendored
View File

@ -1076,7 +1076,7 @@ k8s.io/utils/trace
# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22 # sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client
# sigs.k8s.io/controller-runtime v0.10.2 # sigs.k8s.io/controller-runtime v0.10.3
## explicit ## explicit
sigs.k8s.io/controller-runtime/pkg/cache sigs.k8s.io/controller-runtime/pkg/cache
sigs.k8s.io/controller-runtime/pkg/cache/internal sigs.k8s.io/controller-runtime/pkg/cache/internal

View File

@ -175,7 +175,7 @@ func (c *Controller) Start(ctx context.Context) error {
// caches to sync so that they have a chance to register their intendeded // caches to sync so that they have a chance to register their intendeded
// caches. // caches.
for _, watch := range c.startWatches { for _, watch := range c.startWatches {
c.Log.Info("Starting EventSource", "source", watch.src) c.Log.Info("Starting EventSource", "source", fmt.Sprintf("%s", watch.src))
if err := watch.src.Start(ctx, watch.handler, c.Queue, watch.predicates...); err != nil { if err := watch.src.Start(ctx, watch.handler, c.Queue, watch.predicates...); err != nil {
return err return err

View File

@ -380,7 +380,7 @@ func (cm *controllerManager) serveMetrics() {
} }
// Run the server // Run the server
cm.startRunnable(RunnableFunc(func(_ context.Context) error { cm.startRunnable(RunnableFunc(func(_ context.Context) error {
cm.logger.Info("starting metrics server", "path", defaultMetricsEndpoint) cm.logger.Info("Starting metrics server", "path", defaultMetricsEndpoint)
if err := server.Serve(cm.metricsListener); err != nil && err != http.ErrServerClosed { if err := server.Serve(cm.metricsListener); err != nil && err != http.ErrServerClosed {
return err return err
} }
@ -425,11 +425,13 @@ func (cm *controllerManager) serveHealthProbes() {
cm.healthzStarted = true cm.healthzStarted = true
}() }()
// Shutdown the server when stop is closed go func() {
<-cm.internalProceduresStop // Shutdown the server when stop is closed
if err := server.Shutdown(cm.shutdownCtx); err != nil { <-cm.internalProceduresStop
cm.errChan <- err if err := server.Shutdown(cm.shutdownCtx); err != nil {
} cm.errChan <- err
}
}()
} }
func (cm *controllerManager) Start(ctx context.Context) (err error) { func (cm *controllerManager) Start(ctx context.Context) (err error) {
@ -473,9 +475,14 @@ func (cm *controllerManager) Start(ctx context.Context) (err error) {
// Serve health probes // Serve health probes
if cm.healthProbeListener != nil { if cm.healthProbeListener != nil {
go cm.serveHealthProbes() cm.serveHealthProbes()
} }
// Webhooks MUST start before any cache is populated, otherwise there is a race condition
// between conversion webhooks and the cache sync (usually initial list) which causes the webhooks
// to never start because no cache can be populated.
cm.startWebhookRunnables()
go cm.startNonLeaderElectionRunnables() go cm.startNonLeaderElectionRunnables()
go func() { go func() {
@ -573,13 +580,10 @@ func (cm *controllerManager) waitForRunnableToEnd(shutdownCancel context.CancelF
return nil return nil
} }
func (cm *controllerManager) startNonLeaderElectionRunnables() { func (cm *controllerManager) startWebhookRunnables() {
cm.mu.Lock() cm.mu.Lock()
defer cm.mu.Unlock() defer cm.mu.Unlock()
// First start any webhook servers, which includes conversion, validation, and defaulting
// webhooks that are registered.
//
// WARNING: Webhooks MUST start before any cache is populated, otherwise there is a race condition // WARNING: Webhooks MUST start before any cache is populated, otherwise there is a race condition
// between conversion webhooks and the cache sync (usually initial list) which causes the webhooks // between conversion webhooks and the cache sync (usually initial list) which causes the webhooks
// to never start because no cache can be populated. // to never start because no cache can be populated.
@ -588,6 +592,11 @@ func (cm *controllerManager) startNonLeaderElectionRunnables() {
cm.startRunnable(c) cm.startRunnable(c)
} }
} }
}
func (cm *controllerManager) startNonLeaderElectionRunnables() {
cm.mu.Lock()
defer cm.mu.Unlock()
// Start and wait for caches. // Start and wait for caches.
cm.waitForCache(cm.internalCtx) cm.waitForCache(cm.internalCtx)

View File

@ -41,7 +41,7 @@ func NewListener(addr string) (net.Listener, error) {
return nil, nil return nil, nil
} }
log.Info("metrics server is starting to listen", "addr", addr) log.Info("Metrics server is starting to listen", "addr", addr)
ln, err := net.Listen("tcp", addr) ln, err := net.Listen("tcp", addr)
if err != nil { if err != nil {
er := fmt.Errorf("error listening on %s: %w", addr, err) er := fmt.Errorf("error listening on %s: %w", addr, err)

View File

@ -161,10 +161,10 @@ func (ks *Kind) Start(ctx context.Context, handler handler.EventHandler, queue w
} }
func (ks *Kind) String() string { func (ks *Kind) String() string {
if ks.Type != nil && ks.Type.GetObjectKind() != nil { if ks.Type != nil {
return fmt.Sprintf("kind source: %v", ks.Type.GetObjectKind().GroupVersionKind().String()) return fmt.Sprintf("kind source: %T", ks.Type)
} }
return "kind source: unknown GVK" return "kind source: unknown type"
} }
// WaitForSync implements SyncingSource to allow controllers to wait with starting // WaitForSync implements SyncingSource to allow controllers to wait with starting

View File

@ -142,7 +142,7 @@ func (s *Server) Register(path string, hook http.Handler) {
s.WebhookMux.Handle(path, metrics.InstrumentedHook(path, hook)) s.WebhookMux.Handle(path, metrics.InstrumentedHook(path, hook))
regLog := log.WithValues("path", path) regLog := log.WithValues("path", path)
regLog.Info("registering webhook") regLog.Info("Registering webhook")
// we've already been "started", inject dependencies here. // we've already been "started", inject dependencies here.
// Otherwise, InjectFunc will do this for us later. // Otherwise, InjectFunc will do this for us later.
@ -210,7 +210,7 @@ func (s *Server) Start(ctx context.Context) error {
s.defaultingOnce.Do(s.setDefaults) s.defaultingOnce.Do(s.setDefaults)
baseHookLog := log.WithName("webhooks") baseHookLog := log.WithName("webhooks")
baseHookLog.Info("starting webhook server") baseHookLog.Info("Starting webhook server")
certPath := filepath.Join(s.CertDir, s.CertName) certPath := filepath.Join(s.CertDir, s.CertName)
keyPath := filepath.Join(s.CertDir, s.KeyName) keyPath := filepath.Join(s.CertDir, s.KeyName)
@ -259,7 +259,7 @@ func (s *Server) Start(ctx context.Context) error {
return err return err
} }
log.Info("serving webhook server", "host", s.Host, "port", s.Port) log.Info("Serving webhook server", "host", s.Host, "port", s.Port)
srv := &http.Server{ srv := &http.Server{
Handler: s.WebhookMux, Handler: s.WebhookMux,