mirror of
https://github.com/rancher/norman.git
synced 2025-08-30 21:52:02 +00:00
22 lines
427 B
Go
22 lines
427 B
Go
package injectors
|
|
|
|
import "k8s.io/apimachinery/pkg/runtime"
|
|
|
|
var (
|
|
injectors = map[string]ConfigInjector{}
|
|
order []string
|
|
)
|
|
|
|
type ConfigInjector func(config []runtime.Object) ([]runtime.Object, error)
|
|
|
|
func Register(name string, injector ConfigInjector) {
|
|
if _, ok := injectors[name]; !ok {
|
|
order = append(order, name)
|
|
}
|
|
injectors[name] = injector
|
|
}
|
|
|
|
func Get(name string) ConfigInjector {
|
|
return injectors[name]
|
|
}
|