Commit Graph

54 Commits (acca01bcc206004ec8227669fab3b86c7a92cb7c)

Author SHA1 Message Date
deads2k a6b655fb6a add back just enough empty packages to allow heapster cycles to succeed 2017-01-17 08:07:30 -05:00
deads2k 67fac70ea3 remove files moved to apimachinery 2017-01-17 07:46:34 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Jeff Grafton 20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
Mike Danese 161c391f44 autogenerated 2016-12-29 13:04:10 -08:00
Xing Zhou cfe1599983 Improve error message for name/label validation.
This patch added user readable naming rules to the output of
the error messages for name/label validation.
2016-12-19 02:53:26 +00:00
Kubernetes Submit Queue 0175399d49 Merge pull request #38171 from xingzhou/kube-typo
Automatic merge from submit-queue

Fixed a typo of wildcard DNS regex variable name.

Happened to see the typo while reading code, fixed the typo and refined the code.
2016-12-13 11:28:30 -08:00
Mike Danese c87de85347 autoupdate BUILD files 2016-12-12 13:30:07 -08:00
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
Derek Carr 459a7a05f1 Ability to quota storage by storage class 2016-12-09 13:26:59 -05:00
juanvallejo a7286e8afa fix duplicate validation/field/errors
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-08 09:45:52 -05:00
Xing Zhou a58a795eb8 Fixed a typo of wildcard DNS regex variable name.
Fixed a typo of wildcard DNS regex expression variable name.
2016-12-06 11:23:47 +08:00
tanshanshan c19fa9f60e use elseif to replace if 2016-11-17 17:13:17 +08:00
juanvallejo ccdbe2f79b update port validation message 2016-11-03 10:19:11 -04:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Manuel de Brito Fontes 60f4fbf4f2 Allow leading * in ingress hostname 2016-08-03 20:16:58 -04:00
Kubernetes Submit Queue 1edf254efb Merge pull request #25458 from errm/env-var-style-config-keys
Automatic merge from submit-queue

Allow Secret & ConfigMap keys to contain caps, dots, and underscores

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

Re: #23722

This makes loosens the regex used in in Secrets and ConfigMap,
in order to make environment variable style keys valid
2016-08-02 21:00:52 -07:00
Michael Fraenkel b1e7e6cf46 Service names conform to RFC 1035 2016-08-02 08:42:15 -06:00
Ed Robinson d4969ff032
Allows Secret & ConfigMap Keys to look like Environment Variables
This makes environment variable style keys (uppercase with underscores) valid
in Secrets and ConfigMap.
2016-08-01 20:56:40 +01:00
Tim Hockin 493b3fab65 Unexport DNS regexps, lengths are still used 2016-07-03 02:20:11 -07:00
Tim Hockin 766f44f715 Move IsSecretKey into util/validation 2016-07-03 02:19:09 -07:00
Tim Hockin 37786e0e77 Make IsHTTPHeaderName return error strings 2016-07-02 17:34:32 -07:00
Tim Hockin 3ad6c397d7 Make IsValid{User,Group}Id return error strings 2016-07-02 17:34:32 -07:00
Tim Hockin bb208a02b3 Make IsValidPercent return error strings 2016-07-02 17:34:32 -07:00
Tim Hockin 87c1fc50a8 Make IsValidIP return error strings
Also treat 0.0.0.0 as special, like loopback and multicast.
2016-07-02 17:32:05 -07:00
Tim Hockin 14bece550f Make IsValidPortNum/Name return error strings 2016-07-02 17:32:05 -07:00
Tim Hockin 189d4a5159 Make CIdentifier return error strings 2016-07-02 17:32:05 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Tim Hockin 54a3efb364 Make IsDNS952Label return error strings 2016-05-19 08:57:49 -07:00
Tim Hockin 5862a60ae7 Make IsDNS1123Subdomain return error strings 2016-05-19 08:57:49 -07:00
Tim Hockin 77eff06a53 Make IsDNS1123Label return error strings 2016-05-19 08:57:49 -07:00
Tim Hockin 66d0d87829 Make IsValidLabelValue return error strings 2016-05-17 21:36:10 -07:00
Tim Hockin 72955770f3 Make IsQualifiedName return error strings 2016-05-10 11:23:23 -07:00
André Martins c1a360b1d5 Removing IPv4 enforcement on Endpoints
Signed-off-by: André Martins <aanm90@gmail.com>
2016-04-14 16:20:00 +01:00
Tim Hockin 7cab7bd472 fix a few go-vet errors 2016-02-09 13:20:31 -08:00
Rudi Chiarito a2d1bb7acf Add httpHeaders to httpGet liveness probe
Also update existing documentation and try to steer users away from 'host'.
Add validation.
2016-02-05 11:20:04 -05:00
mdshuai 27934da9cc Validate uids and gids for securitycontext 2016-01-11 15:17:25 +08:00
Tim Hockin 0fecf965b4 Change how one-of blocks are validated
I took a hard look at error output and played until I was happier.  This now
prints JSON for structs in the error, rather than go's format.

Also made the error message easier to read.

Fixed tests.
2015-12-18 09:42:14 -08:00
Tim Hockin 43ed74748e Clean up and document validation strings
Also add a detail string for Required and Forbidden.  Fix tests.
2015-12-18 09:40:50 -08:00
Tim Hockin 7fb8f60735 Shorten names for better reading 2015-12-10 11:48:19 -08:00
Tim Hockin 87a35047dd Move FieldPath and errors to a sub-package
This makes the naming and reading a lot simpler.
2015-12-10 11:48:16 -08:00
Tim Hockin 0fe29232eb Remove obsolete ErrorList Prefix logic 2015-12-03 08:19:52 -08:00
Tim Hockin e6df0b1a24 Convert validation to use FieldPath
Before this change we have a mish-mash of ways to pass field names around for
error generation.  Sometimes string fieldnames, sometimes .Prefix(), sometimes
neither, often wrong names or not indexed when it should be.

Instead of that mess, this is part one of a couple of commits that will make it
more strongly typed and hopefully encourage correct behavior.  At least you
will have to think about field names, which is better than nothing.

It turned out to be really hard to do this incrementally.
2015-12-03 08:19:44 -08:00
Tim Hockin 102eced0b1 Introduce a FieldPath type for validation 2015-12-03 08:17:02 -08:00
Tim Hockin ceee678b29 Rename validation 'New' funcs 2015-11-23 10:01:43 -08:00
Tim Hockin 682f2a5a79 Stronger typing for validation ErrorList 2015-11-23 10:01:43 -08:00
Tim Hockin f8ad75df44 Clarify invalid vs not-supported 2015-11-23 08:07:17 -08:00
Tim Hockin 2c60a97e72 Clean up comments, reorder types 2015-11-23 08:07:17 -08:00
Tim Hockin bca3780b7f Remove unused matcher 2015-11-22 20:13:24 -08:00
Tim Hockin 48b49a5cae s/ValidationErrorList/ErrorList/ 2015-11-22 20:13:20 -08:00