mirror of https://github.com/containers/podman.git
Podman info output plugin information
For docker compat include information about available volume, log and network drivers which should be listed under the plugins key. Fixes #11265 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
23804d95f6
commit
16dfce486b
|
@ -14,6 +14,13 @@ import (
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// logDrivers stores the currently available log drivers, do not modify
|
||||||
|
var logDrivers []string
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
logDrivers = append(logDrivers, define.KubernetesLogging, define.NoLogging)
|
||||||
|
}
|
||||||
|
|
||||||
// Log is a runtime function that can read one or more container logs.
|
// Log is a runtime function that can read one or more container logs.
|
||||||
func (r *Runtime) Log(ctx context.Context, containers []*Container, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
|
func (r *Runtime) Log(ctx context.Context, containers []*Container, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
|
||||||
for _, ctr := range containers {
|
for _, ctr := range containers {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/podman/v3/libpod/define"
|
||||||
"github.com/containers/podman/v3/libpod/events"
|
"github.com/containers/podman/v3/libpod/events"
|
||||||
"github.com/containers/podman/v3/libpod/logs"
|
"github.com/containers/podman/v3/libpod/logs"
|
||||||
"github.com/coreos/go-systemd/v22/sdjournal"
|
"github.com/coreos/go-systemd/v22/sdjournal"
|
||||||
|
@ -24,6 +25,10 @@ const (
|
||||||
journaldLogErr = "3"
|
journaldLogErr = "3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
logDrivers = append(logDrivers, define.JournaldLogging)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
|
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
|
||||||
journal, err := sdjournal.NewJournal()
|
journal, err := sdjournal.NewJournal()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -8,6 +8,7 @@ type Info struct {
|
||||||
Host *HostInfo `json:"host"`
|
Host *HostInfo `json:"host"`
|
||||||
Store *StoreInfo `json:"store"`
|
Store *StoreInfo `json:"store"`
|
||||||
Registries map[string]interface{} `json:"registries"`
|
Registries map[string]interface{} `json:"registries"`
|
||||||
|
Plugins Plugins `json:"plugins"`
|
||||||
Version Version `json:"version"`
|
Version Version `json:"version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,3 +124,11 @@ type ContainerStore struct {
|
||||||
Running int `json:"running"`
|
Running int `json:"running"`
|
||||||
Stopped int `json:"stopped"`
|
Stopped int `json:"stopped"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Plugins struct {
|
||||||
|
Volume []string `json:"volume"`
|
||||||
|
Network []string `json:"network"`
|
||||||
|
Log []string `json:"log"`
|
||||||
|
// FIXME what should we do with Authorization, docker seems to return nothing by default
|
||||||
|
// Authorization []string `json:"authorization"`
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/containers/image/v5/pkg/sysregistriesv2"
|
"github.com/containers/image/v5/pkg/sysregistriesv2"
|
||||||
"github.com/containers/podman/v3/libpod/define"
|
"github.com/containers/podman/v3/libpod/define"
|
||||||
"github.com/containers/podman/v3/libpod/linkmode"
|
"github.com/containers/podman/v3/libpod/linkmode"
|
||||||
|
"github.com/containers/podman/v3/libpod/network"
|
||||||
"github.com/containers/podman/v3/pkg/cgroups"
|
"github.com/containers/podman/v3/pkg/cgroups"
|
||||||
"github.com/containers/podman/v3/pkg/rootless"
|
"github.com/containers/podman/v3/pkg/rootless"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
|
@ -65,6 +66,16 @@ func (r *Runtime) info() (*define.Info, error) {
|
||||||
if len(regs) > 0 {
|
if len(regs) > 0 {
|
||||||
registries["search"] = regs
|
registries["search"] = regs
|
||||||
}
|
}
|
||||||
|
volumePlugins := make([]string, 0, len(r.config.Engine.VolumePlugins)+1)
|
||||||
|
// the local driver always exists
|
||||||
|
volumePlugins = append(volumePlugins, "local")
|
||||||
|
for plugin := range r.config.Engine.VolumePlugins {
|
||||||
|
volumePlugins = append(volumePlugins, plugin)
|
||||||
|
}
|
||||||
|
info.Plugins.Volume = volumePlugins
|
||||||
|
// TODO move this into the new network interface
|
||||||
|
info.Plugins.Network = []string{network.BridgeNetworkDriver, network.MacVLANNetworkDriver}
|
||||||
|
info.Plugins.Log = logDrivers
|
||||||
|
|
||||||
info.Registries = registries
|
info.Registries = registries
|
||||||
return &info, nil
|
return &info, nil
|
||||||
|
|
|
@ -102,14 +102,18 @@ func GetInfo(w http.ResponseWriter, r *http.Request) {
|
||||||
OomKillDisable: sysInfo.OomKillDisable,
|
OomKillDisable: sysInfo.OomKillDisable,
|
||||||
OperatingSystem: infoData.Host.Distribution.Distribution,
|
OperatingSystem: infoData.Host.Distribution.Distribution,
|
||||||
PidsLimit: sysInfo.PidsLimit,
|
PidsLimit: sysInfo.PidsLimit,
|
||||||
Plugins: docker.PluginsInfo{},
|
Plugins: docker.PluginsInfo{
|
||||||
ProductLicense: "Apache-2.0",
|
Volume: infoData.Plugins.Volume,
|
||||||
RegistryConfig: new(registry.ServiceConfig),
|
Network: infoData.Plugins.Network,
|
||||||
RuncCommit: docker.Commit{},
|
Log: infoData.Plugins.Log,
|
||||||
Runtimes: getRuntimes(configInfo),
|
},
|
||||||
SecurityOptions: getSecOpts(sysInfo),
|
ProductLicense: "Apache-2.0",
|
||||||
ServerVersion: versionInfo.Version,
|
RegistryConfig: new(registry.ServiceConfig),
|
||||||
SwapLimit: sysInfo.SwapLimit,
|
RuncCommit: docker.Commit{},
|
||||||
|
Runtimes: getRuntimes(configInfo),
|
||||||
|
SecurityOptions: getSecOpts(sysInfo),
|
||||||
|
ServerVersion: versionInfo.Version,
|
||||||
|
SwapLimit: sysInfo.SwapLimit,
|
||||||
Swarm: swarm.Info{
|
Swarm: swarm.Info{
|
||||||
LocalNodeState: swarm.LocalNodeStateInactive,
|
LocalNodeState: swarm.LocalNodeStateInactive,
|
||||||
},
|
},
|
||||||
|
|
|
@ -77,6 +77,15 @@ var _ = Describe("Podman Info", func() {
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("registry"))
|
Expect(session.OutputToString()).To(ContainSubstring("registry"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman info --format GO template plugins", func() {
|
||||||
|
session := podmanTest.Podman([]string{"info", "--format", "{{.Plugins}}"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
Expect(session.OutputToString()).To(ContainSubstring("local"))
|
||||||
|
Expect(session.OutputToString()).To(ContainSubstring("journald"))
|
||||||
|
Expect(session.OutputToString()).To(ContainSubstring("bridge"))
|
||||||
|
})
|
||||||
|
|
||||||
It("podman info rootless storage path", func() {
|
It("podman info rootless storage path", func() {
|
||||||
SkipIfNotRootless("test of rootless_storage_path is only meaningful as rootless")
|
SkipIfNotRootless("test of rootless_storage_path is only meaningful as rootless")
|
||||||
SkipIfRemote("Only tests storage on local client")
|
SkipIfRemote("Only tests storage on local client")
|
||||||
|
|
Loading…
Reference in New Issue