config: Add ImageVolumes configuration setting
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
parent
59646cc520
commit
dc55fd2f14
3 changed files with 40 additions and 0 deletions
|
@ -22,6 +22,17 @@ import (
|
|||
|
||||
const crioConfigPath = "/etc/crio/crio.conf"
|
||||
|
||||
func validateConfig(config *server.Config) error {
|
||||
switch config.ImageVolumes {
|
||||
case server.ImageVolumesMkdir:
|
||||
case server.ImageVolumesIgnore:
|
||||
default:
|
||||
return fmt.Errorf("Unrecognized image volume type specified")
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func mergeConfig(config *server.Config, ctx *cli.Context) error {
|
||||
// Don't parse the config if the user explicitly set it to "".
|
||||
if path := ctx.GlobalString("config"); path != "" {
|
||||
|
@ -98,6 +109,9 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error {
|
|||
if ctx.GlobalIsSet("cni-plugin-dir") {
|
||||
config.PluginDir = ctx.GlobalString("cni-plugin-dir")
|
||||
}
|
||||
if ctx.GlobalIsSet("image-volumes") {
|
||||
config.ImageVolumes = server.ImageVolumesType(ctx.GlobalString("image-volumes"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -233,6 +247,11 @@ func main() {
|
|||
Name: "cni-plugin-dir",
|
||||
Usage: "CNI plugin binaries directory",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "image-volumes",
|
||||
Value: string(server.ImageVolumesMkdir),
|
||||
Usage: "image volume handling ('mkdir' or 'ignore')",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "profile",
|
||||
Usage: "enable pprof remote profiler on localhost:6060",
|
||||
|
@ -253,6 +272,10 @@ func main() {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := validateConfig(config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cf := &logrus.TextFormatter{
|
||||
TimestampFormat: "2006-01-02 15:04:05.000000000Z07:00",
|
||||
FullTimestamp: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue