Validate and update the right config
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
ff8a2e7c65
commit
5a9c12d49e
8
cri.go
8
cri.go
@ -64,6 +64,10 @@ func initCRIService(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
ic.Meta.Exports = map[string]string{"CRIVersion": constants.CRIVersion}
|
ic.Meta.Exports = map[string]string{"CRIVersion": constants.CRIVersion}
|
||||||
ctx := ic.Context
|
ctx := ic.Context
|
||||||
pluginConfig := ic.Config.(*criconfig.PluginConfig)
|
pluginConfig := ic.Config.(*criconfig.PluginConfig)
|
||||||
|
if err := criconfig.ValidatePluginConfig(ctx, pluginConfig); err != nil {
|
||||||
|
return nil, errors.Wrap(err, "invalid plugin config")
|
||||||
|
}
|
||||||
|
|
||||||
c := criconfig.Config{
|
c := criconfig.Config{
|
||||||
PluginConfig: *pluginConfig,
|
PluginConfig: *pluginConfig,
|
||||||
ContainerdRootDir: filepath.Dir(ic.Root),
|
ContainerdRootDir: filepath.Dir(ic.Root),
|
||||||
@ -73,10 +77,6 @@ func initCRIService(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
log.G(ctx).Infof("Start cri plugin with config %+v", c)
|
log.G(ctx).Infof("Start cri plugin with config %+v", c)
|
||||||
|
|
||||||
if err := criconfig.ValidatePluginConfig(ctx, pluginConfig); err != nil {
|
|
||||||
return nil, errors.Wrap(err, "invalid plugin config")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := setGLogLevel(); err != nil {
|
if err := setGLogLevel(); err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to set glog level")
|
return nil, errors.Wrap(err, "failed to set glog level")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user