{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12526","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12526/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12526/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12526/events","html_url":"https://github.com/kubernetes/kubernetes/issues/12526","id":100286472,"number":12526,"title":"Container dependencies & volumes-from support within Pod","user":{"login":"resouer","id":1701782,"avatar_url":"https://avatars.githubusercontent.com/u/1701782?v=3","gravatar_id":"","url":"https://api.github.com/users/resouer","html_url":"https://github.com/resouer","followers_url":"https://api.github.com/users/resouer/followers","following_url":"https://api.github.com/users/resouer/following{/other_user}","gists_url":"https://api.github.com/users/resouer/gists{/gist_id}","starred_url":"https://api.github.com/users/resouer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/resouer/subscriptions","organizations_url":"https://api.github.com/users/resouer/orgs","repos_url":"https://api.github.com/users/resouer/repos","events_url":"https://api.github.com/users/resouer/events{/privacy}","received_events_url":"https://api.github.com/users/resouer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/priority/P2","name":"priority/P2","color":"fbca04"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/team/ux","name":"team/ux","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-11T10:47:26Z","updated_at":"2015-08-24T17:25:20Z","closed_at":null,"body":"I'd like to propose one use case and two issues, which I think are a little different from https://github.com/GoogleCloudPlatform/kubernetes/issues/831. we'd like to fix them if sound reasonable:\r\n\r\n#### use case: a java dev workflow\r\n\r\n```\r\njava code ---> git repo ---> app docker image (a war, nothing more)---> registry\r\n\r\nWeb server docker image (a standard tomcat image) ---> registry\r\n```\r\nDeploy:\r\n\r\nA pod.yaml with two containers,:\r\n```\r\napiVersion: v1beta3\r\nkind: Pod\r\nmetadata:\r\n  name: app\r\nspec:\r\n  containers:\r\n  - image: tomcat:latest\r\n    name: tomcat\r\n    volumeMounts:\r\n    - mountPath: /home\r\n      name: test-volume\r\n  - image: app:latest\r\n    name: war\r\n    command: [\"sh\", \"-c\", \"cp /app/myapp.war /work\"]\r\n    volumeMounts:\r\n    - mountPath: /work\r\n      name: test-volume\r\n  volumes:\r\n  - name: test-volume\r\n  restartPolicy: OnFailure # have to, but I really want to set Always for `tomcat` and onFailture for `war`\r\n```\r\nIt works OK, tomcat can load war from /work dir, but the **only concern** is that we need to make tomcat container starts after app finish `cp`.                    \r\n\r\nSo, this is about two issues:\r\n\r\n####  **container dependency**\r\n\r\nThere're many other cases users want to guarantee container A starts before B in a Pod. See #1996.\r\n\r\nWe can set a `byOrder=true` in pod.yaml to enable it.\r\n\r\n*Why not git volume?* Nobody stores everything in a git repo, and the file may also be generated by B.\r\n*Why not other type of distributed fs volume?* We don't want to maintain NFS server or other kinds, because we don't want to maintain folders and directories with unique names in case of conflicts.\r\n\r\nTwo dependency types:\r\n**Soft**: just create & start the containers defined in Pod one by one, the order is just the same as it is in listed pod.yaml\r\n**Hard**: B will wait until A 's state become `OK` ( It's a signal defined by user, like RUNNING, better work with container handler)\r\n\r\nDefinitely, we can also integrate them into one rule: start by order, and start the next when meeting a handler defined rule.\r\n \r\nWe should implement Soft order at least (`map` in golang is not order promised I believe), for the use case above, it's enough.\r\n\r\n#### **volumes-from**\r\n\r\nYes, this feature will make things much easier, we don't need use `empty_dir` anymore. A and B should always be in the same Pod, and that's also volumes-from want to see.\r\n\r\nWe also need to make sure the order of containers, which can be exactly the same as  **container dependency** part says.\r\n\r\n#### In one word\r\n\r\nInstead of container type volume, I think the native `volumes-from` of docker is much better. It will solve a tricky problem for all:\r\n\r\n\"Should I package my war in the image or use it as a volume?\"\r\n\r\nThat's where Pod can play better! "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/134307623","html_url":"https://github.com/kubernetes/kubernetes/issues/12526#issuecomment-134307623","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12526","id":134307623,"user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T17:25:20Z","updated_at":"2015-08-24T17:25:20Z","body":"Can you be more precise on the specification of how you think it would act?\n who is responsible for copying data?  The whole volume image or just\nVOLUME dirs?  How does it know where to copy the data?\n\nI am reluctant to do half-measures but if the spec can be clearly defined,\nmaybe.\n\nOn Mon, Aug 24, 2015 at 4:59 AM, Harry Zhang <notifications@github.com>\nwrote:\n\n> @thockin <https://github.com/thockin> So what about the copyTo idea\n> mentioned here #12526 (comment)\n> <https://github.com/kubernetes/kubernetes/issues/12526#issuecomment-130540796>\n> .\n>\n> We can try to keep the content in volume, and then we don't need\n> volume-from.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/kubernetes/kubernetes/issues/12526#issuecomment-134165992>\n> .\n>\n"}}