diff options
author | Mikhail Khachayants <tyler92@inbox.ru> | 2022-10-06 10:05:19 +0300 |
---|---|---|
committer | Mikhail Khachayants <tyler92@inbox.ru> | 2022-10-06 15:37:36 +0300 |
commit | 8b189c0a0627e04578fe6591e61af850182b78be (patch) | |
tree | d80f22711bb0c29f53c606382e516b4d5971f772 /pkg/specgen | |
parent | 13a1c55d3f0d0cb9a34e865844278e935337cd1b (diff) | |
download | podman-8b189c0a0627e04578fe6591e61af850182b78be.tar.gz podman-8b189c0a0627e04578fe6591e61af850182b78be.tar.bz2 podman-8b189c0a0627e04578fe6591e61af850182b78be.zip |
Create full path to a directory when DirectoryOrCreate is used with play kube
Signed-off-by: Mikhail Khachayants <tyler92@inbox.ru>
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/kube/volume.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go index 2d8085020..beb460d68 100644 --- a/pkg/specgen/generate/kube/volume.go +++ b/pkg/specgen/generate/kube/volume.go @@ -56,10 +56,8 @@ func VolumeFromHostPath(hostPath *v1.HostPathVolumeSource) (*KubeVolume, error) if hostPath.Type != nil { switch *hostPath.Type { case v1.HostPathDirectoryOrCreate: - if _, err := os.Stat(hostPath.Path); os.IsNotExist(err) { - if err := os.Mkdir(hostPath.Path, kubeDirectoryPermission); err != nil { - return nil, err - } + if err := os.MkdirAll(hostPath.Path, kubeDirectoryPermission); err != nil { + return nil, err } // Label a newly created volume if err := libpod.LabelVolumePath(hostPath.Path); err != nil { |