{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35220","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35220/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35220/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35220/events","html_url":"https://github.com/kubernetes/kubernetes/pull/35220","id":184302707,"number":35220,"title":"Implement --groupversionkind(-g) flag to overwrite default whitelist for --prune","user":{"login":"MrHohn","id":8681801,"avatar_url":"https://avatars.githubusercontent.com/u/8681801?v=3","gravatar_id":"","url":"https://api.github.com/users/MrHohn","html_url":"https://github.com/MrHohn","followers_url":"https://api.github.com/users/MrHohn/followers","following_url":"https://api.github.com/users/MrHohn/following{/other_user}","gists_url":"https://api.github.com/users/MrHohn/gists{/gist_id}","starred_url":"https://api.github.com/users/MrHohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrHohn/subscriptions","organizations_url":"https://api.github.com/users/MrHohn/orgs","repos_url":"https://api.github.com/users/MrHohn/repos","events_url":"https://api.github.com/users/MrHohn/events{/privacy}","received_events_url":"https://api.github.com/users/MrHohn/received_events","type":"User","site_admin":false},"labels":[{"id":176978828,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf","default":false},{"id":349530249,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note-none","name":"release-note-none","color":"c2e0c6","default":false},{"id":253450978,"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/L","name":"size/L","color":"ee9900","default":false}],"state":"open","locked":false,"assignee":{"login":"fabianofranz","id":158611,"avatar_url":"https://avatars.githubusercontent.com/u/158611?v=3","gravatar_id":"","url":"https://api.github.com/users/fabianofranz","html_url":"https://github.com/fabianofranz","followers_url":"https://api.github.com/users/fabianofranz/followers","following_url":"https://api.github.com/users/fabianofranz/following{/other_user}","gists_url":"https://api.github.com/users/fabianofranz/gists{/gist_id}","starred_url":"https://api.github.com/users/fabianofranz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabianofranz/subscriptions","organizations_url":"https://api.github.com/users/fabianofranz/orgs","repos_url":"https://api.github.com/users/fabianofranz/repos","events_url":"https://api.github.com/users/fabianofranz/events{/privacy}","received_events_url":"https://api.github.com/users/fabianofranz/received_events","type":"User","site_admin":false},"assignees":[{"login":"fabianofranz","id":158611,"avatar_url":"https://avatars.githubusercontent.com/u/158611?v=3","gravatar_id":"","url":"https://api.github.com/users/fabianofranz","html_url":"https://github.com/fabianofranz","followers_url":"https://api.github.com/users/fabianofranz/followers","following_url":"https://api.github.com/users/fabianofranz/following{/other_user}","gists_url":"https://api.github.com/users/fabianofranz/gists{/gist_id}","starred_url":"https://api.github.com/users/fabianofranz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabianofranz/subscriptions","organizations_url":"https://api.github.com/users/fabianofranz/orgs","repos_url":"https://api.github.com/users/fabianofranz/repos","events_url":"https://api.github.com/users/fabianofranz/events{/privacy}","received_events_url":"https://api.github.com/users/fabianofranz/received_events","type":"User","site_admin":false},{"login":"mikedanese","id":1787169,"avatar_url":"https://avatars.githubusercontent.com/u/1787169?v=3","gravatar_id":"","url":"https://api.github.com/users/mikedanese","html_url":"https://github.com/mikedanese","followers_url":"https://api.github.com/users/mikedanese/followers","following_url":"https://api.github.com/users/mikedanese/following{/other_user}","gists_url":"https://api.github.com/users/mikedanese/gists{/gist_id}","starred_url":"https://api.github.com/users/mikedanese/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikedanese/subscriptions","organizations_url":"https://api.github.com/users/mikedanese/orgs","repos_url":"https://api.github.com/users/mikedanese/repos","events_url":"https://api.github.com/users/mikedanese/events{/privacy}","received_events_url":"https://api.github.com/users/mikedanese/received_events","type":"User","site_admin":false},{"login":"pwittrock","id":7882754,"avatar_url":"https://avatars.githubusercontent.com/u/7882754?v=3","gravatar_id":"","url":"https://api.github.com/users/pwittrock","html_url":"https://github.com/pwittrock","followers_url":"https://api.github.com/users/pwittrock/followers","following_url":"https://api.github.com/users/pwittrock/following{/other_user}","gists_url":"https://api.github.com/users/pwittrock/gists{/gist_id}","starred_url":"https://api.github.com/users/pwittrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwittrock/subscriptions","organizations_url":"https://api.github.com/users/pwittrock/orgs","repos_url":"https://api.github.com/users/pwittrock/repos","events_url":"https://api.github.com/users/pwittrock/events{/privacy}","received_events_url":"https://api.github.com/users/pwittrock/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/23","html_url":"https://github.com/kubernetes/kubernetes/milestones/v1.5","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/23/labels","id":1945978,"number":23,"title":"v1.5","description":"","creator":{"login":"lavalamp","id":647318,"avatar_url":"https://avatars.githubusercontent.com/u/647318?v=3","gravatar_id":"","url":"https://api.github.com/users/lavalamp","html_url":"https://github.com/lavalamp","followers_url":"https://api.github.com/users/lavalamp/followers","following_url":"https://api.github.com/users/lavalamp/following{/other_user}","gists_url":"https://api.github.com/users/lavalamp/gists{/gist_id}","starred_url":"https://api.github.com/users/lavalamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lavalamp/subscriptions","organizations_url":"https://api.github.com/users/lavalamp/orgs","repos_url":"https://api.github.com/users/lavalamp/repos","events_url":"https://api.github.com/users/lavalamp/events{/privacy}","received_events_url":"https://api.github.com/users/lavalamp/received_events","type":"User","site_admin":false},"open_issues":274,"closed_issues":238,"state":"open","created_at":"2016-08-16T21:47:28Z","updated_at":"2016-11-01T17:38:10Z","due_on":"2016-12-09T00:00:00Z","closed_at":null},"comments":19,"created_at":"2016-10-20T18:16:57Z","updated_at":"2016-11-01T17:40:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/35220","html_url":"https://github.com/kubernetes/kubernetes/pull/35220","diff_url":"https://github.com/kubernetes/kubernetes/pull/35220.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/35220.patch"},"body":"From #34274.\r\n\r\nUpdates:\r\n\r\nAs suggested, the new commits implement a default whitelist for `kubectl apply --prune`, which could be overwritten by using `--groupversionkind`or `-g` flag. The default whitelist and example as below.\r\n\r\nAlso supports `--dry-run` for `--prune` to fix #35222.\r\n\r\nwhitelist:\r\n\r\n```\r\ntype pruneResource struct {\r\n    group      string\r\n    version    string\r\n    kind       string\r\n    namespaced bool\r\n}\r\n\r\n*pruneResources = []pruneResource{\r\n    {\"\", \"v1\", \"ConfigMap\", true},\r\n    {\"\", \"v1\", \"Endpoints\", true},\r\n    {\"\", \"v1\", \"Namespace\", false},\r\n    {\"\", \"v1\", \"PersistentVolumeClaim\", true},\r\n    {\"\", \"v1\", \"PersistentVolume\", false},\r\n    {\"\", \"v1\", \"Pod\", true},\r\n    {\"\", \"v1\", \"ReplicationController\", true},\r\n    {\"\", \"v1\", \"Secret\", true},\r\n    {\"\", \"v1\", \"Service\", true},\r\n    {\"batch\", \"v1\", \"Job\", true},\r\n    {\"extensions\", \"v1beta1\", \"DaemonSet\", true},\r\n    {\"extensions\", \"v1beta1\", \"Deployment\", true},\r\n    {\"extensions\", \"v1beta1\", \"HorizontalPodAutoscaler\", true},\r\n    {\"extensions\", \"v1beta1\", \"Ingress\", true},\r\n    {\"extensions\", \"v1beta1\", \"ReplicaSet\", true},\r\n}\r\n```\r\n\r\nexample:\r\n\r\n```\r\n$ kubectl apply -f /path/to/file --prune -l test=true \\\r\n      -g core/v1/Pod \\\r\n      -g core/v1/Service \\\r\n      -g extensions/v1beta1/Deployment \r\n```\r\n\r\n@mikedanese\r\n\r\n<!-- Reviewable:start -->\r\n---\r\n\r\nThis change is [<img src=\"https://reviewable.kubernetes.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/35220)\r\n\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/257635897","html_url":"https://github.com/kubernetes/kubernetes/pull/35220#issuecomment-257635897","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/35220","id":257635897,"user":{"login":"pwittrock","id":7882754,"avatar_url":"https://avatars.githubusercontent.com/u/7882754?v=3","gravatar_id":"","url":"https://api.github.com/users/pwittrock","html_url":"https://github.com/pwittrock","followers_url":"https://api.github.com/users/pwittrock/followers","following_url":"https://api.github.com/users/pwittrock/following{/other_user}","gists_url":"https://api.github.com/users/pwittrock/gists{/gist_id}","starred_url":"https://api.github.com/users/pwittrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwittrock/subscriptions","organizations_url":"https://api.github.com/users/pwittrock/orgs","repos_url":"https://api.github.com/users/pwittrock/repos","events_url":"https://api.github.com/users/pwittrock/events{/privacy}","received_events_url":"https://api.github.com/users/pwittrock/received_events","type":"User","site_admin":false},"created_at":"2016-11-01T17:40:12Z","updated_at":"2016-11-01T17:40:12Z","body":"Generally looks good.  Comments are generally minor except for the StatefulSets pruning.\n\n@mikedanese I will be OOO for the next 2 weeks with limited availability.  Would you be willing to close off any of the few comments I left?  Otherwise LGTM.\n\n---\n\nReviewed 1 of 3 files at r3, 2 of 2 files at r4.\nReview status: all files reviewed at latest revision, 4 unresolved discussions.\n\n---\n\n*[pkg/kubectl/cmd/apply.go, line 131 at r2](https://reviewable.kubernetes.io:443/reviews/kubernetes/kubernetes/35220#-KUYIsvD6cPHOBLnOVkg-r2-131:-KVVuvZ0IPGZRtq-Atfx:bbk5srr) ([raw file](https://github.com/kubernetes/kubernetes/blob/4b8676a13a7b576f6d13b78d05220e11d5276197/pkg/kubectl/cmd/apply.go#L131)):*\n<details><summary><i>Previously, MrHohn (Zihong Zheng) wrote…</i></summary>\n> Thanks for the comment. I changed the name to `parsePruneResources` and put it into RunApply().\n</details>\nNon-blocker: Why not just return a slice with the error instead of passing it in?\n\n---\n\n*[pkg/kubectl/cmd/apply.go, line 334 at r3](https://reviewable.kubernetes.io:443/reviews/kubernetes/kubernetes/35220#-KVVveeXD02helgwFH44:-KVVveeXD02helgwFH45:bu9dfu3) ([raw file](https://github.com/kubernetes/kubernetes/blob/858fa1a85c99c66234f67047d75e4bcf6dd35f0f/pkg/kubectl/cmd/apply.go#L334)):*\n> ```Go\n> \n> func (pr pruneResource) String() string {\n> \treturn fmt.Sprintf(\"%v/%v, Kind=%v, namespaced=%v\", pr.group, pr.version, pr.kind, pr.namespaced)\n> ```\n\nnit: any particular reason Kind is capitalized while namespaced is not?\n\n---\n\n*[pkg/kubectl/cmd/apply.go, line 341 at r3](https://reviewable.kubernetes.io:443/reviews/kubernetes/kubernetes/35220#-KVVvA93YYGaqjl9o7wL:-KVVvA93YYGaqjl9o7wM:bw7r4ya) ([raw file](https://github.com/kubernetes/kubernetes/blob/858fa1a85c99c66234f67047d75e4bcf6dd35f0f/pkg/kubectl/cmd/apply.go#L341)):*\n> ```Go\n> \t\t// default whitelist\n> \t\t*pruneResources = []pruneResource{\n> \t\t\t{\"\", \"v1\", \"ConfigMap\", true},\n> ```\n\nWhat about StatefulSet?  Anything else new to beta or ga in 1.5?\n\n---\n\n*[pkg/kubectl/cmd/apply.go, line 350 at r3](https://reviewable.kubernetes.io:443/reviews/kubernetes/kubernetes/35220#-KVVvJFAHmEg2VYQTz4V:-KVVvJFAHmEg2VYQTz4W:b-d8zksg) ([raw file](https://github.com/kubernetes/kubernetes/blob/858fa1a85c99c66234f67047d75e4bcf6dd35f0f/pkg/kubectl/cmd/apply.go#L350)):*\n> ```Go\n> \t\t\t{\"\", \"v1\", \"Secret\", true},\n> \t\t\t{\"\", \"v1\", \"Service\", true},\n> \t\t\t{\"batch\", \"v1\", \"Job\", true},\n> ```\n\nWhat should we do with older api versions - e.g. v1beta1 jobs?  At least add a TODO about this and file an issue.\n\n---\n\n\n*Comments from [Reviewable](https://reviewable.kubernetes.io:443/reviews/kubernetes/kubernetes/35220#-:-KVVy-uPzrTDY5DNBdcQ:b-8f3ztk)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"pwittrock"}}