k3s/pkg/kubectl
Kubernetes Submit Queue d97c759110 Merge pull request #53587 from spzala/master
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>.

Provide aggregated validation errors for version and kind

Currently the validation checks is done individually for version and
kind group. For example, if user provided yaml file is missing apiVersion
and kind fields, first they will receive error on apiVersion. Once user
update the file and try to recreate, an error on missing kind is displayed.
The behavior is same for wrong types of the fields.
These errors should be aggregated and displayed.

Examples of current validation:
1
test.yaml is missing apiVersion and kind:
$kubectl.sh create -f /home/sahdev/go/src/bugfixes/test.yaml
error: error validating "/home/sahdev/go/src/bugfixes/test.yaml": error validating data: apiVersion not set; if you choose to ignore these errors, turn validation off with --validate=false
2.
test.yaml is fixed for apiVersion but missing kind:
$kubectl.sh create -f /home/sahdev/go/src/bugfixes/test.yaml
error: error validating "/home/sahdev/go/src/bugfixes/test.yaml": error validating data: kind not set; if you choose to ignore these errors, turn validation off with --validate=false

Examples with aggregated validation: 
1.
error: error validating "/home/sahdev/go/src/bugfixes/test.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
2.
error: error validating "/home/sahdev/go/src/bugfixes/testmix.yaml": error validating data: [apiVersion isn't string type, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false



**What this PR does / why we need it**:
To provide aggregated validations to user for version and kind group.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #54098

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-17 16:35:39 -07:00
..
apply Merge pull request #53919 from apelisse/fix-new-apply-crash 2017-10-16 10:58:30 -07:00
apps update BUILD files 2017-10-15 18:18:13 -07:00
cmd Merge pull request #53587 from spzala/master 2017-10-17 16:35:39 -07:00
explain update BUILD files 2017-10-15 18:18:13 -07:00
metricsutil update BUILD files 2017-10-15 18:18:13 -07:00
plugins update BUILD files 2017-10-15 18:18:13 -07:00
proxy update BUILD files 2017-10-15 18:18:13 -07:00
resource Merge pull request #53861 from pwittrock/resource-validation-deps 2017-10-16 14:47:28 -07:00
testing update BUILD files 2017-10-15 18:18:13 -07:00
util update BUILD files 2017-10-15 18:18:13 -07:00
validation update BUILD files 2017-10-15 18:18:13 -07:00
BUILD update BUILD files 2017-10-15 18:18:13 -07:00
OWNERS
apply.go
autoscale.go add ut for pkg/kubectl/autoscale_test.go 2017-09-14 09:15:44 +08:00
autoscale_test.go add ut for pkg/kubectl/autoscale_test.go 2017-09-14 09:15:44 +08:00
bash_comp_utils.go
cluster.go
cluster_test.go
clusterrolebinding.go add UT for pkg/kubecl clusterrolebinding 2017-08-28 15:13:15 +08:00
clusterrolebinding_test.go add UT for pkg/kubecl clusterrolebinding 2017-08-28 15:13:15 +08:00
configmap.go kubectl: Move utility functions to util package 2017-09-04 20:14:16 +10:00
configmap_test.go Add --append-hash flag to kubectl create configmap/secret 2017-08-28 14:17:47 -07:00
delete.go fix missing apps/replicaset in kubectl 2017-09-26 10:54:04 -07:00
delete_test.go kubectl: simplify deepcopy calls 2017-08-16 10:58:51 +02:00
deployment.go
deployment_test.go add ut for pkg/kubectl/deployment.go 2017-08-22 11:10:21 +08:00
doc.go
env_file.go
env_file_test.go
generate.go
generate_test.go
history.go Simplify describe events table 2017-08-31 19:11:01 -04:00
interfaces.go
kubectl.go kubectl: Move utility functions to util package 2017-09-04 20:14:16 +10:00
namespace.go
namespace_test.go
pdb.go
quota.go
quota_test.go
resource_filter.go
resource_filter_test.go
rolebinding.go
rolebinding_test.go
rollback.go statefulSet kubectl rollout command 2017-08-24 16:43:03 -07:00
rolling_updater.go kubectl: Move utility functions to util package 2017-09-04 20:14:16 +10:00
rolling_updater_test.go
rollout_status.go kubectl: Clean up documentation for rollout_status.go 2017-08-30 17:25:42 +10:00
rollout_status_test.go
run.go Enable batch/v1beta1.CronJobs by default 2017-09-03 11:17:33 +02:00
run_test.go Enable batch/v1beta1.CronJobs by default 2017-09-03 11:17:33 +02:00
scale.go fix missing apps/replicaset in kubectl 2017-09-26 10:54:04 -07:00
scale_test.go
secret.go kubectl: Move utility functions to util package 2017-09-04 20:14:16 +10:00
secret_for_docker_registry.go Add --append-hash flag to kubectl create configmap/secret 2017-08-28 14:17:47 -07:00
secret_for_docker_registry_test.go Add --append-hash flag to kubectl create configmap/secret 2017-08-28 14:17:47 -07:00
secret_for_tls.go kubectl: Remove ending punctuation from error strings 2017-08-30 20:33:22 +10:00
secret_for_tls_test.go Add --append-hash flag to kubectl create configmap/secret 2017-08-28 14:17:47 -07:00
secret_test.go Add --append-hash flag to kubectl create configmap/secret 2017-08-28 14:17:47 -07:00
service.go
service_basic.go
service_basic_test.go
service_test.go
serviceaccount.go
serviceaccount_test.go
sorting_printer.go Make metav1.(Micro)?Time functions take pointers 2017-08-17 11:24:28 +02:00
sorting_printer_test.go
versioned_client.go