Merge pull request #19049 from dfr/freebsd-api-server

Add support for 'podman system service' on FreeBSD
This commit is contained in:
OpenShift Merge Robot
2023-06-29 17:03:52 -04:00
committed by GitHub
12 changed files with 61 additions and 10 deletions

View File

@@ -12,9 +12,6 @@ import (
"github.com/spf13/cobra"
)
// DefaultRootAPIPath is the default path of the REST socket
const DefaultRootAPIPath = "/run/podman/podman.sock"
// DefaultRootAPIAddress is the default address of the REST socket with unix: prefix
const DefaultRootAPIAddress = "unix:" + DefaultRootAPIPath

View File

@@ -0,0 +1,7 @@
//go:build !freebsd
// +build !freebsd
package registry
// DefaultRootAPIPath is the default path of the REST socket
const DefaultRootAPIPath = "/run/podman/podman.sock"

View File

@@ -0,0 +1,4 @@
package registry
// DefaultRootAPIPath is the default path of the REST socket
const DefaultRootAPIPath = "/var/run/podman/podman.sock"

View File

@@ -1,5 +1,6 @@
//go:build linux && !remote
// +build linux,!remote
//go:build (linux || freebsd) && !remote
// +build linux freebsd
// +build !remote
package system

View File

@@ -1,5 +1,6 @@
//go:build linux && !remote
// +build linux,!remote
//go:build (linux || freebsd) && !remote
// +build linux freebsd
// +build !remote
package system
@@ -12,7 +13,6 @@ import (
"path/filepath"
"github.com/containers/common/pkg/cgroups"
"github.com/containers/common/pkg/servicereaper"
"github.com/containers/podman/v4/cmd/podman/registry"
api "github.com/containers/podman/v4/pkg/api/server"
"github.com/containers/podman/v4/pkg/domain/entities"
@@ -119,7 +119,7 @@ func restService(flags *pflag.FlagSet, cfg *entities.PodmanConfig, opts entities
logrus.Debugf("Could not move to subcgroup: %v", err)
}
servicereaper.Start()
maybeStartServiceReaper()
infra.StartWatcher(libpodRuntime)
server, err := api.NewServerWithSettings(libpodRuntime, listener, opts)
if err != nil {

View File

@@ -0,0 +1,7 @@
//go:build !linux && !remote
package system
// Currently, we only need servicereaper on Linux to support slirp4netns.
func maybeStartServiceReaper() {
}

View File

@@ -0,0 +1,12 @@
//go:build linux && !remote
package system
import (
"github.com/containers/common/pkg/servicereaper"
)
// Currently, we only need servicereaper on Linux to support slirp4netns.
func maybeStartServiceReaper() {
servicereaper.Start()
}

View File

@@ -0,0 +1,15 @@
package compat
import (
"fmt"
"net/http"
"time"
"github.com/containers/podman/v4/pkg/api/handlers/utils"
)
const DefaultStatsPeriod = 5 * time.Second
func StatsContainer(w http.ResponseWriter, r *http.Request) {
utils.Error(w, http.StatusBadRequest, fmt.Errorf("compat.StatsContainer not supported on FreeBSD"))
}

View File

@@ -35,7 +35,7 @@ func (ic *ContainerEngine) Info(ctx context.Context) (*define.Info, error) {
// we are reporting the default systemd activation socket path as we cannot know if a future
// service may be run with another URI.
if ic.Libpod.RemoteURI() == "" {
xdg := "/run"
xdg := defaultRunPath
if path, err := util.GetRuntimeDir(); err != nil {
// Info is as good as we can guess...
return info, err

View File

@@ -0,0 +1,4 @@
package abi
// Default path for system runtime state
const defaultRunPath = "/var/run"

View File

@@ -0,0 +1,4 @@
package abi
// Default path for system runtime state
const defaultRunPath = "/run"