Files
kubernetes/pkg/util
Kubernetes Submit Queue bda57b8fb6 Merge pull request #31353 from juanvallejo/jvallejo_fix-duplicate-errors-kubectl-set-env
Automatic merge from submit-queue

fix duplicate validation/field/errors

**Release note**:

``` release-note
release-note-none
```

Related PR: https://github.com/kubernetes/kubernetes/pull/30313

PR #30313 fixed duplicate errors for invalid aggregate errors in
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/util/helpers.go

However, duplicate aggregate errors that went through
https://github.com/kubernetes/kubernetes/blob/master/pkg/util/validation/field/errors.go
were not affected by that patch.

This patch adds duplicate aggregate error checking to
`pkg/util/validation/field/errors.go`
##### Before

`$ kubectl set env rc/idling-echo-1 test-abc=1234`

```
error: ReplicationController "idling-echo-1" is invalid:
[spec.template.spec.containers[0].env[0].name: Invalid value:
"test-abc": must be a C identifier (matching regex
[A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName",
spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc":
must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g.
"my_name" or "MyName", spec.template.spec.containers[0].env[0].name:
Invalid value: "test-abc": must be a C identifier (matching regex
[A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName",
spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc":
must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g.
"my_name" or "MyName"]
```

`$ kubectl set env rc/node-1 test-abc=1234`

```
error: ReplicationController "idling-echo-1" is invalid:
[spec.template.spec.containers[0].env[0].name: Invalid value:
"test-abc": must be a C identifier (matching regex
[A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName",
spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc":
must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g.
"my_name" or "MyName"]
```
##### After

`$ kubectl set env rc/idling-echo-1 test-abc=1234`

```
error: ReplicationController "idling-echo-1" is invalid:
[spec.template.spec.containers[0].env[0].name: Invalid value:
"test-abc": must be a C identifier (matching regex
[A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName",
spec.template.spec.containers[1].env[0].name: Invalid value: "test-abc":
must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g.
"my_name" or "MyName"]
```

`$ kubectl set env rc/node-1 test-abc=1234`

```
error: ReplicationController "node-1" is invalid:
spec.template.spec.containers[0].env[0].name: Invalid value: "test-abc":
must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g.
"my_name" or "MyName"
```
2016-12-10 14:57:43 -08:00
..
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-11-23 22:30:47 -06:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-11-23 22:30:47 -06:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-12-03 19:10:46 -05:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-12-02 18:42:25 +01:00
2016-11-23 15:53:09 -08:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-12-03 19:10:46 -05:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-11-07 09:18:07 +00:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-26 09:38:03 -04:00
2016-10-21 17:32:32 -07:00
2016-11-23 22:30:47 -06:00
2016-11-23 15:53:09 -08:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-11-04 09:31:26 -07:00
2016-12-07 10:32:47 -05:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-10-21 17:32:32 -07:00
2016-07-16 13:48:21 -04:00