forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.go
27 lines (21 loc) · 798 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package admission
import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/runtime"
configapi "github.com/openshift/origin/pkg/cmd/server/api"
configlatest "github.com/openshift/origin/pkg/cmd/server/api/latest"
"github.com/openshift/origin/pkg/cmd/util/pluginconfig"
)
// ReadPluginConfig will read a plugin configuration object from a reader stream
func ReadPluginConfig(pluginConfig map[string]configapi.AdmissionPluginConfig, name string, config runtime.Object) error {
configFilePath, err := pluginconfig.GetPluginConfigFile(pluginConfig, name, "")
if configFilePath == "" {
return nil
}
err = configlatest.ReadYAMLFileInto(configFilePath, config)
if err != nil {
glog.Errorf("couldn't open plugin configuration %s: %#v", configFilePath, err)
return err
}
return nil
}