Files
kubernetes/pkg/kubectl/cmd
Kubernetes Submit Queue a13dee2337 Merge pull request #60990 from bmcstdio/bcustodio/kubectl-edit
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Ensure reasons end up as comments in kubectl edit.

**What this PR does / why we need it**:

This PR helps making sure that all text in the header of the file is prefixed with `#` when using `kubectl edit` to fix schema validation errors. The problem is best described with an example:

*Before:*

```yaml
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# mycrd "example-cr" was not valid:
# * []: Invalid value: map[string]interface {}{"apiVersion":"example.com/v1alpha1", "kind":"MyCRD", "metadata":map[string]interface {}{"clusterName":"", "creationTimestamp":"2018-03-09T16:16:41Z", "name":"example-cr", "namespace":"default", "resourceVersion":"12399", "selfLink":"", "uid":"4089f5bd-23b5-11e8-a33f-42010aa40081", "generation":0}, "spec":map[string]interface {}{"size":-1}}: validation failure list:
spec.size in body should be greater than or equal to 1
#
apiVersion: example.com/v1alpha1
kind: MyCRD
```

This obviously won't be accepted as input, the user having to manually add a `#` to the line in the header.

*After:*

```yaml
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# mycrd "example-cr" was not valid:
# * []: Invalid value: map[string]interface {}{"apiVersion":"example.com/v1alpha1", "kind":"MyCRD", "metadata":map[string]interface {}{"clusterName":"", "creationTimestamp":"2018-03-09T16:16:41Z", "name":"example-cr", "namespace":"default", "resourceVersion":"12399", "selfLink":"", "uid":"4089f5bd-23b5-11e8-a33f-42010aa40081", "generation":0}, "spec":map[string]interface {}{"size":-1}}: validation failure list:
# spec.size in body should be greater than or equal to 1
#
apiVersion: example.com/v1alpha1
kind: MyCRD
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
(None that I am aware of)

**Special notes for your reviewer**:
(None)

**Release note**:

```release-note
Ensure reasons end up as comments in `kubectl edit`.
```
2018-03-30 11:23:29 -07:00
..
2017-10-15 18:18:13 -07:00
2018-02-21 08:15:22 -05:00
2017-08-16 12:27:36 -07:00
2018-03-26 19:33:42 +02:00
2018-02-21 08:15:22 -05:00
2018-01-05 21:04:44 -06:00
2018-03-13 16:21:30 -04:00
2017-12-25 16:23:38 +08:00
2017-12-25 16:23:38 +08:00
2017-12-25 16:23:38 +08:00
2017-12-25 16:23:38 +08:00
2017-12-25 16:23:38 +08:00
2017-12-25 16:23:38 +08:00
2018-03-26 15:40:40 +08:00
2018-03-01 16:10:04 +08:00
2018-03-17 15:08:26 +08:00
2018-01-25 16:10:31 +01:00
2017-12-25 16:23:38 +08:00
2017-08-16 12:27:36 -07:00
2017-12-25 16:23:38 +08:00
2017-12-25 16:23:38 +08:00
2017-08-16 12:27:36 -07:00