summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/server/docs.go9
-rw-r--r--pkg/domain/entities/pods.go4
-rw-r--r--pkg/specgen/generate/pod_create.go6
-rw-r--r--pkg/specgen/podspecgen.go43
4 files changed, 45 insertions, 17 deletions
diff --git a/pkg/api/server/docs.go b/pkg/api/server/docs.go
index bf15afbf9..83d9ef160 100644
--- a/pkg/api/server/docs.go
+++ b/pkg/api/server/docs.go
@@ -15,6 +15,15 @@
// NOTE: if you install the package podman-docker, it will create a symbolic
// link for /run/docker.sock to /run/podman/podman.sock
//
+// NOTE: some fields in the API response JSON are set as omitempty, which means that
+// if there is no value set for them, they will not show up in the API response. This
+// is a feature to help reduce the size of the JSON responses returned via the API.
+//
+// NOTE: due to the limitations of [go-swagger](https://github.com/go-swagger/go-swagger),
+// some field values that have a complex type show up as null in the docs as well as in the
+// API responses. This is because the zero value for the field type is null. The field
+// description in the docs will state what type the field is expected to be for such cases.
+//
// See podman-service(1) for more information.
//
// Quick Examples:
diff --git a/pkg/domain/entities/pods.go b/pkg/domain/entities/pods.go
index 0356383ec..653f64b42 100644
--- a/pkg/domain/entities/pods.go
+++ b/pkg/domain/entities/pods.go
@@ -135,6 +135,7 @@ type PodCreateOptions struct {
CpusetCpus string `json:"cpuset_cpus,omitempty"`
Userns specgen.Namespace `json:"-"`
Volume []string `json:"volume,omitempty"`
+ VolumesFrom []string `json:"volumes_from,omitempty"`
}
// PodLogsOptions describes the options to extract pod logs.
@@ -251,7 +252,7 @@ type ContainerCreateOptions struct {
UTS string
Mount []string
Volume []string `json:"volume,omitempty"`
- VolumesFrom []string
+ VolumesFrom []string `json:"volumes_from,omitempty"`
Workdir string
SeccompPolicy string
PidFile string
@@ -308,6 +309,7 @@ func ToPodSpecGen(s specgen.PodSpecGenerator, p *PodCreateOptions) (*specgen.Pod
s.InfraImage = p.InfraImage
s.SharedNamespaces = p.Share
s.PodCreateCommand = p.CreateCommand
+ s.VolumesFrom = p.VolumesFrom
// Networking config
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index e523aef42..a4027eae7 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -59,6 +59,12 @@ func MakePod(p *entities.PodSpec, rt *libpod.Runtime) (*libpod.Pod, error) {
if err != nil {
return nil, err
}
+ } else {
+ // SavePod is used to save the pod state and trigger a create event even if infra is not created
+ err := rt.SavePod(pod)
+ if err != nil {
+ return nil, err
+ }
}
return pod, nil
}
diff --git a/pkg/specgen/podspecgen.go b/pkg/specgen/podspecgen.go
index ee4fbc13a..7713ea26c 100644
--- a/pkg/specgen/podspecgen.go
+++ b/pkg/specgen/podspecgen.go
@@ -72,22 +72,6 @@ type PodBasicConfig struct {
// Any containers created within the pod will inherit the pod's userns settings.
// Optional
Userns Namespace `json:"userns,omitempty"`
- // Mounts are mounts that will be added to the pod.
- // These will supersede Image Volumes and VolumesFrom (WIP) volumes where
- // there are conflicts.
- // Optional.
- Mounts []spec.Mount `json:"mounts,omitempty"`
- // Volumes are named volumes that will be added to the pod.
- // These will supersede Image Volumes and VolumesFrom (WIP) volumes where
- // there are conflicts.
- // Optional.
- Volumes []*NamedVolume `json:"volumes,omitempty"`
- // Overlay volumes are named volumes that will be added to the pod.
- // Optional.
- OverlayVolumes []*OverlayVolume `json:"overlay_volumes,omitempty"`
- // Image volumes bind-mount a container-image mount into the pod's infra container.
- // Optional.
- ImageVolumes []*ImageVolume `json:"image_volumes,omitempty"`
// Devices contains user specified Devices to be added to the Pod
Devices []string `json:"pod_devices,omitempty"`
}
@@ -174,6 +158,32 @@ type PodNetworkConfig struct {
NetworkOptions map[string][]string `json:"network_options,omitempty"`
}
+// PodStorageConfig contains all of the storage related options for the pod and its infra container.
+type PodStorageConfig struct {
+ // Mounts are mounts that will be added to the pod.
+ // These will supersede Image Volumes and VolumesFrom volumes where
+ // there are conflicts.
+ // Optional.
+ Mounts []spec.Mount `json:"mounts,omitempty"`
+ // Volumes are named volumes that will be added to the pod.
+ // These will supersede Image Volumes and VolumesFrom volumes where
+ // there are conflicts.
+ // Optional.
+ Volumes []*NamedVolume `json:"volumes,omitempty"`
+ // Overlay volumes are named volumes that will be added to the pod.
+ // Optional.
+ OverlayVolumes []*OverlayVolume `json:"overlay_volumes,omitempty"`
+ // Image volumes bind-mount a container-image mount into the pod's infra container.
+ // Optional.
+ ImageVolumes []*ImageVolume `json:"image_volumes,omitempty"`
+ // VolumesFrom is a set of containers whose volumes will be added to
+ // this pod. The name or ID of the container must be provided, and
+ // may optionally be followed by a : and then one or more
+ // comma-separated options. Valid options are 'ro', 'rw', and 'z'.
+ // Options will be used for all volumes sourced from the container.
+ VolumesFrom []string `json:"volumes_from,omitempty"`
+}
+
// PodCgroupConfig contains configuration options about a pod's cgroups.
// This will be expanded in future updates to pods.
type PodCgroupConfig struct {
@@ -191,6 +201,7 @@ type PodSpecGenerator struct {
PodNetworkConfig
PodCgroupConfig
PodResourceConfig
+ PodStorageConfig
InfraContainerSpec *SpecGenerator `json:"-"`
}