Merge pull request #17895 from vrothberg/containers_conf_extra

add CONTAINERS_CONF_OVERRIDE
This commit is contained in:
OpenShift Merge Robot
2023-03-27 16:48:44 -04:00
committed by GitHub
9 changed files with 57 additions and 17 deletions

View File

@@ -765,11 +765,21 @@ func addConfigs(dirPath string, configs []string) ([]string, error) {
// Returns the list of configuration files, if they exist in order of hierarchy.
// The files are read in order and each new file can/will override previous
// file settings.
func systemConfigs() ([]string, error) {
var err error
configs := []string{}
path := os.Getenv("CONTAINERS_CONF")
if path != "" {
func systemConfigs() (configs []string, finalErr error) {
if path := os.Getenv("CONTAINERS_CONF_OVERRIDE"); path != "" {
if _, err := os.Stat(path); err != nil {
return nil, fmt.Errorf("CONTAINERS_CONF_OVERRIDE file: %w", err)
}
// Add the override config last to make sure it can override any
// previous settings.
defer func() {
if finalErr == nil {
configs = append(configs, path)
}
}()
}
if path := os.Getenv("CONTAINERS_CONF"); path != "" {
if _, err := os.Stat(path); err != nil {
return nil, fmt.Errorf("CONTAINERS_CONF file: %w", err)
}
@@ -781,12 +791,14 @@ func systemConfigs() ([]string, error) {
if _, err := os.Stat(OverrideContainersConfig); err == nil {
configs = append(configs, OverrideContainersConfig)
}
var err error
configs, err = addConfigs(OverrideContainersConfig+".d", configs)
if err != nil {
return nil, err
}
path, err = ifRootlessConfigPath()
path, err := ifRootlessConfigPath()
if err != nil {
return nil, err
}

View File

@@ -68,6 +68,7 @@
# "SETGID",
# "SETPCAP",
# "SETUID",
# "SYS_CHROOT",
#]
# A list of sysctls to be set in containers by default,

View File

@@ -60,6 +60,7 @@ var (
"CAP_SETGID",
"CAP_SETPCAP",
"CAP_SETUID",
"CAP_SYS_CHROOT",
}
// Search these locations in which CNIPlugins can be installed.

View File

@@ -1,4 +1,4 @@
package version
// Version is the version of the build.
const Version = "0.51.1-dev"
const Version = "0.52.0-dev"