diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-08-19 17:28:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 17:28:22 -0400 |
commit | 30b036c5d394bb523fa13074b1731ad4b6259693 (patch) | |
tree | fc06af62dcc0bae3c38a32ed444d458bd50e5958 /libpod | |
parent | f988cfe1463f795f51f64e0887ba9dd9fe85b23d (diff) | |
parent | 16dfce486b45d5989dcba503cd0797bc7d66bee4 (diff) | |
download | podman-30b036c5d394bb523fa13074b1731ad4b6259693.tar.gz podman-30b036c5d394bb523fa13074b1731ad4b6259693.tar.bz2 podman-30b036c5d394bb523fa13074b1731ad4b6259693.zip |
Merge pull request #11280 from Luap99/info-plugins
Podman info output plugin information
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_log.go | 7 | ||||
-rw-r--r-- | libpod/container_log_linux.go | 5 | ||||
-rw-r--r-- | libpod/define/info.go | 9 | ||||
-rw-r--r-- | libpod/info.go | 11 |
4 files changed, 32 insertions, 0 deletions
diff --git a/libpod/container_log.go b/libpod/container_log.go index 743c9c61b..3988bb654 100644 --- a/libpod/container_log.go +++ b/libpod/container_log.go @@ -14,6 +14,13 @@ import ( "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. func (r *Runtime) Log(ctx context.Context, containers []*Container, options *logs.LogOptions, logChannel chan *logs.LogLine) error { for _, ctr := range containers { diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go index 11f1be7f9..4eb600bfe 100644 --- a/libpod/container_log_linux.go +++ b/libpod/container_log_linux.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "github.com/containers/podman/v3/libpod/define" "github.com/containers/podman/v3/libpod/events" "github.com/containers/podman/v3/libpod/logs" "github.com/coreos/go-systemd/v22/sdjournal" @@ -24,6 +25,10 @@ const ( journaldLogErr = "3" ) +func init() { + logDrivers = append(logDrivers, define.JournaldLogging) +} + func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error { journal, err := sdjournal.NewJournal() if err != nil { diff --git a/libpod/define/info.go b/libpod/define/info.go index de709be74..95c1196dd 100644 --- a/libpod/define/info.go +++ b/libpod/define/info.go @@ -8,6 +8,7 @@ type Info struct { Host *HostInfo `json:"host"` Store *StoreInfo `json:"store"` Registries map[string]interface{} `json:"registries"` + Plugins Plugins `json:"plugins"` Version Version `json:"version"` } @@ -123,3 +124,11 @@ type ContainerStore struct { Running int `json:"running"` 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"` +} diff --git a/libpod/info.go b/libpod/info.go index 2b48ea590..8f4c7f015 100644 --- a/libpod/info.go +++ b/libpod/info.go @@ -18,6 +18,7 @@ import ( "github.com/containers/image/v5/pkg/sysregistriesv2" "github.com/containers/podman/v3/libpod/define" "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/rootless" "github.com/containers/storage" @@ -65,6 +66,16 @@ func (r *Runtime) info() (*define.Info, error) { if len(regs) > 0 { 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 return &info, nil |