Default to the storage defaults
Change the config to use github.com/containers/storage by default. Allow users to override in the config, but if the admin does not override the config. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
4c06116c18
commit
2de8ede663
3 changed files with 19 additions and 11 deletions
|
@ -12,21 +12,27 @@ var commentedConfigTemplate = template.Must(template.New("config").Parse(`
|
||||||
# The "crio" table contains all of the server options.
|
# The "crio" table contains all of the server options.
|
||||||
[crio]
|
[crio]
|
||||||
|
|
||||||
|
# CRI-O reads its storage defaults from the containers/storage configuration
|
||||||
|
# file, /etc/containers/storage.conf. Modify storage.conf if you want to
|
||||||
|
# change default storage for all tools that use containers/storage. If you
|
||||||
|
# want to modify just crio, you can change the storage configuration in this
|
||||||
|
# file.
|
||||||
|
|
||||||
# root is a path to the "root directory". CRIO stores all of its data,
|
# root is a path to the "root directory". CRIO stores all of its data,
|
||||||
# including container images, in this directory.
|
# including container images, in this directory.
|
||||||
root = "{{ .Root }}"
|
#root = "{{ .Root }}"
|
||||||
|
|
||||||
# run is a path to the "run directory". CRIO stores all of its state
|
# run is a path to the "run directory". CRIO stores all of its state
|
||||||
# in this directory.
|
# in this directory.
|
||||||
runroot = "{{ .RunRoot }}"
|
#runroot = "{{ .RunRoot }}"
|
||||||
|
|
||||||
# storage_driver select which storage driver is used to manage storage
|
# storage_driver select which storage driver is used to manage storage
|
||||||
# of images and containers.
|
# of images and containers.
|
||||||
storage_driver = "{{ .Storage }}"
|
#storage_driver = "{{ .Storage }}"
|
||||||
|
|
||||||
# storage_option is used to pass an option to the storage driver.
|
# storage_option is used to pass an option to the storage driver.
|
||||||
storage_option = [
|
#storage_option = [ {{ range $opt := .StorageOptions }}{{ printf "\t\n#%q," $opt }}{{ end }}
|
||||||
{{ range $opt := .StorageOptions }}{{ printf "\t%q,\n" $opt }}{{ end }}]
|
#]
|
||||||
|
|
||||||
# The "crio.api" table contains settings for the kubelet/gRPC
|
# The "crio.api" table contains settings for the kubelet/gRPC
|
||||||
# interface (which is also used by crioctl).
|
# interface (which is also used by crioctl).
|
||||||
|
|
|
@ -5,14 +5,13 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/opencontainers/selinux/go-selinux"
|
"github.com/opencontainers/selinux/go-selinux"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Default paths if none are specified
|
// Default paths if none are specified
|
||||||
const (
|
const (
|
||||||
crioRoot = "/var/lib/containers/storage"
|
|
||||||
crioRunRoot = "/var/run/containers/storage"
|
|
||||||
conmonPath = "/usr/local/libexec/crio/conmon"
|
conmonPath = "/usr/local/libexec/crio/conmon"
|
||||||
pauseImage = "kubernetes/pause"
|
pauseImage = "kubernetes/pause"
|
||||||
pauseCommand = "/pause"
|
pauseCommand = "/pause"
|
||||||
|
@ -270,10 +269,12 @@ func (c *Config) ToFile(path string) error {
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
RootConfig: RootConfig{
|
RootConfig: RootConfig{
|
||||||
Root: crioRoot,
|
Root: storage.DefaultStoreOptions.GraphRoot,
|
||||||
RunRoot: crioRunRoot,
|
RunRoot: storage.DefaultStoreOptions.RunRoot,
|
||||||
LogDir: "/var/log/crio/pods",
|
Storage: storage.DefaultStoreOptions.GraphDriverName,
|
||||||
FileLocking: true,
|
StorageOptions: storage.DefaultStoreOptions.GraphDriverOptions,
|
||||||
|
LogDir: "/var/log/crio/pods",
|
||||||
|
FileLocking: true,
|
||||||
},
|
},
|
||||||
RuntimeConfig: RuntimeConfig{
|
RuntimeConfig: RuntimeConfig{
|
||||||
Runtime: "/usr/bin/runc",
|
Runtime: "/usr/bin/runc",
|
||||||
|
|
|
@ -245,6 +245,7 @@ function start_crio() {
|
||||||
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=docker.io/library/busybox:latest --import-from=dir:"$ARTIFACTS_PATH"/busybox-image --signature-policy="$INTEGRATION_ROOT"/policy.json
|
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=docker.io/library/busybox:latest --import-from=dir:"$ARTIFACTS_PATH"/busybox-image --signature-policy="$INTEGRATION_ROOT"/policy.json
|
||||||
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=docker.io/library/runcom/stderr-test:latest --import-from=dir:"$ARTIFACTS_PATH"/stderr-test --signature-policy="$INTEGRATION_ROOT"/policy.json
|
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=docker.io/library/runcom/stderr-test:latest --import-from=dir:"$ARTIFACTS_PATH"/stderr-test --signature-policy="$INTEGRATION_ROOT"/policy.json
|
||||||
"$CRIO_BINARY" ${DEFAULT_MOUNTS_OPTS} ${HOOKS_OPTS} --conmon "$CONMON_BINARY" --listen "$CRIO_SOCKET" --cgroup-manager "$CGROUP_MANAGER" --registry "docker.io" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/crio" --runroot "$TESTDIR/crio-run" $STORAGE_OPTIONS --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$CRIO_CNI_CONFIG" --cni-plugin-dir "$CRIO_CNI_PLUGIN" --signature-policy "$INTEGRATION_ROOT"/policy.json --image-volumes "$IMAGE_VOLUMES" --pids-limit "$PIDS_LIMIT" --log-size-max "$LOG_SIZE_MAX_LIMIT" --config /dev/null config >$CRIO_CONFIG
|
"$CRIO_BINARY" ${DEFAULT_MOUNTS_OPTS} ${HOOKS_OPTS} --conmon "$CONMON_BINARY" --listen "$CRIO_SOCKET" --cgroup-manager "$CGROUP_MANAGER" --registry "docker.io" --runtime "$RUNTIME_BINARY" --root "$TESTDIR/crio" --runroot "$TESTDIR/crio-run" $STORAGE_OPTIONS --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$CRIO_CNI_CONFIG" --cni-plugin-dir "$CRIO_CNI_PLUGIN" --signature-policy "$INTEGRATION_ROOT"/policy.json --image-volumes "$IMAGE_VOLUMES" --pids-limit "$PIDS_LIMIT" --log-size-max "$LOG_SIZE_MAX_LIMIT" --config /dev/null config >$CRIO_CONFIG
|
||||||
|
sed -i -r -e 's/^(#)?root =/root =/g' -e 's/^(#)?runroot =/runroot =/g' -e 's/^(#)?storage_driver =/storage_driver =/g' -e '/^(#)?storage_option = (\[)?[ \t]*$/,/^#?$/s/^(#)?//g' $CRIO_CONFIG
|
||||||
|
|
||||||
# Prepare the CNI configuration files, we're running with non host networking by default
|
# Prepare the CNI configuration files, we're running with non host networking by default
|
||||||
if [[ -n "$4" ]]; then
|
if [[ -n "$4" ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue