Commit Graph

780 Commits (e4106e305a41411146e1d5b05c5477081a424024)

Author SHA1 Message Date
Kubernetes Submit Queue b7559ad4c5 Merge pull request #37934 from xilabao/improve-the-result-of-checking-role-name
Automatic merge from submit-queue (batch tested with PRs 38527, 37934)

improve the result of checking role name

Get all error messages before return.
2016-12-11 21:08:01 -08:00
xilabao ce2085594e improve the result of checking role name 2016-12-12 11:44:16 +08:00
Clayton Coleman c52d510a24
refactor: generated 2016-12-10 18:05:53 -05:00
Clayton Coleman 3c72ee2189
Change references to OwnerReference 2016-12-10 18:05:36 -05:00
Clayton Coleman 42d410fdde
Switch to use pkg/apis/meta/v1/unstructured and the new interfaces
Avoid directly accessing an unstructured type if it is not required.
2016-12-10 18:05:28 -05:00
Jordan Liggitt 4536388909
Update bazel 2016-12-09 16:26:06 -05:00
Jordan Liggitt cc7a44f545
Fix tests using internal types for serialization 2016-12-09 16:26:05 -05:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Kubernetes Submit Queue 1b2a4b55bb Merge pull request #36251 from screeley44/k8-immutable-scannotation
Automatic merge from submit-queue

Make pvc storage class annotation immutable after create

Fixes #34516

Added immutable check in validation.go

```
# 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.
#
# persistentvolumeclaims "gce-claim-storageclass" was not valid:
# * metadata.annotations.volume.beta.kubernetes.io/storage-class: Invalid value: "slow2": field is immutable
#

```
2016-12-02 18:42:32 -08:00
Minhan Xia 1c2c0c1f63 support service loadBalancerSourceRange update 2016-11-30 15:27:34 -08:00
Scott Creeley a76854ca97 Make pvc storage class annotation immutable after create 2016-11-29 16:45:00 -05:00
Kubernetes Submit Queue 48ae0807cb Merge pull request #36449 from luksa/env.valueFrom
Automatic merge from submit-queue

Improved validation error message when env.valueFrom contains no (or …

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**:
A misleading error message is shown if the user mistypes (or forgets to specify) a field under env.valueFrom. This is the error message: "may not have more than one field specified at a time". But there is only one (misspelled) field specified.


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

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```
Improved error message for missing/misspelled field under env.valueFrom
```
2016-11-29 07:32:27 -08:00
Kubernetes Submit Queue 9b2d17608e Merge pull request #36525 from apelisse/owners-pkg-api
Automatic merge from submit-queue

Curating Owners: pkg/api

cc @lavalamp @smarterclayton @erictune @thockin @bgrant0607

In an effort to expand the existing pool of reviewers and establish a
two-tiered review process (first someone lgtms and then someone
experienced in the project approves), we are adding new reviewers to
existing owners files.


If You Care About the Process:
------------------------------

We did this by algorithmically figuring out who’s contributed code to
the project and in what directories.  Unfortunately, that doesn’t work
well: people that have made mechanical code changes (e.g change the
copyright header across all directories) end up as reviewers in lots of
places.

Instead of using pure commit data, we generated an excessively large
list of reviewers and pruned based on all time commit data, recent
commit data and review data (number of PRs commented on).

At this point we have a decent list of reviewers, but it needs one last
pass for fine tuning.

Also, see https://github.com/kubernetes/contrib/issues/1389.

TLDR:
-----

As an owner of a sig/directory and a leader of the project, here’s what
we need from you:

1. Use PR https://github.com/kubernetes/kubernetes/pull/35715 as an example.

2. The pull-request is made editable, please edit the `OWNERS` file to
remove the names of people that shouldn't be reviewing code in the
future in the **reviewers** section. You probably do NOT need to modify
the **approvers** section. Names asre sorted by relevance, using some
secret statistics.

3. Notify me if you want some OWNERS file to be removed.  Being an
approver or reviewer of a parent directory makes you a reviewer/approver
of the subdirectories too, so not all OWNERS files may be necessary.

4. Please use ALIAS if you want to use the same list of people over and
over again (don't hesitate to ask me for help, or use the pull-request
above as an example)
2016-11-28 11:44:04 -08:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Brendan Burns e68fe4d62e Remove 'minion' from the code in two places in favor of 'node' 2016-11-21 22:48:06 -08:00
Marko Luksa 389478f312 Improved validation error message when env.valueFrom contains no (or misspelled) ref 2016-11-15 10:36:34 +01:00
Marko Luksa d8ec7181b4 Improved validation error message when env.valueFrom contains no (or misspelled) ref 2016-11-15 10:08:47 +01:00
Zihong Zheng 924432f2dc Allows user to change service type when sourceRanges is declared 2016-11-14 18:24:02 -08:00
Antoine Pelisse 5e26788aba Update OWNERS approvers and reviewers: pkg/api 2016-11-09 10:18:08 -08:00
Kubernetes Submit Queue 73e497fb44 Merge pull request #35437 from markturansky/loosen_pvc_limit_range_validation
Automatic merge from submit-queue

Loosened validation on PVC LimitRanger

This PR loosens validation on PVC LimitRanger so that either Min or Max are required, but not both.

Per @derekwaynecarr  https://github.com/openshift/origin/pull/11396#discussion_r84533061
2016-11-09 02:01:52 -08:00
Miao Luo b22ccc6780 Support persistent volume on Photon Controller platform
1. Enable Photon Controller as cloud provider
2. Support Photon persistent disk as volume source/persistent volume
source
2016-11-08 09:36:16 -08:00
Paulo Pires 6daab26280
Volume mount with colon in path is now allowed because it's how it works on Windows. 2016-11-01 17:45:08 -04:00
Jitendra Bhurat 66a1ef25e0
Fixing Volumes on Windows 2016-11-01 15:48:37 -04:00
Connor Doyle c93646e8da Support opaque integer resource accounting.
- Prevents kubelet from overwriting capacity during sync.
- Handles opaque integer resources in the scheduler.
  - Adds scheduler predicate tests for opaque resources.
- Validates opaque int resources:
  - Ensures supplied opaque int quantities in node capacity,
    node allocatable, pod request and pod limit are integers.
  - Adds tests for new validation logic (node update and pod spec).
- Added e2e tests for opaque integer resources.
2016-10-28 10:15:13 -07:00
markturansky a3f4d8a506 loosened validation on pvc limitranger 2016-10-24 11:01:18 -04:00
Mike Danese df713b478c fix tests by declaring testdata 2016-10-21 17:32:32 -07:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Maciej Kwiek d1c32b8194 Test cases for service ClusterIP updates
Test cases from ClusterIP using types to other ClusterIP using types
(ClusterIP, NodePort, LoadBalancer) added.
2016-10-21 13:11:57 +02:00
Maciej Kwiek 7df1afe71f Deny ClusterIP update for services using it
If the service is of the type using the ClusterIP (ClusterIP, NodePort,
LoadBalancer), the update of ClusterIP is prohibited.
2016-10-21 09:53:39 +02:00
Kubernetes Submit Queue e6b5b076b8 Merge pull request #33957 from bprashanth/esipp-beta
Automatic merge from submit-queue

Loadbalanced client src ip preservation enters beta

Sounds like we're going to try out the proposal (https://github.com/kubernetes/kubernetes/issues/30819#issuecomment-249877334) for annotations -> fields on just one feature in 1.5 (scheduler). Or do we want to just convert to fields right now?
2016-10-20 06:53:07 -07:00
Kubernetes Submit Queue 41c9bbcc02 Merge pull request #34514 from derekwaynecarr/validation-fixes
Automatic merge from submit-queue

requests.storage is a standard resource name

The value `requests.storage` is a valid standard resource name but was omitted from the standard list.
2016-10-19 21:16:35 -07:00
bprashanth 5029bb06e9 Validation 2016-10-19 14:51:57 -07:00
Kubernetes Submit Queue 2de1f5c07e Merge pull request #34407 from brendandburns/kubectl-schema
Automatic merge from submit-queue

Add validation that detects repeated keys in the labels and annotations maps

Fixes #2965  (a nearly 2 year old feature request!)

@kubernetes/kubectl 

@eparis
2016-10-19 14:01:00 -07:00
derekwaynecarr d5c45e8892 requests.storage is a standard resource name 2016-10-19 15:54:08 -04:00
pweil- 49e14744db support seccomp in psp 2016-10-17 14:49:02 -04:00
Kubernetes Submit Queue fd52ae5215 Merge pull request #31903 from screeley44/k8-validation-test
Automatic merge from submit-queue

Add unit test for bad ReclaimPolicy and valid ReclaimPolicy in /pkg/api/validation

unit tests for validation.go regarding PersistentVolumeReclaimPolicy (bad value and good value)

see PR: #30304
2016-10-15 11:36:07 -07:00
Brendan Burns d9d06f6680 Add some checking for the presence of the same key twice. 2016-10-13 21:58:44 -07:00
Kubernetes Submit Queue a0d4878ea9 Merge pull request #30145 from markturansky/limit_range_pvc
Automatic merge from submit-queue

Add PVC storage to LimitRange

This PR adds the ability to add a LimitRange to a namespace that enforces min/max on `pvc.Spec.Resources.Requests["storage"]`.

@derekwaynecarr @abhgupta @kubernetes/sig-storage 

Examples forthcoming. 

```release-note
pvc.Spec.Resources.Requests min and max can be enforced with a LimitRange of type "PersistentVolumeClaim" in the namespace
```
2016-10-12 20:26:59 -07:00
deads2k 518d5500c7 remove testapi.Default.GroupVersion 2016-10-07 10:10:54 -04:00
markturansky 0d40104c1d add pvc storage to LimitRange 2016-10-05 17:31:15 -04:00
Maciej Kwiek 9e1c886a80 Validate None Service ClusterIP against LB type
If the Service is a Load Balancer, it should not have None Cluster IP.
If it does, Service validation fails.
2016-09-29 10:17:29 +02:00
Michail Kargakis f7c232b8c6 extensions: add minReadySeconds/availableReplicas to replica sets 2016-09-28 11:06:40 +02:00
Christian Simon 1c11047ffb Adds datasetUUID for referencing flocker datasets
* flocker datasets should be attached using an unique identifier. This
  is not the case for the name metadata used by datasetName
* allow only one of datasetUUID / datasetName specified
2016-09-27 13:19:22 +00:00
Minhan Xia ba45a3f74e disallow user to update loadbalancerSourceRanges 2016-09-22 19:04:02 -07:00
Chao Xu c5e1decc13 add validation rule to prevent adding finalizers if the object is being deleted 2016-09-09 15:29:08 -07:00
Kubernetes Submit Queue 9f58a867e1 Merge pull request #31522 from krousey/path_validation
Automatic merge from submit-queue

Split path validation into a separate library

This PR splits path segment validation into it's own package. This cuts off one of the restclient's dependency paths to some docker packages, and completely eliminates its dependency on go-restful swagger validation.


cc @kubernetes/sig-api-machinery
2016-09-07 10:14:32 -07:00
Ivan Shvedunov 1c9ee74987 Allow IP addresses to be used as node names
Fixes #32050
2016-09-05 02:37:00 +03:00
Scott Creeley bab6b5a66e Add unit test for bad ReclaimPolicy and valid ReclaimPolicy in /pkg/api/validation_test.go 2016-09-01 15:12:13 -04:00
Girish Kalele db95798b39 Enforce EndpointAddress.NodeName validation + added unit tests 2016-08-30 13:40:19 -07:00
Jedrzej Nowak a6c0e23fd2 Fix various typos in pkg/api 2016-08-29 11:31:16 +02:00
Kubernetes Submit Queue cefc4c3027 Merge pull request #31473 from timstclair/aa-gate
Automatic merge from submit-queue

Add AppArmor feature gate

Add option to disable AppArmor via a feature gate. This PR treats AppArmor as Beta, and thus depends on https://github.com/kubernetes/kubernetes/pull/31471 (I will remove `do-not-merge` once that merges).

Note that disabling AppArmor means that pods with AppArmor annotations will be rejected in validation. It does not mean that the components act as though AppArmor was never implemented. This is by design, because we want to make it difficult to accidentally run a Pod with an AppArmor annotation without AppArmor protection.

/cc @dchen1107
2016-08-26 21:04:42 -07:00
Kubernetes Submit Queue 8e93fec7fa Merge pull request #31146 from pmorie/recycle-hostpath-slash
Automatic merge from submit-queue

Add validation preventing recycle of / in a hostPath PV

Adds a validation that prevents a user from recycling `/` when it is used in a hostPath PV

cc @kubernetes/sig-storage
2016-08-26 18:09:32 -07:00
Kubernetes Submit Queue 4dc5d44879 Merge pull request #30304 from screeley44/k8-validate-pv
Automatic merge from submit-queue

add validation for PV spec to ensure correct values are used for ReclaimPolicy on initial create

k8 currently allows invalid values for ReclaimPolicy (i.e. "scotto") - this allows the PV to be created and even bound, however, when the pvc or pod is deleted and the recycler is triggered, an error is thrown

```
Events:
  FirstSeen	LastSeen	Count	From				SubobjectPath	Type		Reason				Message
  ---------	--------	-----	----				-------------	--------	------				-------
  36s		36s		1	{persistentvolume-controller }			Warning		VolumeUnknownReclaimPolicy	Volume has unrecognized PersistentVolumeReclaimPolicy
```

New behavior will not allow the user to create the PV:

```
[root@k8dev nfs]# kubectl create -f nfs-pv-bad.yaml 
The PersistentVolume "pv-gce" is invalid: spec.persistentVolumeReclaimPolicy: Unsupported value: "scotto": supported values: Delete, Recycle, Retain
```
2016-08-26 16:24:25 -07:00
Kris e87edf9bd5 Split path validation into a separate library 2016-08-26 08:05:20 -07:00
Tim St. Clair 9bde6f0770
Add AppArmor feature gate 2016-08-25 17:40:18 -07:00
Dominika Hodovska bea189e9c9 Add sysctl api, validation & Docker support 2016-08-25 13:22:01 +02:00
Scott Creeley 9e078d7393 add validation for PV spec to ensure correct values are used for ReclaimPolicy 2016-08-24 12:18:22 -04:00
Huamin Chen dea4b0226d support Azure data disk volume
Signed-off-by: Huamin Chen <hchen@redhat.com>
2016-08-23 13:23:07 +00:00
jianhuiz 7be20b0dac add ClusterName field to ObjectMeta 2016-08-22 21:09:57 -07:00
Paul Morie d22ffb0402 Add validation preventing recycle of / in a hostPath PV 2016-08-22 23:20:20 -04:00
Tim St. Clair 839034b46b
Validate AppArmor annotations in the API server 2016-08-21 20:59:11 -07:00
Clayton Coleman e1ebde9f92
Add spec.nodeName and spec.serviceAccountName to downward env var
The serviceAccountName is occasionally useful for clients running on
Kube that need to know who they are when talking to other components.

The nodeName is useful for PetSet or DaemonSet pods that need to make
calls back to the API to fetch info about their node.

Both fields are immutable, and cannot easily be retrieved in another
way.
2016-08-20 15:50:36 -04:00
Kubernetes Submit Queue 0abda6bd74 Merge pull request #30533 from liggitt/event-validation
Automatic merge from submit-queue

Validate involvedObject.Namespace matches event.Namespace

Fixes https://github.com/kubernetes/kubernetes/issues/16036
2016-08-20 12:19:12 -07:00
Kubernetes Submit Queue e9947d9ad7 Merge pull request #30813 from bprashanth/kubectl_petset
Automatic merge from submit-queue

Basic scaler/reaper for petset

Currently scaling or upgrading a petset is more complicated than it should be. Would be nice if this made code freeze on friday. I'm planning on a follow up change with generation number and e2es post freeze.
2016-08-20 10:51:07 -07:00
Rudi Chiarito 88fdb96bfb Add ExternalName to ServiceSpec
ExternalName allows kubedns to return CNAME records for external
services. No proxying is involved.

See original issue at
https://github.com/kubernetes/kubernetes/issues/13748

Feature tracking at
https://github.com/kubernetes/features/issues/33
2016-08-19 11:30:57 -07:00
Kubernetes Submit Queue 0bef4243cd Merge pull request #30386 from derekwaynecarr/fix-pvc-validation
Automatic merge from submit-queue

Fix pvc requests.storage validation

A `PersistentVolumeClaim` should not be able to request a negative amount of storage.

/cc @kubernetes/sig-storage @kubernetes/rh-cluster-infra @deads2k
2016-08-19 07:46:03 -07:00
Kubernetes Submit Queue 40367df750 Merge pull request #30590 from kevin-wangzefeng/taint-unique-by-key-effect
Automatic merge from submit-queue

make taints unique by <key, effect> on a node

closes #29362
2016-08-19 04:58:12 -07:00
bprashanth 05aa040b0f Allow changes to container image for updates 2016-08-18 16:33:51 -07:00
Johannes Scheuermann eed42380f9 Initial Quobyte support 2016-08-18 17:13:50 +02:00
Rodrigo Campos 568f4c2e63 Add mode permission bits to configmap, secrets and downwardAPI
This implements the proposal in:
docs/proposals/secret-configmap-downwarapi-file-mode.md

Fixes: #28317.

The mounttest image is updated so it returns the permissions of the linked file
and not the symlink itself.
2016-08-17 14:44:41 -04:00
Kevin 1e2d560253 make taints unique by <key, effect> on a node 2016-08-17 15:40:33 +08:00
Jordan Liggitt 5b7edc1aa6
Validate involvedObject.Namespace matches event.Namespace 2016-08-16 21:18:52 -04:00
derekwaynecarr cebb038935 Fix pvc requests.storage validation 2016-08-15 09:56:04 -04:00
Jess Frazelle 7e9d82129e
fix go vet errors
Signed-off-by: Jess Frazelle <jessfraz@google.com>

fix composites

Signed-off-by: Jess Frazelle <me@jessfraz.com>
2016-08-10 16:45:41 -07:00
Kubernetes Submit Queue 94fc389daa Merge pull request #29837 from thockin/validate-dotdot-in-projections
Automatic merge from submit-queue

Validate .. in projections, fix tests

I noticed this when reviewing another PR.  I fixed it but the test was beyond comprehension, so I fixed that too.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/29837)
<!-- Reviewable:end -->
2016-08-09 02:31:58 -07: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 ef4bccf63e Clean up the ugliest unit test ever
This volume-validation test was a disaster.  Better now, if longer to
scroll-through.
2016-07-31 22:37:11 -07:00
Tim Hockin 54e92bbc49 minor rename for readability 2016-07-31 22:37:11 -07:00
Tim Hockin 9f2e13acca Validate that projected files do not contain ..
This was checked in the kubelet, but not at the API.
2016-07-31 22:37:11 -07:00
Wojciech Tyczynski 898a6444e3 Return pointer for Affinity in api helper 2016-07-28 16:57:28 +02:00
k8s-merge-robot 5a7b52b8d2 Merge pull request #26942 from xiangpengzhao/fix_testcase
Automatic merge from submit-queue

Fix panic in schema test

If the swagger files for testing are lost, the func `loadSchemaForTest` or `NewSwaggerSchemaFromBytes` will return a non-nil error and a nil schema. In this case, the calling for `ValidateBytes` will result in panic. So, call Fatalf instead of Errorf.

Also fix minor typos.

Test logs:

```
--- FAIL: TestLoad (0.01s)
	schema_test.go:131: Failed to load: open ../../../api/swagger-spec/v1.json: no such file or directory
--- FAIL: TestValidateOk (0.00s)
	schema_test.go:138: Failed to load: open ../../../api/swagger-spec/v1.json: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x4d52df]

goroutine 10 [running]:
panic(0x15fffa0, 0xc8200100a0)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6
testing.tRunner.func1(0xc820085a70)
	/usr/local/go/src/testing/testing.go:467 +0x192
panic(0x15fffa0, 0xc8200100a0)
	/usr/local/go/src/runtime/panic.go:443 +0x4e9
k8s.io/kubernetes/pkg/api/validation.TestValidateOk(0xc820085a70)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/api/validation/schema_test.go:159 +0x79f
testing.tRunner(0xc820085a70, 0x22aad68)
	/usr/local/go/src/testing/testing.go:473 +0x98
created by testing.RunTests
	/usr/local/go/src/testing/testing.go:582 +0x892
FAIL	k8s.io/kubernetes/pkg/api/validation	0.048s
```
2016-07-26 20:35:32 -07:00
Ivan Shvedunov 02baa44948 Fix update validation for pods w/init containers. 2016-07-20 00:30:12 +03:00
k8s-merge-robot fa174bcdaf Merge pull request #29042 from dims/fixup-imports
Automatic merge from submit-queue

Use Go canonical import paths

Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports

Fixes #29014
2016-07-18 07:23:38 -07:00
k8s-merge-robot 8677b0c545 Merge pull request #28743 from Clarifai/gpu-impl
Automatic merge from submit-queue

Fix GPU resource validation

This fixes scheduling of pods with GPU resources. The change was never upstreamed during the 1.3 beta period, as it got lost in the noise of other changes in our fork. Ooops. I'll submit a cherry-pick request for 1.3.1 as soon as this lands in master.

Because of defaulting, requests are always set if limits are. Thus, the check can never succeed. Instead, make sure that the two values are equal.

Also, remove a few other error messages and remove unnecessary Sprintf calls.
2016-07-16 11:48:42 -07:00
Davanum Srinivas 2b0ed014b7 Use Go canonical import paths
Add canonical imports only in existing doc.go files.
https://golang.org/doc/go1.4#canonicalimports

Fixes #29014
2016-07-16 13:48:21 -04:00
Rudi Chiarito b86dfcf60a Fix GPU resource validation
Because of defaulting, requests are always set if limits are. Thus, the check can never succeed. Instead, make sure that the two values are equal.

Also, remove a few other error messages and remove unnecessary Sprintf calls.
2016-07-13 15:05:59 -04:00
jiangyaoguo 4e91166bc6 Use PreferAvoidPods annotation to avoid pods being scheduled to specific node.
1. define PreferAvoidPods annotation
2. add PreferAvoidPodsPriority
3. validate AvoidPods in node annotations
2016-07-13 17:07:46 +08:00
markturansky 3ddb8470b9 make PVCs immutable (except volumeName) post-creation 2016-07-11 11:50:16 -04:00
k8s-merge-robot 5f2460b58c Merge pull request #21240 from thockin/validation_pt8
Automatic merge from submit-queue

Validation: Make validation func return error strings

Part of an ongoing series of validation cleanups.

This centralizes the error strings next to the code that checks the error conditions.  Future commits will refine the messages further and provide more utility validators.

I'm OK if this doesn't go into 1.2, but I am tired of rebasing :)  I suggest commit-by-commit review, which should go pretty quickly.  This was largely mechanical.

<!-- Reviewable:start -->
---
This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/21240)
<!-- Reviewable:end -->
2016-07-07 14:37:11 -07:00
Michail Kargakis 93c2656d5a api: validate generation updates 2016-07-07 13:09:48 +02:00
bin liu 426fdc431a Merge branch 'master' into fix-typos 2016-07-04 11:20:47 +08:00
Tim Hockin 2f3863f53f Wrap DNS util/validation with api/validation
Simpler code and a step towards declarative validation.
2016-07-03 02:20:11 -07:00
Tim Hockin 09f1c97447 Clean up ValidateHasLabel() 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 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
xiangpengzhao a1b535f918 Call Fatalf instead of Errorf when loading schema returns error 2016-06-27 22:54:22 -04:00
Matthew Wong 3118c937be Fix pvc label selector validation error 2016-06-27 16:00:03 -04:00
k8s-merge-robot b51e5c0127 Merge pull request #26276 from deads2k/tweak-quota-validation
Automatic merge from submit-queue

make quota validation re-useable

Break quota validation into smaller functions to allow for object re-use.

@derekwaynecarr
2016-06-25 05:23:55 -07:00
k8s-merge-robot b4c81a073a Merge pull request #25709 from asalkeld/null-deref
Automatic merge from submit-queue

Check for an empty value in validateField

```release-note
* Fix a panic when args was not supplied with any values.
```

reflect.TypeOf() can take a nil (it then returns a nil), but
Kind() panics on a nil.

Now the user gets the following output:
./kubectl.sh --server=http://localhost:8080 create -f ../../test-files/test-rc.yaml
error validating "../../test-files/test-rc.yaml": error validating data: unexpected nil value for field spec.template.spec.containers[0].args[0]; if you choose to ignore these errors, turn validation off with --validate=false

fixes #20627 and fixes #26927
2016-06-25 02:31:01 -07:00
bin liu fd27cd47f7 fix some typos
Signed-off-by: bin liu <liubin0329@gmail.com>
2016-06-22 18:14:26 +08:00
k8s-merge-robot 60d4f2fe9d Merge pull request #27432 from jsafrane/pv-events-log
Automatic merge from submit-queue

Allow emitting PersistentVolume events.

Similarly to Nodes, PersistentVolumes are not in any namespace and we should
not block events on them. Currently, these events are rejected with
`Event "nfs.145841cf9c8cfaf0" is invalid: involvedObject.namespace: Invalid value: "": does not match involvedObject`
2016-06-20 01:02:47 -07:00
k8s-merge-robot 090e6ff660 Merge pull request #27625 from goltermann/spell2
Automatic merge from submit-queue

Fix several spelling errors in comments

What the title says
2016-06-18 23:08:28 -07:00
k8s-merge-robot 7ee4189cf6 Merge pull request #27036 from sttts/sttts-secure-seccomp-path
Automatic merge from submit-queue

Filter seccomp profile path from malicious .. and /

Without this patch with `localhost/<some-releative-path>` as seccomp profile one can load any file on the host, e.g. `localhost/../../../../dev/mem` which is not healthy for the kubelet.

/cc @jfrazelle 

Unit tests depend on https://github.com/kubernetes/kubernetes/pull/26710.
2016-06-18 15:58:07 -07:00
goltermann 218645b346 Fix several spelling errors in comments. 2016-06-17 10:41:18 -07:00
Avesh Agarwal eac3e3d809 Fix divisor for memory resource as it should never be millibytes 2016-06-15 15:32:59 -04:00
deads2k 1388efe6bb make quota validation re-useable 2016-06-15 14:38:43 -04:00
Jan Safranek 4ab91066d0 Allow emitting PersistentVolume events.
Similarly to Nodes, PersistentVolumes are not in any namespace and we should
not block events on them. Currently, these events are rejected with
'Event "nfs.145841cf9c8cfaf0" is invalid: involvedObject.namespace: Invalid value: "": does not match involvedObject'
2016-06-15 14:42:24 +02:00
Dr. Stefan Schimanski 3826d2598c Move seccomp annotation validation into api/validation 2016-06-14 14:58:32 +02:00
k8s-merge-robot 5288a255f4 Merge pull request #25567 from gmarek/validate
Automatic merge from submit-queue

Add Controller field to OwnerReference

cc @davidopp
2016-05-31 14:21:38 -07:00
gmarek a6dd89d797 Add Controller field to OwnerReference 2016-05-31 15:33:35 +02:00
Paul Morie faa112bad1 Add selector to PersistentVolumeClaim 2016-05-30 12:09:50 -04:00
Angus Salkeld 5dcbc7ce5b Check for an empty value in validateField
reflect.TypeOf() can take a nil (it then returns a nil), but
Kind() panics on a nil.

Fixes #20627
2016-05-30 14:12:18 +10:00
k8s-merge-robot a550cf16b9 Merge pull request #25826 from freehan/svcsourcerange
Automatic merge from submit-queue

promote sourceRange into service spec

@thockin  one more for your pile

I will add docs at `http://releases.k8s.io/HEAD/docs/user-guide/services-firewalls.md`

cc: @justinsb 

Fixes: #20392
2016-05-28 02:20:13 -07:00
Alex Robinson 294e49f8b9 Merge pull request #26121 from hpcloud/hpe/vsphere-vol-validation
Adding vSphere volume validation in api
2016-05-27 10:11:23 -07:00
Alex Mohr edda837142 Merge pull request #25599 from caesarxuchao/orphaning-finalizer
Add orphaning finalizer logic to GC
2016-05-26 13:19:19 -07:00
Minhan Xia a1bd33f510 promote sourceRange into service spec 2016-05-26 10:42:30 -07:00
Chao Xu 1665546d2d add finalizer logics to the API server and the garbage collector; handling DeleteOptions.OrphanDependents in the API server 2016-05-24 13:07:28 -07:00
Avesh Agarwal 1931931494 Downward API implementation for resources limits and requests 2016-05-24 12:22:35 -04:00
Abitha Palaniappan 66f9cd82a7 Adding vSphere volume validation in api 2016-05-23 14:39:09 -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
k8s-merge-robot 4f09f51486 Merge pull request #24800 from thockin/validation_pt8-3
Automatic merge from submit-queue

Make name validators return string slices

Part of the larger validation PR, broken out for easier review and merge.  Builds on previous PRs in the series.
2016-05-19 02:15:27 -07:00
Kevin 52fb89ff73 implement taints and tolerations 2016-05-18 15:06:23 +00:00
k8s-merge-robot e4e6e46197 Merge pull request #24799 from thockin/validation_pt8-2
Automatic merge from submit-queue

Make IsValidLabelValue return error strings

Part of the larger validation PR, broken out for easier review and merge.  Builds on previous PRs in the series.
2016-05-18 04:08:15 -07:00
Tim Hockin 152c86ab06 Make name validators return string slices 2016-05-18 00:48:01 -07:00
Tim Hockin 66d0d87829 Make IsValidLabelValue return error strings 2016-05-17 21:36:10 -07:00
Clayton Coleman 6685715c4c
API for adding init containers 2016-05-17 00:29:49 -04:00
k8s-merge-robot 4ac32179bf Merge pull request #24798 from thockin/validation_pt8-1
Automatic merge from submit-queue

Make IsQualifiedName return error strings

Part of the larger validation PR, broken out for easier review and merge.

@lavalamp FYI, but I know you're swamped, too.
2016-05-14 22:14:17 -07:00
k8s-merge-robot 5c30f983d9 Merge pull request #25018 from smarterclayton/fast_conversion
Automatic merge from submit-queue

Reduce allocations during conversion, enable new UnsafeConvertToVersion path

Cleans up the conversion path to avoid a few unnecessary allocations, then creates a new UnsafeConvertToVersion path that will allow encode/decode to bypass copying the object for performance. In that subsequent PR, ConvertToVersion will start to call Copy() and we will refactor conversions to reuse as much of the existing object as possible.

Also changes the unversioned.ObjectKind signature to not require allocations - speeds up a few common paths.
2016-05-12 14:50:01 -07:00
k8s-merge-robot 08440b5dcc Merge pull request #24836 from Clarifai/gpu-impl
Automatic merge from submit-queue

WIP v0 NVIDIA GPU support

```release-note
* Alpha support for scheduling pods on machines with NVIDIA GPUs whose kubelets use the `--experimental-nvidia-gpus` flag, using the alpha.kubernetes.io/nvidia-gpu resource 
```

Implements part of #24071 for  #23587

I am not familiar with the scheduler enough to know what to do with the scores. Mostly punting for now.

Missing items from the implementation plan: limitranger, rkt support, kubectl
support and docs

cc @erictune @davidopp @dchen1107 @vishh @Hui-Zhi @gopinatht
2016-05-12 14:04:15 -07:00
Clayton Coleman a84e62d9e6
Change ObjectKind signature to avoid allocations
We don't need to pass a pointer into SetGroupKindVersion() - a
struct works just as well.
2016-05-12 10:10:35 -04:00
Tim Hockin 72955770f3 Make IsQualifiedName return error strings 2016-05-10 11:23:23 -07:00
Phillip Wittrock 680b2b9d09 Kubectl support for validating nested objects with different ApiGroups (e.g. Lists containing objects in different api groups). Closes #24089 2016-05-09 19:38:40 -07:00
Rudi Chiarito 362c763fca WIP v0 NVIDIA GPU support
Implements part of #24071

I am not familiar with the scheduler enough to know what to do with the scores. Punting for now.

Missing items from the implementation plan: limitranger, rkt support, kubectl
support and user docs
2016-05-09 19:20:05 -04:00
k8s-merge-robot f2f3b49f58 Merge pull request #22575 from MikaelCluseau/wip-issue-20466
Automatic merge from submit-queue

Add subPath to mount a child dir or file of a volumeMount

Allow users to specify a subPath in Container.volumeMounts so they can use a single volume for many mounts instead of creating many volumes. For instance, a user can now use a single PersistentVolume to store the Mysql database and the document root of an Apache server of a LAMP stack pod by mapping them to different subPaths in this single volume.

Also solves https://github.com/kubernetes/kubernetes/issues/20466.
2016-05-08 08:45:15 -07:00
Kevin 82ba4f077e implement inter pod topological affinity and anti-affinity 2016-05-06 06:46:23 +00:00
Mikaël Cluseau 06900a934d Introduce subPath in VolumeMount 2016-05-06 15:08:41 +11:00
Chao Xu a46b7775fc API changes for finalizers and system-wide garbage collector 2016-05-04 21:54:55 -07:00
Clayton Coleman fdb110c859
Fix the rest of the code 2016-04-29 17:12:10 -04:00
k8s-merge-robot ad67363c12 Merge pull request #24362 from ArtfulCoder/hostname-field
Automatic merge from submit-queue

Promote Pod Hostname & Subdomain to fields (were annotations)

Deprecating the podHostName, subdomain and PodHostnames annotations and created corresponding new fields for them on PodSpec and Endpoints types.

Annotation doc: #22564
Annotation code: #20688
2016-04-29 01:06:45 -07:00
Abhishek Shah 8a3ed48808 Added Hostname and Subdomain field to Pod.Spec 2016-04-28 10:56:56 -07:00