kubernetes/pkg/api/validation
Kubernetes Submit Queue 59b1f4a12e Merge pull request #39473 from php-coder/improve_err_msg_about_privileged
Automatic merge from submit-queue (batch tested with PRs 39394, 38270, 39473, 39516, 36243)

Improve an error message when privileged containers are disallowed on the cluster

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

At present when user creates privileged pod and creation of privileged containers disallowed globally by a system administrator (kubelet and api-server were running with `--allow-privileged=false`), user will get the following error message:
```console
$ kubectl create -f nginx.pod 
The Pod "nginx" is invalid: spec.containers[0].securityContext.privileged: Forbidden: disallowed by policy
```
"Disallowed by policy" may give a wrong assumption to a user that creation of privileged containers disallowed by [`PodSecurityPolicy`](http://kubernetes.io/docs/user-guide/pod-security-policy/) while it's not.

This commit improves error message and tries to point user to the right direction:
```console
$ kubectl create -f nginx.pod 
The Pod "nginx" is invalid: spec.containers[0].securityContext.privileged: Forbidden: privileged containers are disallowed on this cluster by a system administrator
```

**Release note**:

```release-note
NONE
```

PTAL @pweil-
2017-01-09 12:05:21 -08:00
..
genericvalidation Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
path Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
testdata/v1 Check for an empty value in validateField 2016-05-30 14:12:18 +10:00
BUILD Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
events_test.go Validate involvedObject.Namespace matches event.Namespace 2016-08-16 21:18:52 -04:00
events.go generated: refactor 2016-11-23 22:30:47 -06:00
OWNERS Update OWNERS approvers and reviewers: pkg/api 2016-11-09 10:18:08 -08:00
schema_test.go Fix tests using internal types for serialization 2016-12-09 16:26:05 -05:00
schema.go Switch to use pkg/apis/meta/v1/unstructured and the new interfaces 2016-12-10 18:05:28 -05:00
validation_test.go Merge pull request #39473 from php-coder/improve_err_msg_about_privileged 2017-01-09 12:05:21 -08:00
validation.go Merge pull request #39473 from php-coder/improve_err_msg_about_privileged 2017-01-09 12:05:21 -08:00