{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/10495","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/10495/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/10495/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/10495/events","html_url":"https://github.com/kubernetes/kubernetes/issues/10495","id":91896644,"number":10495,"title":"Simplified resource generation (was kubectl command to create a namespace)","user":{"login":"derekwaynecarr","id":6233452,"avatar_url":"https://avatars.githubusercontent.com/u/6233452?v=3","gravatar_id":"","url":"https://api.github.com/users/derekwaynecarr","html_url":"https://github.com/derekwaynecarr","followers_url":"https://api.github.com/users/derekwaynecarr/followers","following_url":"https://api.github.com/users/derekwaynecarr/following{/other_user}","gists_url":"https://api.github.com/users/derekwaynecarr/gists{/gist_id}","starred_url":"https://api.github.com/users/derekwaynecarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekwaynecarr/subscriptions","organizations_url":"https://api.github.com/users/derekwaynecarr/orgs","repos_url":"https://api.github.com/users/derekwaynecarr/repos","events_url":"https://api.github.com/users/derekwaynecarr/events{/privacy}","received_events_url":"https://api.github.com/users/derekwaynecarr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/area/app-config-deployment","name":"area/app-config-deployment","color":"fb6420"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/component/kubectl","name":"component/kubectl","color":"0052cc"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/priority/P1","name":"priority/P1","color":"eb6420"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/team/ux","name":"team/ux","color":"d2b48c"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/13","html_url":"https://github.com/kubernetes/kubernetes/milestones/v1.1","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/13/labels","id":1220916,"number":13,"title":"v1.1","description":"Release 1.1.\r\n\r\nP1 features:\r\n* 250 nodes\r\n* kube-proxy perf. improvements (via IPTables)\r\n* Docker 1.8.x\r\n* Horizontal pod auto-scaling\r\n* Job Object\r\n* Schema validation in kubectl\r\n* Experimental API and API groups\r\n* Graceful pod termination\r\n","creator":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"open_issues":91,"closed_issues":107,"state":"open","created_at":"2015-07-22T19:17:12Z","updated_at":"2015-10-01T00:11:38Z","due_on":"2015-09-21T07:00:00Z","closed_at":null},"comments":35,"created_at":"2015-06-29T20:07:26Z","updated_at":"2015-10-01T00:27:02Z","closed_at":null,"body":"A variety of issues have raised the specter of the need to make it easier to create a new ```Namespace``` from ```kubectl``` rather than handcrafting YAML.\r\n\r\nI want to use this issue to drive resolution on the desired UX prior to submitting a PR.\r\n\r\n**Option 1** \r\n\r\nAdd a command ```kubectl new-namespace```\r\n\r\nPros:\r\n1. Clear what it does\r\n\r\nCons:\r\n1. new-* syntax is a little different than other command options today\r\n\r\n**Option 2**\r\n\r\nModify ```kubectl namespace``` command to create the named namespace if it does not exist.\r\n\r\nPros:\r\n1. Avoids a new-* pattern in case folks don't like it.\r\n\r\nCons:\r\n1. Changes the meaning of a command that existed previously, but we did deprecate it previously, so maybe this is not an issue.\r\n\r\n**Option 3**\r\n\r\nAdd a ```kubectl new <resource> <name> --flag1 --flag2``` command syntax to support the following:\r\n\r\n```kubectl new namespace myname | kubectl create -```\r\n\r\nPros:\r\n1. The new pattern works nicely with subcommands that need specific flags\r\n\r\nCons:\r\n\r\n\r\n**Configuration of Namespace**\r\nThere has been some side discussion on pre-configuring a newly created ```Namespace``` with some additional default resources.  For example, create a namespace could also create a ```LimitRange``` that set default cpu limits to make scheduler better behaved.\r\n\r\nIn OpenShift, we have a ```new-project``` command that creates a namespace, assigns the user as the admin of that namespace via our policy stuff, and let's the user set a display name and description that get stored as annotations on the namespace.  The namespace can also have some pre-defined content in it based on the new-project-template that is configured.  We do not have a template notion yet in Kubernetes, but in theory, we can use that to set the default ```LimitRange``` stuff.  \r\n\r\nhttps://docs.openshift.com/enterprise/3.0/admin_guide/selfprovisioned_projects.html\r\n\r\nAbsent a template concept, we would need to add some additional flags to either command in Option 1 or 2 above if we want to populate with some additional content.  \r\n\r\nIf we want to pursue that, we could do the following arguments that provisioned a ```LimitRange```.\r\n\r\nArguments that \r\n```\r\n--default-cpu=the default cpu assigned to a container if not specified\r\n--default-memory=the default memory assigned to a container if not specified\r\n```\r\n\r\nFeedback requested: @bgrant0607 @deads2k @smarterclayton \r\n@ghodss"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/144582126","html_url":"https://github.com/kubernetes/kubernetes/issues/10495#issuecomment-144582126","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/10495","id":144582126,"user":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T00:27:02Z","updated_at":"2015-10-01T00:27:02Z","body":"On whole examples vs. field tags: I'm definitely in favor of whole examples. They'd be easier to curate and understand.\r\n\r\nOn conveying examples via swagger: We have lots of reasons we need to move to Swagger 2.0. @nikhiljindal   I'd be fine with baking them into the client in the short term, though.\r\n\r\nOn preserving comments and ordering: We need to do that. We'd like to print line numbers in validation error messages, for instance, and we'd like the automatic version converter to either respect the user's config order or the curated order of fields in the API, which is what go-restful's swagger implementation does. We could capture comments and maybe other info as annotations. Using lists instead of maps in the yaml-to-json converter may be necessary, also.\r\n\r\nOn editor vs. automation: We probably need both. My top priority is the editor. It should be easier to maintain and easier to read, and will teach users the config schema. For specific common cases with bounded numbers of arguments we can create more generators like run, expose, make-namespace, and make-secret. I also imagine creating commands for even more intelligent generators, like podex #14801.  However, for specifying large numbers of fields or repeated nested structures, flags aren't going to work well."}}