mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-31 04:04:51 +00:00
nfd-master: do nfd API scheme registration in an init function
Prevents (rare) races on nfd-master reconfigurartion. Previously the scheme was registered at nfd API controller creation/startup time. This caused a race with some lister/informer goroutines of the previous (stoppped) controller still running and accessing (reading) the sceme while we were updating (writing) it.
This commit is contained in:
parent
137f18b5b3
commit
c4e010eafd
1 changed files with 4 additions and 1 deletions
|
@ -49,6 +49,10 @@ type nfdApiControllerOptions struct {
|
||||||
ResyncPeriod time.Duration
|
ResyncPeriod time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
utilruntime.Must(nfdv1alpha1.AddToScheme(nfdscheme.Scheme))
|
||||||
|
}
|
||||||
|
|
||||||
func newNfdController(config *restclient.Config, nfdApiControllerOptions nfdApiControllerOptions) (*nfdController, error) {
|
func newNfdController(config *restclient.Config, nfdApiControllerOptions nfdApiControllerOptions) (*nfdController, error) {
|
||||||
c := &nfdController{
|
c := &nfdController{
|
||||||
stopChan: make(chan struct{}, 1),
|
stopChan: make(chan struct{}, 1),
|
||||||
|
@ -118,7 +122,6 @@ func newNfdController(config *restclient.Config, nfdApiControllerOptions nfdApiC
|
||||||
// Start informers
|
// Start informers
|
||||||
informerFactory.Start(c.stopChan)
|
informerFactory.Start(c.stopChan)
|
||||||
|
|
||||||
utilruntime.Must(nfdv1alpha1.AddToScheme(nfdscheme.Scheme))
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue