mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
fix incorrect logic
This commit is contained in:
parent
1d633b7fdd
commit
d4b41afe59
@ -67,13 +67,15 @@ func (ps *Plugins) Registered() []string {
|
|||||||
func (ps *Plugins) Register(name string, plugin Factory) {
|
func (ps *Plugins) Register(name string, plugin Factory) {
|
||||||
ps.lock.Lock()
|
ps.lock.Lock()
|
||||||
defer ps.lock.Unlock()
|
defer ps.lock.Unlock()
|
||||||
|
if ps.registry != nil {
|
||||||
_, found := ps.registry[name]
|
_, found := ps.registry[name]
|
||||||
if found {
|
if found {
|
||||||
glog.Fatalf("Admission plugin %q was registered twice", name)
|
glog.Fatalf("Admission plugin %q was registered twice", name)
|
||||||
}
|
}
|
||||||
if ps.registry == nil {
|
} else {
|
||||||
ps.registry = map[string]Factory{}
|
ps.registry = map[string]Factory{}
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(1).Infof("Registered admission plugin %q", name)
|
glog.V(1).Infof("Registered admission plugin %q", name)
|
||||||
ps.registry[name] = plugin
|
ps.registry[name] = plugin
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user