Commit Graph

1014 Commits (17403585737bd45e239f7f5ea49d604be7cb3915)

Author SHA1 Message Date
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
Michal Rostecki fa0dd46ab7 Return (bool, error) in Authorizer.Authorize()
Before this change, Authorize() method was just returning an error,
regardless of whether the user is unauthorized or whether there
is some other unrelated error. Returning boolean with information
about user authorization and error (which should be unrelated to
the authorization) separately will make it easier to debug.

Fixes #27974
2016-07-18 12:06:54 +02:00
Wojciech Tyczynski 78101ac55e Fix crashes in schedulercache 2016-07-18 10:04:36 +02:00
k8s-merge-robot 156205523d Merge pull request #28852 from deads2k/use-user
Automatic merge from submit-queue

authorize based on user.Info

Update the `authorization.Attributes` to use the `user.Info` instead of discrete getters for each piece.

@kubernetes/sig-auth
2016-07-16 20:12:43 -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
lixiaobing10051267 3dfdb1dbb3 Func note not consistent with real fun name 2016-07-16 10:25:01 +08:00
k8s-merge-robot 4374b090c3 Merge pull request #28958 from wojtek-t/optimize_priorities_5
Automatic merge from submit-queue

Few more optimizations of priority functions in scheduler

Ref #28590

@davidopp
2016-07-15 09:32:04 -07:00
k8s-merge-robot 8b2d994153 Merge pull request #28952 from wojtek-t/optimize_pod_affinity
Automatic merge from submit-queue

First step of optimizing PodAffinity priority function

Ref #26144 

This is obviously only a first step - I will continue working on this code. However, this is changing the general scheme of computations to what is described in: https://github.com/kubernetes/kubernetes/issues/26144#issuecomment-232612384
2016-07-15 08:59:17 -07:00
Wojciech Tyczynski a538045d7b Cleanup and prepare for optimizing PodAffinity priority function. 2016-07-15 10:06:36 +02:00
Wojciech Tyczynski a23f7bd556 Few more optimizations of priority functions in scheduler 2016-07-14 15:32:56 +02:00
k8s-merge-robot 6bb0995c89 Merge pull request #28886 from wojtek-t/fix_schedulercache_bug
Automatic merge from submit-queue

Add ForgetPod to SchedulerCache

Fix #28883

@gmarek @davidopp @xiang90
2016-07-14 05:30:23 -07:00
k8s-merge-robot 74c5b4e4be Merge pull request #28459 from ping035627/ping035627-patch-0704
Automatic merge from submit-queue

Optimise the process of the CalculateSpreadPriority in selector_spreading.go

It had better inspect if the nodeLister is normal first in the CalculateSpreadPriority in selector_spreading.go. If the nodeLister.List return error, the function return directly, not need deal the serviceLister and controllerLister and replicaSetLister.
2016-07-14 04:54:32 -07:00
deads2k f6f1ab34aa authorize based on user.Info 2016-07-14 07:48:42 -04:00
k8s-merge-robot ae990defcf Merge pull request #26956 from joe2far/fix-typos
Automatic merge from submit-queue

Fixed several typos
2016-07-14 04:13:15 -07:00
k8s-merge-robot 06939c57aa Merge pull request #20699 from jiangyaoguo/add-AvoidPreviousNode
Automatic merge from submit-queue

Implement alpha version of PreferAvoidPods

This is part of #18853

<!-- 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/20699)
<!-- Reviewable:end -->
2016-07-14 03:30:25 -07:00
PingWang e4ab32cde2 Modify CalculateAntiAffinityPriority function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-07-14 09:10:50 +08:00
PingWang 437e133b34 Optimise the process of the CalculateSpreadPriority in selector_spreading.go
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-07-14 09:09:05 +08:00
Wojciech Tyczynski 9745878778 Add ForgetPod to SchedulerCache 2016-07-13 16:30:05 +02:00
joe2far 5ead89b5bb Fixed several typos 2016-07-13 15:06:24 +01:00
Łukasz Oleś 528bf7af3a Make Daemonset use GeneralPredicates
fixes #21454, fixes #22205
2016-07-13 14:50:29 +02:00
Wojciech Tyczynski c929d95884 Cache Allocatable Resources 2016-07-13 12:57:18 +02:00
Wojciech Tyczynski 58c201834c Unify resources 2016-07-13 12:57:07 +02: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
Wojciech Tyczynski ea1d797f98 Avoid computing ports multiple times 2016-07-13 11:02:26 +02:00
Wojciech Tyczynski ae6b66207a Optimize selector spreading 2016-07-13 11:02:26 +02:00
Wojciech Tyczynski b9d13c5dbd Avoid computing pod resources multiple times 2016-07-13 11:01:53 +02:00
kevin-wangzefeng ff6280fa5b update inter-pod affinity predicates, check PodAntiAffinity even when pod has no AntiAffinity constraints 2016-07-13 03:55:01 +00:00
k8s-merge-robot 5590553811 Merge pull request #28304 from ericchiang/fix-rbac-non-resource-url-rule-evaluation
Automatic merge from submit-queue

rbac authorizer: cleanups to rule evaluation for non-resource URLs

An few oversights in the RBAC authorizer. Fixes #28291 and permits non-resource URLs to use stars in the path. E.g. ("/apis/*").

cc @liggitt @kubernetes/sig-auth
2016-07-12 15:30:50 -07:00
Eric Chiang addc4b166c rbac authorizer: support non-resource urls with stars ("/apis/*") 2016-07-12 10:01:53 -07:00
Eric Chiang 411922f66c rbac authorizer: include verb in non-resource url requests 2016-07-12 10:01:53 -07:00
k8s-merge-robot 5894dc4615 Merge pull request #28829 from gmarek/hooks
Automatic merge from submit-queue

Add hooks for cluster health detection

Separate a function that decides if zone is healthy. First real commit for preventing massive pod eviction.
Ref. #28832

cc @davidopp
2016-07-12 08:12:04 -07:00
k8s-merge-robot 98030ded05 Merge pull request #28781 from wojtek-t/optimize_priorities_2
Automatic merge from submit-queue

Change storeToNodeConditionLister to return []*api.Node instead of api.NodeList for performance



Currently copies that are made while copying/creating api.NodeList are significant part of scheduler profile, and a bunch of them are made in places, that are not-parallelizable.
Ref #28590
2016-07-12 06:18:15 -07:00
gmarek fd600ab65c Add hooks for cluster health detection 2016-07-12 15:10:58 +02:00
k8s-merge-robot 9b5827691a Merge pull request #28669 from lixiaobing10051267/masterTestPodFitsResources
Automatic merge from submit-queue

Add test case to TestPodFitsResources() of scheduler algorithm

File "plugin\pkg\scheduler\algorithm\predicates", function "TestPodFitsResources()", line 199, only provide test case "one resource cpu fits but memory not", it should add test case "one resource memory fits but cpu not".
2016-07-11 22:46:09 -07:00
Wojciech Tyczynski d14fe0f269 Change storeToNodeConditionLister to return []*api.Node instead of api.NodeList for performance 2016-07-11 21:02:33 +02:00
k8s-merge-robot 5067af159e Merge pull request #28715 from euank/kubelet-trim-dead-code
Automatic merge from submit-queue

kubelete: delete a few bits of dead code

Less is more.
2016-07-11 11:40:47 -07:00
k8s-merge-robot 9b74e24fa3 Merge pull request #28769 from wojtek-t/optimize_priorities
Automatic merge from submit-queue

Optimize priorities in scheduler

Ref #28590

It's probably easier to review it commit by commit, since those changes are kind of independent from each other.

@davidopp - FYI
2016-07-11 07:49:23 -07:00
Wojciech Tyczynski d02e8d2885 Avoid unnecessary conversions 2016-07-11 15:41:27 +02:00
Wojciech Tyczynski dcb2ca54ad Avoid unnecessary copies 2016-07-11 15:41:27 +02:00
Wojciech Tyczynski 989202c384 Cache AllowedPodNumber to avoid conversions. 2016-07-11 15:41:26 +02:00
Wojciech Tyczynski 4eed5e07a5 Precompute pod resources 2016-07-11 15:41:26 +02:00
Wojciech Tyczynski e8e8e2d086 Remove unneeded factories 2016-07-11 15:41:26 +02:00
lixiaobing10051267 ce83c04251 Error info "scheduler" modify 2016-07-11 15:17:43 +08:00
PingWang 4fde2ff3a5 Update CheckServiceAffinity in predicates.go
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

gofmt -s -w

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-07-11 09:57:57 +08:00
k8s-merge-robot a261776f3e Merge pull request #28670 from wojtek-t/scheduler_metadata
Automatic merge from submit-queue

Add meta field to predicate signature to avoid computing the same things multiple times

This PR only uses it to avoid computing QOS of a pod for every node from scratch.

Ref #28590
2016-07-09 22:28:14 -07:00
k8s-merge-robot 91226f77a1 Merge pull request #28680 from wojtek-t/advanced_node_info_map_copy
Automatic merge from submit-queue

Avoid creating NodeInfoMap from scratch on every scheduling.

Ref #28590
2016-07-09 03:03:05 -07:00
k8s-merge-robot 9a4cc9979a Merge pull request #28504 from deads2k/allow-quota-injection
Automatic merge from submit-queue

allow lock acquisition injection for quota admission

Allows for custom lock acquisition when composing the quota admission controller.

@derekwaynecarr I'm still experimenting to make sure this satisfies the need downstream, but looking for agreement in principle
2016-07-08 17:15:39 -07:00
Euan Kemp 26e0f50504 kubelet: delete unused code 2016-07-08 15:15:43 -07:00
Wojciech Tyczynski 49934c05c0 Avoid creating NodeInfoMap from scratch on every scheduling. 2016-07-08 18:09:49 +02:00
Wojciech Tyczynski 0e6dc8a932 Avoid unnecessary copies 2016-07-08 13:54:06 +02:00
Wojciech Tyczynski b1d53895a4 Check only predicate functions in test 2016-07-08 13:01:41 +02:00
Wojciech Tyczynski b92eadfd1a Avoid computing QOS multiple times 2016-07-08 12:57:40 +02:00
Wojciech Tyczynski 6890868823 Add meta field to predicates signature 2016-07-08 12:25:48 +02:00
lixiaobing10051267 b4c106426e Add test case to TestPodFitsResources() 2016-07-08 15:43:03 +08:00
Wojciech Tyczynski 31538db145 Avoid growing slices 2016-07-07 15:54:39 +02:00
Wojciech Tyczynski 6c77c01f24 Avoid copying nodes in priority functions 2016-07-07 14:38:09 +02:00
Wojciech Tyczynski 7219802ac7 Pass pointer to node in NodCondition 2016-07-07 14:10:17 +02:00
Wojciech Tyczynski 58c95c136f Quick returns in predicates 2016-07-07 12:34:54 +02:00
k8s-merge-robot 0c696dc95b Merge pull request #27848 from liubin/fix-typos
Automatic merge from submit-queue

fix some typos

Just a minor typos fix.


Signed-off-by: bin liu <liubin0329@gmail.com>
2016-07-06 23:36:49 -07:00
k8s-merge-robot 4d91f0f763 Merge pull request #25137 from huang195/tls_user_emailaddress
Automatic merge from submit-queue

getting emailAddress from TLS cert

Kubernetes if using TLS cert to perform authentication will use the CommonName field of the cert as the authenticating user. In https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/auth/authenticator/request/x509/x509.go#L106, alternative methods are defined to use emailAddress or DNSName as the authenticating user. The method that uses the emailAddress is not comprehensive as this information can be encoded in different places of the certificate. This PR fixes this.
2016-07-06 19:45:01 -07:00
deads2k ada37c2163 allow lock acquisition injection for quota admission 2016-07-06 09:39:42 -04:00
Hongchao Deng 7127915a66 selector: make sure value of GT and LT is integer 2016-07-04 20:18:17 -07:00
bin liu 426fdc431a Merge branch 'master' into fix-typos 2016-07-04 11:20:47 +08:00
k8s-merge-robot 038ac428f4 Merge pull request #28036 from ericchiang/oidc-auth-plugin-dont-error-if-provider-is-unavailable
Automatic merge from submit-queue

oidc auth plugin: don't hard fail if provider is unavailable

When using OpenID Connect authentication, don't cause the API
server to fail if the provider is unavailable. This allows
installations to run OpenID Connect providers after starting the
API server, a common case when the provider is running on the
cluster itself.

Errors are now deferred to the authenticate method.

cc @sym3tri @erictune @aaronlevy @kubernetes/sig-auth
2016-06-30 13:02:16 -07:00
k8s-merge-robot 61a9358dbd Merge pull request #26774 from xiangpengzhao/fix_predicatesnil
Automatic merge from submit-queue

Check nil pointer in predicates.go

Should check if the pointer is nil in func filterVolumes as is done in [func predicate](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/algorithm/predicates/predicates.go#L279).
2016-06-30 01:45:26 -07:00
Eric Chiang 2f6db37ff5 oidc auth plugin: don't hard fail if provider is unavailable
When using OpenID Connect authentication, don't cause the API
server to fail if the provider is unavailable. This allows
installations to run OpenID Connect providers after starting the
API server, a common case when the provider is running on the
cluster itself.

Errors are now deferred to the authenticate method.
2016-06-29 23:20:26 -07:00
k8s-merge-robot 9e0a2d3a6b Merge pull request #28203 from ping035627/ping035627-0629
Automatic merge from submit-queue

Add error log for Run function in server.go

When clientcmd.BuildConfigFromFlags and os.Hostname return error, there are no log information in Run function, neither did the upper function(main of scheduler), add it, I suggest.
2016-06-29 21:03:05 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
k8s-merge-robot e7f7a49bac Merge pull request #26016 from hongchaodeng/phantom
Automatic merge from submit-queue

scheduler: change phantom pod test from integration into unit test

This is an effort for #24440.

Why this PR?
- Integration test is hard to debug. We could model the test as a unit test similar to [TestSchedulerForgetAssumedPodAfterDelete()](132ebb091a/plugin/pkg/scheduler/scheduler_test.go (L173)). Currently the test is testing expiring case, we can change that to delete.
- Add a test similar to TestSchedulerForgetAssumedPodAfterDelete() to test phantom pod.
- refactor scheduler tests to share the code between TestSchedulerNoPhantomPodAfterExpire() and TestSchedulerNoPhantomPodAfterDelete()
- Decouple scheduler tests from scheduler events: not to use events
2016-06-29 12:09:49 -07:00
k8s-merge-robot 7f3da674f7 Merge pull request #26680 from olegshaldybin/fake-clientset-registry
Automatic merge from submit-queue

Track object modifications in fake clientset

Fake clientset is used by unit tests extensively but it has some
shortcomings:

- no filtering on namespace and name: tests that want to test objects in
  multiple namespaces end up getting all objects from this clientset,
  as it doesn't perform any filtering based on name and namespace;

- updates and deletes don't modify the clientset state, so some tests
  can get unexpected results if they modify/delete objects using the
  clientset;

- it's possible to insert multiple objects with the same
  kind/name/namespace, this leads to confusing behavior, as retrieval is
  based on the insertion order, but anchors on the last added object as
  long as no more objects are added.

This change changes core.ObjectRetriever implementation to track object
adds, updates and deletes.

Some unit tests were depending on the previous (and somewhat incorrect)
behavior. These are fixed in the following few commits.
2016-06-29 06:04:33 -07:00
k8s-merge-robot 1a1a4709b9 Merge pull request #28093 from dubstack/dubstack-refactor-qos2
Automatic merge from submit-queue

[Refactor] Make QoS naming consistent across the codebase

@derekwaynecarr @vishh PTAL. Can one of you please attach a LGTM.
2016-06-29 02:36:22 -07:00
PingWang 989416b329 Add error log for Run function in server.go
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-06-29 11:11:52 +08:00
Oleg Shaldybin 3b15d5be19 Use correct namespace in unit tests that use fake clientset
Fake clientset no longer needs to be prepopulated with records: keeping
them in leads to the name conflict on creates. Also, since fake
clientset now respects namespaces, we need to correctly populate them.
2016-06-28 11:26:34 -07:00
deads2k a28cf3963b refactor quota evaluation to cleanly abstract the quota access 2016-06-28 11:38:18 -04:00
k8s-merge-robot b6f966f8f5 Merge pull request #27690 from resouer/fix-affinity
Automatic merge from submit-queue

Omit invalid affinity error in admission

Fixes #27645  cc @smarterclayton 

Not sure if this is too aggressive, but user should expect failure if they disable validation after all.
2016-06-28 02:24:22 -07:00
xiangpengzhao 5b69688b4b Check nil for pointer 2016-06-27 22:55:20 -04:00
Buddha Prakash 4acb64f8bd Make Qos naming consistent across the codebase 2016-06-26 16:19:47 -07:00
k8s-merge-robot d64333419c Merge pull request #27749 from dubstack/dubstack-refactor-qos
Automatic merge from submit-queue

[Refactor] QOS to have QOS Class type for QoS classes

This PR adds a QOSClass type and initializes QOSclass constants for the three QoS classes.
It would be good to use this in all future QOS related features. 
This would be good to have for the (Pod level cgroups isolation proposal)[https://github.com/kubernetes/kubernetes/pull/26751] that i am working on aswell.
@vishh PTAL
 
Signed-off-by: Buddha Prakash <buddhap@google.com>
2016-06-26 06:23:23 -07:00
k8s-merge-robot 4e6e4ee1f9 Merge pull request #25934 from ping035627/ping035627-patch-3
Automatic merge from submit-queue

Fix  #25606: Add the length detection of the "predicateFuncs" in generic_scheduler.go

Fix  #25606

The PR add the length detection of the "predicateFuncs" for "findNodesThatFit" function of generic_scheduler.go. 
In “findNodesThatFit” function, if the length of the "predicateFuncs" parameter is 0, it can set filtered equals nodes.Items, and needn't to traverse the nodes.Items.
2016-06-25 03:04:44 -07:00
k8s-merge-robot 19650207a2 Merge pull request #24678 from ericchiang/log_webhook_error
Automatic merge from submit-queue

plugin/pkg/auth/authorizer/webhook: log request errors

Currently the API server only checks the errors returned by an
authorizer plugin, it doesn't return or log them[0]. This makes
incorrectly configuring the wehbook authorizer plugin extremely
difficult to debug.

Add a logging statement if the request to the remove service fails
as this indicates misconfiguration.

[0] https://goo.gl/9zZFv4

<!-- 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/24678)
<!-- Reviewable:end -->
2016-06-24 21:43:36 -07:00
k8s-merge-robot 2d35871569 Merge pull request #24385 from Clarifai/fixes
Automatic merge from submit-queue

golint fixes for AWS cloudprovider

Among other things, golint doesn't like receivers that are inconsistently named or called "self". Or structs named aws.AWSservices, aws.AWSCloud, etc.
2016-06-24 20:58:49 -07:00
Hongchao Deng 8cd55e8e52 refactor scheduler test and include phantom test 2016-06-24 16:11:59 -07:00
Buddha Prakash c3551ae6cd Refactor qos package
Signed-off-by: Buddha Prakash <buddhap@google.com>
2016-06-24 15:36:04 -07:00
Rudi Chiarito 8db551f674 golint fixes for aws cloudprovider 2016-06-24 17:06:38 -04:00
k8s-merge-robot a405df4391 Merge pull request #25710 from xiangpengzhao/fix_predicate
Automatic merge from submit-queue

No need to log empty string in predicates.go

If `pvcName` is empty, we don't need to log it.
2016-06-24 13:56:26 -07:00
CJ Cullen 38a1042199 Add a 5x exponential backoff on 429s & 5xxs to the webhook Authenticator/Authorizer. 2016-06-23 18:15:39 -07:00
CJ Cullen ae67a4e209 Check HTTP Status code in webhook authorizer/authenticator. 2016-06-22 11:15:33 -07:00
k8s-merge-robot cd66fb7a55 Merge pull request #27772 from jsafrane/kubelet-volume-not-found
Automatic merge from submit-queue

Rephrase 'pv not found in cache' warnings.

When kubelet starts a pod that refers to non-existing PV, PVC or Node, it should clearly show that the requested element does not exist.

Previous `PersistentVolumeClaim 'default/ceph-claim-wm' is not in cache` looks like random kubelet hiccup, while `PersistentVolumeClaim 'default/ceph-claim-wm' not found` suggests that the object may not exist at all and it might be an user error.

Fixes #27523
2016-06-22 05:16:02 -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 07471cf90f Merge pull request #27553 from justinsb/pvc_zone_spreading_2
Automatic merge from submit-queue

AWS/GCE: Spread PetSet volume creation across zones, create GCE volumes in non-master zones

Long term we plan on integrating this into the scheduler, but in the
short term we use the volume name to place it onto a zone.
    
We hash the volume name so we don't bias to the first few zones.
    
If the volume name "looks like" a PetSet volume name (ending with
-<number>) then we use the number as an offset.  In that case we hash
the base name.
2016-06-22 01:22:16 -07:00
Harry Zhang 49fe9d1b41 Add unit test to ensure no error thrown 2016-06-21 22:23:37 -04:00
Jan Safranek c9a60e2d2c Rephrase 'pv not found in cache' warnings.
When kubelet starts a pod that refers to non-existing PV, PVC or Node, it
should clearly show that the requested element does not exist.

Previous "PersistentVolumeClaim 'default/ceph-claim-wm' is not in cache"
looks like random kubelet hiccup, while "PersistentVolumeClaim
'default/ceph-claim-wm' not found" suggests that the object may not exist at
all and it might be an user error.

Fixes #27523
2016-06-21 14:56:11 +02:00
Harry Zhang 080b49276e Omit invalid affinity error in admission 2016-06-21 11:06:34 +08:00
k8s-merge-robot 6fbf99b11a Merge pull request #26753 from ericchiang/rbac-authorizer-tests
Automatic merge from submit-queue

add unit and integration tests for rbac authorizer

This PR adds lots of tests for the RBAC authorizer. 

The plan over the next couple days is to add a lot more test cases.

Updates #23396

cc @erictune
2016-06-19 19:19:08 -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
Justin Santa Barbara 9c2566572d GCE Multizone: Allow volumes to be created in non-master zone
We had a long-lasting bug which prevented creation of volumes in
non-master zones, because the cloudprovider in the volume label
admission controller is not initialized with the multizone setting
(issue #27656).

This implements a simple workaround: if the volume is created with the
failure-domain zone label, we look for the volume in that zone.  This is
more efficient, avoids introducing a new semantic, and allows users (and
the dynamic provisioner) to create volumes in non-master zones.

Fixes #27657
2016-06-17 23:27:41 -04:00
k8s-merge-robot 8b7d842203 Merge pull request #27227 from abhgupta/issue_27198
Automatic merge from submit-queue

Counting pod volume towards PV limit even if PV/PVC is missing

Fixes #27198 

Implements option 3 from https://github.com/kubernetes/kubernetes/issues/27198#issuecomment-225298492

/cc @smarterclayton @markturansky @childsb
2016-06-17 12:40:51 -07:00
goltermann 218645b346 Fix several spelling errors in comments. 2016-06-17 10:41:18 -07:00
k8s-merge-robot f830a2ceec Merge pull request #27237 from xiangpengzhao/fix_priorityscoreinfo
Automatic merge from submit-queue

Make priority score info clearer

When I trace the scheduler workflow, the log info makes me a bit confused:
Taint Toleration Priority Score info is lacking.
The values of Absolute and Requested resources are in the reverse order.
The values of resources have no type and unit.

This PR tries to make the log info clearer.

before:
```
I0609 15:18:17.978739   32560 node_affinity.go:92] mongo -> vm: NodeAffinityPriority, Score: (0)
I0609 15:18:17.978756   32560 priorities.go:69] mongo -> vm: Least Requested Priority, Absolute/Requested: (100, 209715200) / (4000, 8372678656) Score: (9, 9)
I0609 15:18:17.978896   32560 priorities.go:262] mongo -> vm: Balanced Resource Allocation, Absolute/Requested: (100, 209715200) / (4000, 8372678656) Score: (9)
I0609 15:18:17.978971   32560 selector_spreading.go:233] mongo -> vm: SelectorSpreadPriority, Score: (10)
I0609 15:18:17.979043   32560 generic_scheduler.go:301] Host vm Score 38
```

after:
```
I0611 06:58:23.132306   28814 taint_toleration.go:108] mongo -> vm: Taint Toleration Priority, Score: (10)
I0611 06:58:23.132326   28814 priorities.go:69] mongo -> vm: Least Requested Priority, Absolute/Requested(CPU:millicores, memory:bytes): (4000, 8372678656) / (100, 209715200) Score: (9, 9)
I0611 06:58:23.132367   28814 node_affinity.go:92] mongo -> vm: NodeAffinityPriority, Score: (0)
I0611 06:58:23.132400   28814 priorities.go:262] mongo -> vm: Balanced Resource Allocation, Absolute/Requested(CPU:millicores, memory:bytes): (4000, 8372678656) / (100, 209715200) Score: (9)
I0611 06:58:23.132544   28814 selector_spreading.go:233] mongo -> vm: SelectorSpreadPriority, Score: (10)
I0611 06:58:23.132567   28814 generic_scheduler.go:301] Host vm Score 38
```
2016-06-17 00:56:55 -07:00
Eric Chiang d13e351028 add unit and integration tests for rbac authorizer 2016-06-14 11:07:48 -07:00
Wojciech Tyczynski 5d702a32c1 Fix race in informer 2016-06-14 16:40:12 +02:00
Abhishek Gupta 20ce8b71ab Improving error messages and naming to be clear 2016-06-13 15:23:17 -07:00
Abhishek Gupta 07bc06ba50 Counting pod volume towards PV limit even if PV/PVC is missing 2016-06-13 15:17:42 -07:00
derekwaynecarr ce44b3b98a Quota can look for a previous object from admission rather than do a lookup 2016-06-13 09:50:53 -04:00
xiangpengzhao f1d98ba961 Make priority score info more clear 2016-06-12 02:31:41 -04:00
k8s-merge-robot 9a2ad73cee Merge pull request #22568 from abhgupta/abhgupta-dev
Automatic merge from submit-queue

Considering all nodes for the scheduler cache to allow lookups

Fixes the actual issue that led me to create https://github.com/kubernetes/kubernetes/issues/22554

Currently the nodes in the cache provided to the predicates excludes the unschedulable nodes using field level filtering for the watch results. This results in the above issue as the `ServiceAffinity` predicate uses the cached node list to look up the node metadata for a peer pod (another pod belonging to the same service). Since this peer pod could be currently hosted on a node that is currently unschedulable, the lookup could potentially fail, resulting in the pod failing to be scheduled.

As part of the fix, we are now including all nodes in the watch results and excluding the unschedulable nodes using `NodeCondition`

@derekwaynecarr PTAL
2016-06-11 12:22:46 -07:00
k8s-merge-robot 4793372a85 Merge pull request #25888 from rootfs/attacher-aws-cinder
Automatic merge from submit-queue

implement EBS and Cinder attacher/detacher 

follow up with #21709

@kubernetes/sig-storage
2016-06-10 05:39:22 -07:00
k8s-merge-robot ade299c18f Merge pull request #27146 from mikedanese/nil-ptr
Automatic merge from submit-queue

oidc: fix test nil pointer

```
2016-06-09 13:12:37.262983 I | http: TLS handshake error from 127.0.0.1:32814: remote error: bad certificate
PASS
--- FAIL: TestNewOIDCAuthProvider (0.87s)
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=0x0 pc=0x5d91ca]

goroutine 12 [running]:
panic(0x124bd00, 0xc8200101f0)
        /usr/local/google/home/mikedanese/.gimme/versions/go1.6.1.linux.amd64/src/runtime/panic.go:464 +0x3e6
testing.tRunner.func1(0xc820023b90)
        /usr/local/google/home/mikedanese/.gimme/versions/go1.6.1.linux.amd64/src/testing/testing.go:467 +0x192
panic(0x124bd00, 0xc8200101f0)
        /usr/local/google/home/mikedanese/.gimme/versions/go1.6.1.linux.amd64/src/runtime/panic.go:426 +0x4e9
k8s.io/kubernetes/plugin/pkg/auth/authenticator/token/oidc/testing.(*OIDCProvider).AddMinimalProviderConfig(0xc820020580, 0x0)
        /usr/local/google/home/mikedanese/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/plugin/pkg/auth/authenticator/token/oidc/testing/provider.go:85 +0x2a
k8s.io/kubernetes/plugin/pkg/client/auth/oidc.TestNewOIDCAuthProvider(0xc820023b90)
        /usr/local/google/home/mikedanese/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/plugin/pkg/client/auth/oidc/oidc_test.go:51 +0x367
testing.tRunner(0xc820023b90, 0x1d0a360)
        /usr/local/google/home/mikedanese/.gimme/versions/go1.6.1.linux.amd64/src/testing/testing.go:473 +0x98
created by testing.RunTests
        /usr/local/google/home/mikedanese/.gimme/versions/go1.6.1.linux.amd64/src/testing/testing.go:582 +0x892
FAIL    k8s.io/kubernetes/plugin/pkg/client/auth/oidc   3.081s
```

cc @bobbyrullo @yifan-gu
2016-06-10 00:12:28 -07:00
Mike Danese c0cda8535e oidc: fix test nil pointer 2016-06-09 13:15:59 -07:00
Abhishek Gupta bc9c461402 Adding test case for scheduler NodeConditionPredicate 2016-06-08 14:41:38 -07:00
Abhishek Gupta 623e7dfa39 Considering all nodes for the scheduler cache to allow lookups 2016-06-08 14:41:18 -07:00
Eric Chiang c8ca49ec88 plugin/pkg/auth/authorizer/webhook: log request errors
Currently the API server only checks the errors returned by an
authorizer plugin, it doesn't return or log them[0]. This makes
incorrectly configuring the wehbook authorizer plugin extremely
difficult to debug.

Add a logging statement if the request to the remove service fails
as this indicates misconfiguration.

[0] https://goo.gl/9zZFv4
2016-06-08 13:19:23 -07:00
Huamin Chen d1e0a13924 support AWS and Cinder attacher
Signed-off-by: Huamin Chen <hchen@redhat.com>
2016-06-08 12:56:24 +00:00
Matt Liggett 421950eecb Avoid pathname collisions in TestNewOICAuthProvider.
May fix #26815
2016-06-07 18:01:29 -07:00
k8s-merge-robot 2253f3d824 Merge pull request #26021 from hongchaodeng/random
Automatic merge from submit-queue

scheduler: remove unused random generator

The way scheduler selecting host has been changed to round-robin.
Clean up leftover.
2016-05-29 12:35:00 -07:00
k8s-merge-robot 577cdf937d Merge pull request #26415 from wojtek-t/network_not_ready
Automatic merge from submit-queue

Add a NodeCondition "NetworkUnavaiable" to prevent scheduling onto a node until the routes have been created 

This is new version of #26267 (based on top of that one).

The new workflow is:
- we have an "NetworkNotReady" condition
- Kubelet when it creates a node, it sets it to "true"
- RouteController will set it to "false" when the route is created
- Scheduler is scheduling only on nodes that doesn't have "NetworkNotReady ==true" condition

@gmarek @bgrant0607 @zmerlynn @cjcullen @derekwaynecarr @danwinship @dcbw @lavalamp @vishh
2016-05-29 03:06:59 -07:00
k8s-merge-robot 9ef7693c0b Merge pull request #26496 from hongchaodeng/fix
Automatic merge from submit-queue

scheduler cache: print err if AssumePod fail

ref:
* https://github.com/kubernetes/kubernetes/issues/19681#issuecomment-222337964
* #26043

Print error to help debug flake.
2016-05-28 23:46:16 -07:00
Hongchao Deng 54acae1281 scheduler cache: print err if AssumePod fail 2016-05-28 18:47:12 -07:00
k8s-merge-robot e543bd6452 Merge pull request #26007 from smarterclayton/watch_opt
Automatic merge from submit-queue

Additional optimizations to the encode/decode paths

Builds on top of #25983 with a number of other optimizations.
2016-05-28 06:27:00 -07:00
Wojciech Tyczynski be1b57100d Change to NotReadyNetworking and use in scheduler 2016-05-27 19:32:49 +02:00
Eric Chiang ef40aa9572 pkg/master: enable certificates API and add rbac authorizer 2016-05-25 14:24:47 -07:00
k8s-merge-robot e5cb165ecc Merge pull request #25091 from deads2k/reduce-conflicts
Automatic merge from submit-queue

reduce conflict retries

Eliminates quota admission conflicts due to latent caches on the same API server.

@derekwaynecarr
2016-05-25 05:33:23 -07:00
Hongchao Deng e2704c9168 scheduler: remove unused random generator 2016-05-24 20:12:21 -07:00
k8s-merge-robot 5303794ef0 Merge pull request #25787 from liggitt/update-admission
Automatic merge from submit-queue

plumb Update resthandler to allow old/new comparisons in admission

Rework how updated objects are passed to rest storage Update methods (first pass at https://github.com/kubernetes/kubernetes/pull/23928#discussion_r61444342)

* allows centralizing precondition checks (uid and resourceVersion)
* allows admission to have the old and new objects on patch/update operations (sets us up for field level authorization, differential quota updates, etc)
* allows patch operations to avoid double-GETting the object to apply the patch

Overview of important changes:
* pkg/api/rest/rest.go
  * changes `rest.Update` interface to give rest storage an `UpdatedObjectInfo` interface instead of the object directly. To get the updated object, the storage must call `UpdatedObject()`, passing in the current object
* pkg/api/rest/update.go
  * provides a default `UpdatedObjectInfo` impl
  * passes a copy of the updated object through any provided transforming functions and returns it when asked
  * builds UID preconditions from the updated object if they can be extracted
* pkg/apiserver/resthandler.go
  * Reworks update and patch operations to give old objects to admission
* pkg/registry/generic/registry/store.go
  * Calls `UpdatedObject()` inside `GuaranteedUpdate` so it can provide the old object

Todo:
- [x] Update rest.Update interface:
  * Given the name of the object being updated
  * To get the updated object data, the rest storage must pass the current object (fetched using the name) to an `UpdatedObject(ctx, oldObject) (newObject, error)` func. This is typically done inside a `GuaranteedUpdate` call.
- [x] Add old object to admission attributes interface
- [x] Update resthandler Update to move admission into the UpdatedObject() call
- [x] Update resthandler Patch to move the patch application and admission into the UpdatedObject() call
- [x] Add resttest tests to make sure oldObj is correctly passed to UpdatedObject(), and errors propagate back up

Follow-up:
* populate oldObject in admission for delete operations?
* update quota plugin to use `GetOldObject()` in admission attributes
* admission plugin to gate ownerReference modification on delete permission
* Decide how to handle preconditions (does that belong in the storage layer or in the resthander layer?)
2016-05-24 08:41:31 -07:00
Filip Grzadkowski 55a1c826bb Refactor scheduler to expose predicates to cluster autoscaler 2016-05-24 09:04:31 +02:00
Jordan Liggitt 29252acd1a Change rest storage Update interface to retrieve updated object
Add OldObject to admission attributes

Update resthandler Patch/Update admission plumbing
2016-05-23 21:09:26 -04:00
Hai Huang 235020ad64 getting emailAddress from TLS cert 2016-05-23 18:36:14 -04:00
deads2k 02c0181f26 reduce conflict retries 2016-05-23 13:09:37 -04:00
k8s-merge-robot 180ab70df0 Merge pull request #25560 from ping035627/ping035627-patch-3
Automatic merge from submit-queue

A optimization for “RegisterCustomFitPredicate” function, avoiding redundancy
2016-05-22 19:37:23 -07:00
PingWang e2af16b1d5 Update generic_scheduler.go 2016-05-23 09:18:15 +08:00
PingWang 36740719d9 exec gofmt -s 2016-05-23 09:17:17 +08:00
k8s-merge-robot fe1588ebb2 Merge pull request #26024 from dims/fix-issue-25950
Automatic merge from submit-queue

Fix useless error message in scheduler log

Print the Namespace and Name instead of Kind/ApiVersion.

fixes #25950
2016-05-21 23:33:42 -07:00
k8s-merge-robot 529135dd01 Merge pull request #25863 from ping035627/ping035627-patch-2
Automatic merge from submit-queue

Fix the bug of the "removePod" function in node_info.go
2016-05-21 21:34:28 -07:00
Clayton Coleman c6961d6fd6
Remove runtime.Typer, reduce to ObjectKinds(1) (3)
Remove the unnecessary variants, which avoids allocations in several
core paths.
2016-05-21 23:55:42 -04:00
k8s-merge-robot 9e8282c586 Merge pull request #25838 from cjcullen/authzcache
Automatic merge from submit-queue

Cache webhook authorization responses

Similar to #25694, but for authorization.
2016-05-21 20:34:34 -07:00
k8s-merge-robot c17465be03 Merge pull request #25531 from ingvagabund/introduce-memory-pressure-to-scheduler
Automatic merge from submit-queue

Introduce node memory pressure condition to scheduler

Following the work done by @derekwaynecarr at https://github.com/kubernetes/kubernetes/pull/21274, introducing memory pressure predicate for scheduler.

Missing:

* write down unit-test
* test the implementation

At the moment this is a heads up for further discussion how the new node's memory pressure condition should be handled in the generic scheduler.

**Additional info**

* Based on [1], only best effort pods are subject to filtering.
* Based on [2], best effort pods are those pods "iff requests & limits are not specified for any resource across all containers".

[1] 542668cc79/docs/proposals/kubelet-eviction.md (scheduler)
[2] https://github.com/kubernetes/kubernetes/pull/14943
2016-05-21 19:37:15 -07:00
k8s-merge-robot 009ae748a5 Merge pull request #25830 from smarterclayton/init_container_psp
Automatic merge from submit-queue

Add init containers to PSP admission

Treat them just like regular containers.

@pweil-
2016-05-21 16:01:13 -07:00
Jan Chaloupka b95b30bbd7 Scheduler: introduce CheckNodeMemoryPressurePredicate, don't schedule pods for nodes that reports memory pressury.
Introduce unit-test for CheckNodeMemoryPressurePredicate

Following work done in #14943
2016-05-22 00:40:28 +02:00
CJ Cullen d03dbbcc14 Add LRU Expire cache to webhook authorizer. 2016-05-21 14:50:50 -07:00
Davanum Srinivas 57f6321788 Fix useless error message in scheduler log
Print the Namespace and Name instead of Kind/ApiVersion.

fixes #25950
2016-05-21 16:02:36 -04:00
k8s-merge-robot 682c188fc8 Merge pull request #25738 from wojtek-t/default_protobuf
Automatic merge from submit-queue

Use protobufs by default to communicate with apiserver (still store JSONs in etcd)

@lavalamp @kubernetes/sig-api-machinery
2016-05-21 11:48:25 -07:00
k8s-merge-robot 346f965871 Merge pull request #25694 from cjcullen/authncache
Automatic merge from submit-queue

Cache Webhook Authentication responses

Add a simple LRU cache w/ 2 minute TTL to the webhook authenticator.

Kubectl is a little spammy, w/ >= 4 API requests per command. This also prevents a single unauthenticated user from being able to DOS the remote authenticator.
2016-05-21 10:48:38 -07:00
Wojciech Tyczynski 0f881d6120 Use protobufs by default to communicate with apiserver 2016-05-21 11:38:32 +02:00
Mike Danese 7170c8910d Merge pull request #25270 from bobbyrullo/deps
Implement OIDC client AuthProvider
2016-05-20 16:43:23 -07:00
Filip Grzadkowski ab10484330 Merge pull request #25741 from fgrzadkowski/unschedulable_pod
Stop setting Message when updating PodScheduled condition
2016-05-20 10:02:13 +02:00
PingWang 901011f242 Update node_info.go 2016-05-20 09:07:43 +08:00
PingWang b973670344 Add the length detection of the "predicateFuncs" in generic_scheduler.go
The PR add the length detection of the "predicateFuncs" for "findNodesThatFit" function of generic_scheduler.go. 
In “findNodesThatFit” function, if the length of the "predicateFuncs" parameter is 0, it can set filtered equals nodes.Items, and needn't to traverse the nodes.Items.
2016-05-20 08:49:53 +08:00
Clayton Coleman 88b39cadf8
Have the service account controller force retry
Service account controller, when API token not found, now sends 500 with
Retry-After: 1s. Also change the apiserver to actually write the error.
2016-05-19 09:08:57 -04:00
PingWang 85f1e0ea6a Fix the bug of the "removePod" function in node_info.go
It should reduce the resource data after finding the pod in the pods, because perhaps no corresponding pod in the pods of the node, at this time it shouldn't reduce the resource data of the node.
2016-05-19 17:19:54 +08:00
Clayton Coleman 588f15844b
Add init container support to other admission controllers 2016-05-18 22:32:25 -04:00