{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/26722","repository_url":"https://api.github.com/repos/kubernetes/kubernetes","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/26722/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/26722/comments","events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/26722/events","html_url":"https://github.com/kubernetes/kubernetes/pull/26722","id":158201768,"number":26722,"title":"[POC] let patch use local file content to mutate","user":{"login":"deads2k","id":8225098,"avatar_url":"https://avatars.githubusercontent.com/u/8225098?v=3","gravatar_id":"","url":"https://api.github.com/users/deads2k","html_url":"https://github.com/deads2k","followers_url":"https://api.github.com/users/deads2k/followers","following_url":"https://api.github.com/users/deads2k/following{/other_user}","gists_url":"https://api.github.com/users/deads2k/gists{/gist_id}","starred_url":"https://api.github.com/users/deads2k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deads2k/subscriptions","organizations_url":"https://api.github.com/users/deads2k/orgs","repos_url":"https://api.github.com/users/deads2k/repos","events_url":"https://api.github.com/users/deads2k/events{/privacy}","received_events_url":"https://api.github.com/users/deads2k/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/cla:%20yes","name":"cla: yes","color":"bfe5bf"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/release-note-label-needed","name":"release-note-label-needed","color":"db5a64"},{"url":"https://api.github.com/repos/kubernetes/kubernetes/labels/size/L","name":"size/L","color":"ee9900"}],"state":"open","locked":false,"assignee":{"login":"janetkuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/janetkuo","html_url":"https://github.com/janetkuo","followers_url":"https://api.github.com/users/janetkuo/followers","following_url":"https://api.github.com/users/janetkuo/following{/other_user}","gists_url":"https://api.github.com/users/janetkuo/gists{/gist_id}","starred_url":"https://api.github.com/users/janetkuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janetkuo/subscriptions","organizations_url":"https://api.github.com/users/janetkuo/orgs","repos_url":"https://api.github.com/users/janetkuo/repos","events_url":"https://api.github.com/users/janetkuo/events{/privacy}","received_events_url":"https://api.github.com/users/janetkuo/received_events","type":"User","site_admin":false},"milestone":null,"comments":15,"created_at":"2016-06-02T17:57:01Z","updated_at":"2016-06-03T19:11:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/26722","html_url":"https://github.com/kubernetes/kubernetes/pull/26722","diff_url":"https://github.com/kubernetes/kubernetes/pull/26722.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/26722.patch"},"body":"Adds the concept of a `--local-file` flag to `kubectl patch`.  This flag is different from `-f` because it will use the content of the file as the input to the patch operation instead of using the file content to file resource/name tuples.  \r\n\r\nThis pull lets you run something like `kubectl create deployment --dry-run -o yaml | kubectl set volume --localfile - -o yaml | kubectl patch --local-file - --patch {} | kubectl create -f -`\r\n\r\nAs proof that it works, you can run against a local file just to mess around with it, but `--local-file -` is the most likely case.\r\n```\r\n$kubectl patch --local-file pkg/api/validation/testdata/v1/validPod.yaml --patch='{\"spec\": {\"restartPolicy\":\"Never\"}}'\r\napiVersion: v1\r\nkind: Pod\r\nmetadata:\r\n  creationTimestamp: null\r\n  labels:\r\n    name: redis-master\r\n  name: name\r\nspec:\r\n  containers:\r\n  - args:\r\n    - this\r\n    - is\r\n    - an\r\n    - ok\r\n    - command\r\n    image: gcr.io/fake_project/fake_image:fake_tag\r\n    name: master\r\n    resources: {}\r\n  restartPolicy: Never\r\nstatus: {}\r\n```\r\n\r\nThis is useful for setting rarely used, but immutable fields from `kubectl create` or `kubectl convert` without dropping to an interactive editor.\r\n\r\nSome discussion here: https://github.com/kubernetes/kubernetes/issues/21648#issuecomment-218579977\r\n\r\n@smarterclayton @kubernetes/kubectl \r\n @eparis @soltysh @stevekuznetsov we've talked about this separately "},"comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments/223667465","html_url":"https://github.com/kubernetes/kubernetes/pull/26722#issuecomment-223667465","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/26722","id":223667465,"user":{"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},"created_at":"2016-06-03T19:11:08Z","updated_at":"2016-06-03T19:11:08Z","body":"I also agree that a templating system has significant benefits. Templates can be versioned & upgraded, and I expect them to be much more readable and maintainable than imperative chains of kubectl calls. Basically the | chain looks like a big anti pattern to me, I'd be very unhappy to inherit an application deployment that was created that way."}}
{"actor":{"display_login":"lavalamp"}}