summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-10-01 15:32:14 -0400
committerGitHub <noreply@github.com>2021-10-01 15:32:14 -0400
commit1de96f2c4c390bae29c303e2390da9e87a993d3f (patch)
treeb9a2839581ca47bc7cbac93eabb248144d073848 /libpod
parent9dddd6ab4bd8d5d142ffc53732668212da34b0e6 (diff)
parent6da97c86314d8c80b912ba83db57fd26da19bfb7 (diff)
downloadpodman-1de96f2c4c390bae29c303e2390da9e87a993d3f.tar.gz
podman-1de96f2c4c390bae29c303e2390da9e87a993d3f.tar.bz2
podman-1de96f2c4c390bae29c303e2390da9e87a993d3f.zip
Merge pull request #11777 from cdoern/podVolumesFrom
Pod Volumes From Support
Diffstat (limited to 'libpod')
-rw-r--r--libpod/define/pod_inspect.go2
-rw-r--r--libpod/pod.go16
-rw-r--r--libpod/pod_api.go1
3 files changed, 19 insertions, 0 deletions
diff --git a/libpod/define/pod_inspect.go b/libpod/define/pod_inspect.go
index bc2c1d81f..97e7ffdfb 100644
--- a/libpod/define/pod_inspect.go
+++ b/libpod/define/pod_inspect.go
@@ -63,6 +63,8 @@ type InspectPodData struct {
Devices []InspectDevice `json:"devices,omitempty"`
// BlkioDeviceReadBps contains the Read/Access limit for the pod's devices
BlkioDeviceReadBps []InspectBlkioThrottleDevice `json:"device_read_bps,omitempty"`
+ // VolumesFrom contains the containers that the pod inherits mounts from
+ VolumesFrom []string `json:"volumes_from,omitempty"`
}
// InspectPodInfraConfig contains the configuration of the pod's infra
diff --git a/libpod/pod.go b/libpod/pod.go
index c0b0a974b..068a835f6 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"sort"
+ "strings"
"time"
"github.com/containers/podman/v3/libpod/define"
@@ -200,6 +201,21 @@ func (p *Pod) UserNSMode() string {
return ""
}
+// CPUQuota returns the pod CPU quota
+func (p *Pod) VolumesFrom() []string {
+ if p.state.InfraContainerID == "" {
+ return nil
+ }
+ infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
+ if err != nil {
+ return nil
+ }
+ if ctrs, ok := infra.config.Spec.Annotations[define.InspectAnnotationVolumesFrom]; ok {
+ return strings.Split(ctrs, ",")
+ }
+ return nil
+}
+
// Labels returns the pod's labels
func (p *Pod) Labels() map[string]string {
labels := make(map[string]string)
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 05349aff5..4ae02fb40 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -668,6 +668,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
Mounts: inspectMounts,
Devices: devices,
BlkioDeviceReadBps: deviceLimits,
+ VolumesFrom: p.VolumesFrom(),
}
return &inspectData, nil