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
|
@ -120,6 +120,10 @@ pause_command = "{{ .PauseCommand }}"
|
|||
# unspecified so that the default system-wide policy will be used.
|
||||
signature_policy = "{{ .SignaturePolicyPath }}"
|
||||
|
||||
# image_volumes controls how image volumes are handled.
|
||||
# The valid values are mkdir and ignore.
|
||||
image_volumes = "{{ .ImageVolumes }}"
|
||||
|
||||
# insecure_registries is used to skip TLS verification when pulling images.
|
||||
insecure_registries = [
|
||||
{{ range $opt := .InsecureRegistries }}{{ printf "\t%q,\n" $opt }}{{ end }}]
|
||||
|
|
|
@ -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