summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/root.go4
-rw-r--r--docs/source/markdown/podman.1.md4
-rw-r--r--libpod/kube.go4
-rw-r--r--pkg/domain/infra/runtime_libpod.go4
-rw-r--r--pkg/specgenutil/util.go1
-rw-r--r--test/e2e/generate_kube_test.go2
-rw-r--r--test/system/005-info.bats8
7 files changed, 24 insertions, 3 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 500a475bd..9b1aa778b 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -429,6 +429,10 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
pFlags.BoolVar(&opts.Trace, "trace", false, "Enable opentracing output (default false)")
+ volumePathFlagName := "volumepath"
+ pFlags.StringVar(&opts.Engine.VolumePath, volumePathFlagName, "", "Path to the volume directory in which volume data is stored")
+ _ = cmd.RegisterFlagCompletionFunc(volumePathFlagName, completion.AutocompleteDefault)
+
// Hide these flags for both ABI and Tunneling
for _, f := range []string{
"cpu-profile",
diff --git a/docs/source/markdown/podman.1.md b/docs/source/markdown/podman.1.md
index aad12c584..3d1578ea1 100644
--- a/docs/source/markdown/podman.1.md
+++ b/docs/source/markdown/podman.1.md
@@ -193,6 +193,10 @@ Some example URL values in valid formats:
Print the version
+#### **--volumepath**=*value*
+
+Volume directory where builtin volume information is stored (default: "/var/lib/containers/storage/volumes" for UID 0, "$HOME/.local/share/containers/storage/volumes" for other users). Default volume path can be overridden in `containers.conf`.
+
## Environment Variables
Podman can set up environment variables from env of [engine] table in containers.conf. These variables can be overridden by passing environment variables before the `podman` commands.
diff --git a/libpod/kube.go b/libpod/kube.go
index 5e5260dd5..eb62643fe 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -525,9 +525,9 @@ func simplePodWithV1Containers(ctx context.Context, ctrs []*Container) (*v1.Pod,
}
podName := strings.ReplaceAll(ctrs[0].Name(), "_", "")
// Check if the pod name and container name will end up conflicting
- // Append _pod if so
+ // Append -pod if so
if util.StringInSlice(podName, ctrNames) {
- podName = podName + "_pod"
+ podName = podName + "-pod"
}
return newPodObject(
diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go
index 5fdc252e2..ac557e9de 100644
--- a/pkg/domain/infra/runtime_libpod.go
+++ b/pkg/domain/infra/runtime_libpod.go
@@ -209,6 +209,10 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
options = append(options, libpod.WithEventsLogger(cfg.Engine.EventsLogger))
}
+ if fs.Changed("volumepath") {
+ options = append(options, libpod.WithVolumePath(cfg.Engine.VolumePath))
+ }
+
if fs.Changed("cgroup-manager") {
options = append(options, libpod.WithCgroupManager(cfg.Engine.CgroupManager))
} else {
diff --git a/pkg/specgenutil/util.go b/pkg/specgenutil/util.go
index 80d31398b..fa2e90457 100644
--- a/pkg/specgenutil/util.go
+++ b/pkg/specgenutil/util.go
@@ -281,6 +281,7 @@ func CreateExitCommandArgs(storageConfig storageTypes.StoreOptions, config *conf
"--tmpdir", config.Engine.TmpDir,
"--network-config-dir", config.Network.NetworkConfigDir,
"--network-backend", config.Network.NetworkBackend,
+ "--volumepath", config.Engine.VolumePath,
}
if config.Engine.OCIRuntime != "" {
command = append(command, []string{"--runtime", config.Engine.OCIRuntime}...)
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 44c906eed..9c99c3d93 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -71,7 +71,7 @@ var _ = Describe("Podman generate kube", func() {
Expect(pod.Spec.DNSConfig).To(BeNil())
Expect(pod.Spec.Containers[0].WorkingDir).To(Equal(""))
Expect(pod.Spec.Containers[0].Env).To(BeNil())
- Expect(pod.Name).To(Equal("top_pod"))
+ Expect(pod.Name).To(Equal("top-pod"))
numContainers := 0
for range pod.Spec.Containers {
diff --git a/test/system/005-info.bats b/test/system/005-info.bats
index 1d84ede9b..333553b07 100644
--- a/test/system/005-info.bats
+++ b/test/system/005-info.bats
@@ -107,4 +107,12 @@ host.slirp4netns.executable | $expr_path
fi
}
+@test "podman --root PATH --volumepath info - basic output" {
+ volumePath=${PODMAN_TMPDIR}/volumesGoHere
+ if ! is_remote; then
+ run_podman --storage-driver=vfs --root ${PODMAN_TMPDIR}/nothing-here-move-along --volumepath ${volumePath} info --format '{{ .Store.VolumePath }}'
+ is "$output" "${volumePath}" "'podman --volumepath should reset VolumePath"
+ fi
+}
+
# vim: filetype=sh