Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1360233

Summary: [RFE] Better to have "oc run" also create emptyDir volume automatically for image which need a volume like "oc new-app"
Product: OKD Reporter: Bing Li <bingli>
Component: Command Line InterfaceAssignee: Fabiano Franz <ffranz>
Status: CLOSED WONTFIX QA Contact: Xingxing Xia <xxia>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, ccoleman, cewong, decarr, jokerman, mmccomas, pweil
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-28 21:22:04 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:

Description Bing Li 2016-07-26 10:06:38 UTC
Description of problem:
For images which need a volume in the dockerfile, "oc new-app" command can create emptyDir volume automatically. Is it designed behave like this? But "oc run" command cannot create volume automatically, and pod would failed to be running.
This does not matter for OCP env, but will affect user experience in Online env, so propose this RFE.

Steps to Reproduce:
1. Create by "oc new-app" command;

2. Pod should be running after a while, and an emptyDir volume would be created automatically.
# oc get pod
NAME                 READY     STATUS    RESTARTS   AGE
postgresql-1-l6jek   1/1       Running   0          1m
# oc get dc postgresql -o json
            "spec": {
                "volumes": [
                        "name": "postgresql-volume-1",
                        "emptyDir": {}
                        "volumeMounts": [
                                "name": "postgresql-volume-1",
                                "mountPath": "/var/lib/pgsql/data"
3. Create by "oc run" command;
deploymentconfig "psql" created

4. Pod would fail to be running, because no volume is created;
# oc get pod
NAME            READY     STATUS              RESTARTS   AGE
psql-1-deploy   1/1       Running             0          1m
psql-1-gfh4q    0/1       RunContainerError   0          1m
# oc describe pod psql-1-gfh4q
  2s        2s        1        {kubelet ip-172-31-9-167.ec2.internal}                Warning        FailedSync        Error syncing pod, skipping: failed to "StartContainer" for "psql" with RunContainerError: "runContainer: API error (500): mkdir /var/lib/docker/volumes/24f77003ec438227ebef66d64e6bb8551860ac84b151e814710720a4f9f89b6e: permission denied\n"

Comment 1 Fabiano Franz 2016-10-31 19:20:36 UTC
Adding Cesar and Derek for opinions. 

I'm not sure the `run` command should have such level of intelligence - `oc run` is more targeted at "run this image" use cases where the developer will set up the dependencies it needs to become an usable app, rather than "run this images with all it depends on to become an app", which is actually a responsibility of `oc new-app`.

Comment 2 Derek Carr 2016-11-28 21:09:17 UTC
I think the `run` command should not have this level of intelligence.