Bug 1451008

Summary: Pods fail to start if they specify a file as a volume subPath to mount
Product: OpenShift Container Platform Reporter: Matthew Wong <mawong>
Component: StorageAssignee: Matthew Wong <mawong>
Status: CLOSED ERRATA QA Contact: Wenqi He <wehe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.6.1CC: aos-bugs, bchilds, jhou, smunilla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1451007 Environment:
Last Closed: 2017-08-10 05:24:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1451007    
Bug Blocks:    

Description Matthew Wong 2017-05-15 14:44:43 UTC
+++ This bug was initially created as a clone of Bug #1451007 +++

Description of problem:

Pods fail to start if they specify a file as a volume subPath to mount

Version-Release number of selected component (if applicable):

How reproducible:

Always

Steps to Reproduce:
1. Create a pod that mounts a volume's file using subPath

Actual results:

Pod reports "mkdir" error and fails to start

Expected results:

Pod enters Running state

--- Additional comment from Matthew Wong on 2017-05-15 10:44:19 EDT ---

https://github.com/openshift/origin/pull/14193

Comment 1 Matthew Wong 2017-06-01 13:28:49 UTC
PR: https://github.com/openshift/origin/pull/14193

Comment 3 Wenqi He 2017-06-13 07:36:43 UTC
Tested on below version:
openshift v3.6.105
kubernetes v1.6.1+5115d708d7

The pod could be started with subpath:
$ cat pod.json
{
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {
        "name": "mypod1",
        "labels": {
            "name": "frontendhttp"
        }
    },
    "spec": {
        "containers": [{
            "name": "myfrontend",
            "image": "jhou/hello-openshift",
            "imagePullPolicy": "IfNotPresent",
            "ports": [{
                "containerPort": 80,
                "name": "http-server"
            }],
            "volumeMounts": [{
                "mountPath": "/opt/wehe",
                "subPath": "wehe",
                "name": "pvol"
            }]
        }],
        "volumes": [{
            "name": "pvol",
            "nfs": {
                "server": "XXX",
                "path": "/",
                "readOnly": false
            }
        }]
    }
}

$ oc get pods
mypod1       1/1       Running   0          1m

[root@mypod1 opt]# ll
total 0
drwxrwxrwx. 2 root root 6 Jun 13 07:31 wehe

Comment 5 errata-xmlrpc 2017-08-10 05:24:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1716