Bug 1555911 - [3.8] Mounting file in a subpath fails if file was created in initContainer
Summary: [3.8] Mounting file in a subpath fails if file was created in initContainer
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Storage
Version: 3.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.8.0
Assignee: Hemant Kumar
QA Contact: Liang Xia
URL:
Whiteboard:
Depends On: 1555910 1556782 1556796 1556838
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-14 19:55 UTC by Hemant Kumar
Modified: 2019-11-21 18:37 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1555910
Environment:
Last Closed: 2019-11-21 18:37:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Hemant Kumar 2018-03-14 19:55:07 UTC
+++ This bug was initially created as a clone of Bug #1555910 +++

Description of problem:

Originally reported bug : https://github.com/kubernetes/kubernetes/issues/61178

By creating a deployment where an init container creates a file in an emptydir and then the container tries to mount this file as a subpath will reproduce it.

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: subpath
  namespace: kube-system
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: subpath
    spec:
      initContainers:
        - name: init
          image: busybox
          command:
            - touch
            - /mount/test
          volumeMounts:
            - name: mount
              mountPath: /mount
      containers:
      - name: subtest
        image: busybox
        command:
          - ls
          - -l
          - /mount/test
        volumeMounts:
          - name: mount
            mountPath: /mount/test
            subPath: test
      volumes:
      - name: mount
        emptyDir: {}



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




Description of problem:

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

How reproducible:

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:

Master Log:

Node Log (of failed PODs):

PV Dump:

PVC Dump:

StorageClass Dump (if StorageClass used by PV/PVC):

Additional info:

Comment 1 Hemant Kumar 2018-03-14 19:55:56 UTC
We need to cherry-pick upstream fix 
https://github.com/kubernetes/kubernetes/pull/61193

Comment 2 Hemant Kumar 2018-03-14 20:06:16 UTC
https://github.com/openshift/ose/pull/1136

Comment 4 Wenqi He 2018-03-22 08:09:59 UTC
Tested on below version:
openshift v3.8.36
kubernetes v1.8.5+440f8d36da

This bug is fixed on 3.8
# oc get pods -n kube-system
NAME                       READY     STATUS             RESTARTS   AGE
subpath-6cc544864b-8b2wf   0/1       CrashLoopBackOff   1          22m
# oc describe pods subpath-6cc544864b-8b2wf -n kube-system
Events:
  Type     Reason                 Age               From                             Message
  ----     ------                 ----              ----                             -------
  Normal   Scheduled              22m                default-scheduler                Successfully assigned subpath-6cc544864b-8b2wf to wehe-master-etcd-nfs-1
  Normal   SuccessfulMountVolume  22m                kubelet, wehe-master-etcd-nfs-1  MountVolume.SetUp succeeded for volume "mount"
  Normal   SuccessfulMountVolume  22m                kubelet, wehe-master-etcd-nfs-1  MountVolume.SetUp succeeded for volume "default-token-jfd5w"
  Normal   Pulling                22m                kubelet, wehe-master-etcd-nfs-1  pulling image "busybox"
  Normal   Pulled                 22m                kubelet, wehe-master-etcd-nfs-1  Successfully pulled image "busybox"
  Normal   Created                22m                kubelet, wehe-master-etcd-nfs-1  Created container
  Normal   Started                22m                kubelet, wehe-master-etcd-nfs-1  Started container


Note You need to log in before you can comment on or make changes to this bug.