mirror of https://github.com/k3s-io/k3s
![]() 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`. ``` |
||
---|---|---|
.. | ||
editor | ||
env | ||
jsonmerge | ||
openapi | ||
sanity | ||
BUILD | ||
cached_discovery.go | ||
cached_discovery_test.go | ||
clientcache.go | ||
factory.go | ||
factory_builder.go | ||
factory_client_access.go | ||
factory_object_mapping.go | ||
factory_object_mapping_test.go | ||
factory_test.go | ||
helpers.go | ||
helpers_test.go | ||
printing.go | ||
shortcut_restmapper.go | ||
shortcut_restmapper_test.go |