Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add netavark and aardvark-dns to podman info #18803

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions libpod/define/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,27 @@ type SecurityInfo struct {

// HostInfo describes the libpod host
type HostInfo struct {
Arch string `json:"arch"`
BuildahVersion string `json:"buildahVersion"`
CgroupManager string `json:"cgroupManager"`
CgroupsVersion string `json:"cgroupVersion"`
CgroupControllers []string `json:"cgroupControllers"`
Conmon *ConmonInfo `json:"conmon"`
CPUs int `json:"cpus"`
CPUUtilization *CPUUsage `json:"cpuUtilization"`
DatabaseBackend string `json:"databaseBackend"`
Distribution DistributionInfo `json:"distribution"`
EventLogger string `json:"eventLogger"`
Hostname string `json:"hostname"`
IDMappings IDMappings `json:"idMappings,omitempty"`
Kernel string `json:"kernel"`
LogDriver string `json:"logDriver"`
MemFree int64 `json:"memFree"`
MemTotal int64 `json:"memTotal"`
NetworkBackend string `json:"networkBackend"`
OCIRuntime *OCIRuntimeInfo `json:"ociRuntime"`
OS string `json:"os"`
Arch string `json:"arch"`
BuildahVersion string `json:"buildahVersion"`
CgroupManager string `json:"cgroupManager"`
CgroupsVersion string `json:"cgroupVersion"`
CgroupControllers []string `json:"cgroupControllers"`
Conmon *ConmonInfo `json:"conmon"`
CPUs int `json:"cpus"`
CPUUtilization *CPUUsage `json:"cpuUtilization"`
DatabaseBackend string `json:"databaseBackend"`
Distribution DistributionInfo `json:"distribution"`
EventLogger string `json:"eventLogger"`
Hostname string `json:"hostname"`
IDMappings IDMappings `json:"idMappings,omitempty"`
Kernel string `json:"kernel"`
LogDriver string `json:"logDriver"`
MemFree int64 `json:"memFree"`
MemTotal int64 `json:"memTotal"`
NetworkBackend string `json:"networkBackend"`
NetworkBackendInfo *NetavarkInfo `json:"networkBackendInfo,omitempty"`
OCIRuntime *OCIRuntimeInfo `json:"ociRuntime"`
OS string `json:"os"`
// RemoteSocket returns the UNIX domain socket the Podman service is listening on
RemoteSocket *RemoteSocket `json:"remoteSocket,omitempty"`
RuntimeInfo map[string]interface{} `json:"runtimeInfo,omitempty"`
Expand Down Expand Up @@ -103,6 +104,16 @@ type ConmonInfo struct {
Version string `json:"version"`
}

// NetavarkInfo describes the netavark executable being used
type NetavarkInfo struct {
Package string `json:"package"`
Path string `json:"path"`
Version string `json:"version"`
DNSPackage string `json:"dnsPackage,omitempty"`
DNSPath string `json:"dnsPath,omitempty"`
DNSVersion string `json:"dnsVersion,omitempty"`
}

// OCIRuntimeInfo describes the runtime (crun or runc) being
// used with podman
type OCIRuntimeInfo struct {
Expand Down
25 changes: 25 additions & 0 deletions libpod/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/containers/buildah"
"github.com/containers/buildah/pkg/util"
"github.com/containers/common/libnetwork/types"
"github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/libpod/linkmode"
Expand Down Expand Up @@ -118,6 +119,30 @@ func (r *Runtime) hostInfo() (*define.HostInfo, error) {
SwapFree: mi.SwapFree,
SwapTotal: mi.SwapTotal,
}
if info.NetworkBackend == string(types.Netavark) {
path, err := r.config.FindHelperBinary(info.NetworkBackend, true)
if err != nil {
logrus.Errorf("Getting host info on netavark: %v", err)
} else {
version, err := programVersion(path)
if err != nil {
logrus.Errorf("Getting netavark version: %v", err)
}
info.NetworkBackendInfo = &define.NetavarkInfo{
Path: path,
Package: packageVersion(path),
Version: version,
}
path, err = r.config.FindHelperBinary("aardvark-dns", true)
if err == nil {
version, _ = programVersion(path)
info.NetworkBackendInfo.DNSPath = path
info.NetworkBackendInfo.DNSPackage = packageVersion(path)
info.NetworkBackendInfo.DNSVersion = version
}
}
}

if err := r.setPlatformHostInfo(&info); err != nil {
return nil, err
}
Expand Down
8 changes: 8 additions & 0 deletions test/system/500-networking.bats
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ load helpers.network
run_podman 1 network rm $mynetname
}

@test "podman info netavark" {
if !is_netavark; then
skip "only meaningful for netavark"
fi
run_podman info --format '{{ .Host.NetworkBackendInfo }}'
assert "$output" =~ "netavark" "NetworkBackendInfo should contain inforamation about netavark"
}

@test "podman network reload" {
skip_if_remote "podman network reload does not have remote support"

Expand Down