diff --git a/docs/man/man1/kubectl-patch.1 b/docs/man/man1/kubectl-patch.1 index bb7bc024f61..acd2a370d8e 100644 --- a/docs/man/man1/kubectl-patch.1 +++ b/docs/man/man1/kubectl-patch.1 @@ -18,6 +18,10 @@ Update field(s) of a resource using strategic merge patch .PP JSON and YAML formats are accepted. +.PP +Please refer to the models in +\[la]https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html\[ra] to find if a field is mutable. + .SH OPTIONS .PP @@ -140,6 +144,9 @@ JSON and YAML formats are accepted. // Partially update a node using strategic merge patch kubectl patch node k8s\-node\-1 \-p '{"spec":{"unschedulable":true}}' +// Update a container's image; spec.containers[*].name is required because it's a merge key +kubectl patch pod valid\-pod \-p '{"spec":{"containers":[{"name":"kubernetes\-serve\-hostname","image":"new image"}]}}' + .fi .RE diff --git a/docs/man/man1/kubectl-replace.1 b/docs/man/man1/kubectl-replace.1 index 9825fd6efd6..51dfb25fcff 100644 --- a/docs/man/man1/kubectl-replace.1 +++ b/docs/man/man1/kubectl-replace.1 @@ -18,6 +18,10 @@ Replace a resource by filename or stdin. .PP JSON and YAML formats are accepted. +.PP +Please refer to the models in +\[la]https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html\[ra] to find if a field is mutable. + .SH OPTIONS .PP diff --git a/docs/user-guide/kubectl/kubectl_patch.md b/docs/user-guide/kubectl/kubectl_patch.md index 36f6bd48cb2..4369bd0ddff 100644 --- a/docs/user-guide/kubectl/kubectl_patch.md +++ b/docs/user-guide/kubectl/kubectl_patch.md @@ -42,6 +42,8 @@ Update field(s) of a resource using strategic merge patch JSON and YAML formats are accepted. +Please refer to the models in https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable. + ``` kubectl patch RESOURCE NAME -p PATCH ``` @@ -52,6 +54,9 @@ kubectl patch RESOURCE NAME -p PATCH // Partially update a node using strategic merge patch kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' + +// Update a container's image; spec.containers[*].name is required because it's a merge key +kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}' ``` ### Options @@ -95,7 +100,7 @@ kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-14 00:11:42.956026887 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-01 00:12:16.314479678 +0000 UTC diff --git a/docs/user-guide/kubectl/kubectl_replace.md b/docs/user-guide/kubectl/kubectl_replace.md index 296aff64cc5..9cf6d0a799c 100644 --- a/docs/user-guide/kubectl/kubectl_replace.md +++ b/docs/user-guide/kubectl/kubectl_replace.md @@ -42,6 +42,8 @@ Replace a resource by filename or stdin. JSON and YAML formats are accepted. +Please refer to the models in https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable. + ``` kubectl replace -f FILENAME ``` @@ -104,7 +106,7 @@ kubectl replace --force -f ./pod.json * [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager -###### Auto generated by spf13/cobra at 2015-07-16 22:39:16.132838722 +0000 UTC +###### Auto generated by spf13/cobra at 2015-08-01 00:12:16.314376117 +0000 UTC diff --git a/pkg/kubectl/cmd/patch.go b/pkg/kubectl/cmd/patch.go index 490b3481118..d038d74dae4 100644 --- a/pkg/kubectl/cmd/patch.go +++ b/pkg/kubectl/cmd/patch.go @@ -29,10 +29,15 @@ import ( const ( patch_long = `Update field(s) of a resource using strategic merge patch -JSON and YAML formats are accepted.` +JSON and YAML formats are accepted. + +Please refer to the models in https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable.` patch_example = ` // Partially update a node using strategic merge patch -kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'` +kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}' + +// Update a container's image; spec.containers[*].name is required because it's a merge key +kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'` ) func NewCmdPatch(f *cmdutil.Factory, out io.Writer) *cobra.Command { diff --git a/pkg/kubectl/cmd/replace.go b/pkg/kubectl/cmd/replace.go index d82637663f2..94c575634e1 100644 --- a/pkg/kubectl/cmd/replace.go +++ b/pkg/kubectl/cmd/replace.go @@ -35,7 +35,9 @@ import ( const ( replace_long = `Replace a resource by filename or stdin. -JSON and YAML formats are accepted.` +JSON and YAML formats are accepted. + +Please refer to the models in https://htmlpreview.github.io/?https://github.com/GoogleCloudPlatform/kubernetes/HEAD/docs/api-reference/definitions.html to find if a field is mutable.` replace_example = `// Replace a pod using the data in pod.json. $ kubectl replace -f ./pod.json