bump c/common to v0.44.0

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2021-09-13 18:48:48 +02:00
parent 0f3d3bd21d
commit b0cbcd1d09
65 changed files with 5257 additions and 4151 deletions

View File

@ -167,7 +167,7 @@ type ContainersConfig struct {
// RootlessNetworking depicts the "kind" of networking for rootless
// containers. Valid options are `slirp4netns` and `cni`. Default is
// `slirp4netns`
// `slirp4netns` on Linux, and `cni` on non-Linux OSes.
RootlessNetworking string `toml:"rootless_networking,omitempty"`
// SeccompProfile is the seccomp.json profile path which is used as the
@ -234,6 +234,10 @@ type EngineConfig struct {
// EventsLogger determines where events should be logged.
EventsLogger string `toml:"events_logger,omitempty"`
// HelperBinariesDir is a list of directories which are used to search for
// helper binaries.
HelperBinariesDir []string `toml:"helper_binaries_dir"`
// configuration files. When the same filename is present in in
// multiple directories, the file in the directory listed last in
// this slice takes precedence.
@ -1126,3 +1130,21 @@ func (c *Config) ActiveDestination() (uri, identity string, err error) {
}
return "", "", errors.New("no service destination configured")
}
// FindHelperBinary will search the given binary name in the configured directories.
// If searchPATH is set to true it will also search in $PATH.
func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error) {
for _, path := range c.Engine.HelperBinariesDir {
fullpath := filepath.Join(path, name)
if fi, err := os.Stat(fullpath); err == nil && fi.Mode().IsRegular() {
return fullpath, nil
}
}
if searchPATH {
return exec.LookPath(name)
}
if len(c.Engine.HelperBinariesDir) == 0 {
return "", errors.Errorf("could not find %q because there are no helper binary directories configured", name)
}
return "", errors.Errorf("could not find %q in one of %v", name, c.Engine.HelperBinariesDir)
}

View File

@ -15,3 +15,16 @@ func customConfigFile() (string, error) {
func ifRootlessConfigPath() (string, error) {
return rootlessConfigPath()
}
var defaultHelperBinariesDir = []string{
// Homebrew install paths
"/usr/local/opt/podman/libexec",
"/opt/homebrew/bin",
"/opt/homebrew/opt/podman/libexec",
"/usr/local/bin",
// default paths
"/usr/local/libexec/podman",
"/usr/local/lib/podman",
"/usr/libexec/podman",
"/usr/lib/podman",
}

View File

@ -35,3 +35,10 @@ func ifRootlessConfigPath() (string, error) {
}
return "", nil
}
var defaultHelperBinariesDir = []string{
"/usr/local/libexec/podman",
"/usr/local/lib/podman",
"/usr/libexec/podman",
"/usr/lib/podman",
}

View File

@ -13,3 +13,7 @@ func customConfigFile() (string, error) {
func ifRootlessConfigPath() (string, error) {
return os.Getenv("APPDATA") + "\\containers\\containers.conf", nil
}
var defaultHelperBinariesDir = []string{
"C:\\Program Files\\RedHat\\Podman",
}

View File

@ -341,6 +341,15 @@ default_sysctls = [
#
#events_logger = "journald"
# A is a list of directories which are used to search for helper binaries.
#
#helper_binaries_dir = [
# "/usr/local/libexec/podman",
# "/usr/local/lib/podman",
# "/usr/libexec/podman",
# "/usr/lib/podman",
#]
# Path to OCI hooks directories for automatically executed hooks.
#
#hooks_dir = [

View File

@ -84,10 +84,6 @@ var (
"/usr/lib/cni",
"/opt/cni/bin",
}
// DefaultRootlessNetwork is the kind of of rootless networking
// for containers
DefaultRootlessNetwork = "slirp4netns"
)
const (
@ -197,7 +193,7 @@ func DefaultConfig() (*Config, error) {
NoHosts: false,
PidsLimit: DefaultPidsLimit,
PidNS: "private",
RootlessNetworking: DefaultRootlessNetwork,
RootlessNetworking: getDefaultRootlessNetwork(),
ShmSize: DefaultShmSize,
TZ: "",
Umask: "0022",
@ -251,6 +247,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
c.StaticDir = filepath.Join(storeOpts.GraphRoot, "libpod")
c.VolumePath = filepath.Join(storeOpts.GraphRoot, "volumes")
c.HelperBinariesDir = defaultHelperBinariesDir
c.HooksDir = DefaultHooksDirs
c.ImageDefaultTransport = _defaultTransport
c.StateType = BoltDBStateStore

View File

@ -13,6 +13,12 @@ const (
oldMaxSize = uint64(1048576)
)
// getDefaultRootlessNetwork returns the default rootless network configuration.
// It is "slirp4netns" for Linux.
func getDefaultRootlessNetwork() string {
return "slirp4netns"
}
// getDefaultProcessLimits returns the nproc for the current process in ulimits format
// Note that nfile sometimes cannot be set to unlimited, and the limit is hardcoded
// to (oldMaxSize) 1048576 (2^20), see: http://stackoverflow.com/a/1213069/1811501

View File

@ -2,6 +2,12 @@
package config
// getDefaultRootlessNetwork returns the default rootless network configuration.
// It is "cni" for non-Linux OSes (to better support `podman-machine` usecases).
func getDefaultRootlessNetwork() string {
return "cni"
}
// isCgroup2UnifiedMode returns whether we are running in cgroup2 mode.
func isCgroup2UnifiedMode() (isUnified bool, isUnifiedErr error) {
return false, nil

View File

@ -48,7 +48,7 @@ func getRuntimeDir() (string, error) {
}
}
if runtimeDir == "" {
tmpDir := filepath.Join(os.TempDir(), fmt.Sprintf("run-%s", uid))
tmpDir := filepath.Join(os.TempDir(), fmt.Sprintf("podman-run-%s", uid))
if err := os.MkdirAll(tmpDir, 0700); err != nil {
logrus.Debugf("unable to make temp dir %v", err)
}

View File

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