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