Commit Graph

1311 Commits (3479522de556eecca1bdbfd795b86725ac5022a2)

Author SHA1 Message Date
Wojciech Tyczynski e9d5be628a Don't validate selector that is already validated 2016-08-22 09:39:32 +02:00
Tim St. Clair 293770ef31
AppArmor PodSecurityPolicy implementation 2016-08-21 23:10:45 -07:00
Kubernetes Submit Queue d9705f85ea Merge pull request #30392 from ericchiang/x509-get-groups-from-org
Automatic merge from submit-queue

x509 authenticator: get groups from subject's organization field

Note that the current X509 tests provide a bunch of certs but no private keys or commands to reproduce the testdata, so the new test case isn't added to the certificate chain.

Closes  #30260

cc @treed @gtank @mikedanese @deads2k  @kubernetes/sig-auth
2016-08-21 13:19:50 -07:00
Kubernetes Submit Queue 4e39800baa Merge pull request #30992 from mwielgus/cluster-autoscaler-alg
Automatic merge from submit-queue

Cluster autoscaler friendly scheduling algorithm

cc: @davidopp
2016-08-20 18:49:24 -07:00
Kubernetes Submit Queue 4145824911 Merge pull request #30907 from deads2k/fix-quota-updates
Automatic merge from submit-queue

only compute delta on non-creating updates

If you're issuing an update that can cause a create, the quota admission charge should be based on the create cost, otherwise you always end up with zero.

@derekwaynecarr ptal, blocker bug.
2016-08-20 16:16:02 -07:00
Kubernetes Submit Queue 1de78d5a90 Merge pull request #30631 from ecordell/webhook-admission
Automatic merge from submit-queue

ImagePolicyWebhook Admission Controller

<!--  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**: This is an implementation of the [image provenance proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/image-provenance.md). It also includes the API definitions by @Q-Lee from https://github.com/kubernetes/kubernetes/pull/30241

**Special notes for your reviewer**:
Please note that this is the first admission controller to make use of the admission controller config file (`--admission-controller-config-file`). I have defined a format for it but we may want to double check it's adequate for future use cases as well.

The format defined is:

```
{
  "imagePolicy": {
     "kubeConfigFile": "path/to/kubeconfig/for/backend",
     "allowTTL": 50,          # time in s to cache approval
     "denyTTL": 50,           # time in s to cache denial
     "retryBackoff": 500,      # time in ms to wait between retries
     "defaultAllow": true      # determines behavior if the webhook backend fails
  }
}
```

(or yaml)

**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`. 
-->
```release-note
Adding ImagePolicyWebhook admission controller.
```
2016-08-20 13:39:44 -07:00
Kubernetes Submit Queue 67adbc419d Merge pull request #30796 from derekwaynecarr/quota-bz
Automatic merge from submit-queue

Quota usage checking ignores unrelated resources

Scenario:

1. Create 4 services
2. Add a quota that limits services to 3
3. Create a pod

Expected result:
pod creation succeeds

Actual result:
pod creation fails stating that services exceed quota.

Fix:
less than or equal check should only verify resources pertinent to request.

Related:
https://bugzilla.redhat.com/show_bug.cgi?id=1367733
2016-08-20 04:57:05 -07:00
Kubernetes Submit Queue 010c976ce8 Merge pull request #30468 from jlowdermilk/feature-config
Automatic merge from submit-queue

Feature gates for kube-system components

Implements [this proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/runtimeconfig.md). Adds `--feature-gates` to apiserver, scheduler, controller-manager and proxy.

cc @lavalamp @adityakali
2016-08-19 18:15:19 -07:00
Kubernetes Submit Queue 0341d3d358 Merge pull request #30944 from ericchiang/oidc-auth-provider-dont-trim-issuer
Automatic merge from submit-queue

oidc auth provider: don't trim issuer URL

This mirrors a similar side fix for the API server authenticator.
Don't trim the issuer URL provided by the user since OpenID Connect
mandates that this URL exactly matches the URL returned by the
issuer during discovery.

This change only impacts clients attempting to connect to providers that
are non-spec compliant.

No test updates since this is already tested by the go-oidc client
package.

See: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation

Server side fix #29860
Updates #29749

cc @kubernetes/sig-auth @hanikesn
2016-08-19 15:48:46 -07:00
Kubernetes Submit Queue 248e508225 Merge pull request #30609 from m1093782566/update-comment-info
Automatic merge from submit-queue

update comment info for scheduler binding fails

Since the process logic for scheduler binding failed has changed, I think we should update the comment information to avoid make people confused :)

The related issue is #30611.

@wojtek-t What do you think about it ?

Thanks!
2016-08-19 15:47:33 -07:00
Jeff Lowdermilk 51198f59da Add --feature-gates to kube-system components
apiserver,scheduler,controller-manager,proxy,kubelet all get
flag. Using one variable to plumb through config via salt/init
scripts for GCE and GKE
2016-08-19 09:07:43 -07:00
Marcin Wielgus 2df92ff155 Cluster autoscaler friendly scheduling algorithm 2016-08-19 15:20:15 +02:00
Kubernetes Submit Queue 1f3a703df1 Merge pull request #30274 from mwielgus/best-fit
Automatic merge from submit-queue

ClusterAutoscaler-friendly scheduler priority function that promotes well-used nodes

It will help cluster autoscaler to put pods on nodes that are unlikely to be deleted soon due to low usage. Otherwise a pod may be frequently kicked from one node to another. A flag that enables it when CA is on will be added in a separate PR.

Fixes: #28842
2016-08-18 23:49:10 -07:00
Evan Cordell 711e3cff98 Add new admission controller: image policy webhook 2016-08-18 21:59:45 -04:00
Eric Chiang 3d2ee4e7be oidc auth provider: don't trim issuer URL
This mirrors a similar side fix for the API server authenticator.
Don't trim the issuer URL provided by the user since OpenID Connect
mandates that this URL exactly matches the URL returned by the
issuer during discovery.

Not test updates since this is already tested by the go-oidc client
package.

See: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationValidation
2016-08-18 16:37:50 -07:00
Clayton Coleman 5f8366aac3
Convert() should accept the new conversion Context value
Allows Convert() to reuse the same conversions as ConvertToVersion
without being overly coupled to the version.
2016-08-18 14:45:20 -04:00
Clayton Coleman 12a5eeea17
Introduce GroupVersioner for capturing desired target version
Convert single GV and lists of GVs into an interface that can handle
more complex scenarios (everything internal, nothing supported). Pass
the interface down into conversion.
2016-08-18 14:45:00 -04:00
deads2k 44808c64ae only compute delta on non-creating updates 2016-08-18 13:41:33 -04:00
Jan Safranek 82d35fb461 Add admission controller for default storage class.
The admission controller adds a default class to PVCs that do not require any
specific class. This way, users (=PVC authors) do not need to care about
storage classes, administrator can configure a default one and all these PVCs
that do not care about class will get the default one.
2016-08-18 18:55:35 +02:00
Kubernetes Submit Queue dc588e4451 Merge pull request #30257 from timstclair/aa-psp-annotations
Automatic merge from submit-queue

Add annotations to the PodSecurityPolicy Provider interface

@pweil- is this what you were thinking in terms of API changes? I really like to avoid functions with more than 2 return values, but couldn't think of a cleaner approach in this case.
2016-08-18 07:12:45 -07:00
Kubernetes Submit Queue 214c916045 Merge pull request #30585 from m1093782566/remotve-duplicated-assignment
Automatic merge from submit-queue

remove duplicated nodeinfo.pods assignment

There are duplicated assignments for nodeinfo.pods, one place is [here](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/schedulercache/node_info.go#L139) and the other one is [here](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/schedulercache/node_info.go#L147). 

I think we can remove one.

The related issue is #30610
2016-08-18 01:29:20 -07:00
Marcin Wielgus de2fea95ca ClusterAutoscaler-friendly scheduler priority function that promotes well-used nodes. 2016-08-18 08:34:10 +02:00
derekwaynecarr 307832dbec Quota usage checking ignores unrelated resources 2016-08-17 16:25:25 -04:00
Tim St. Clair c99d7fddc1
Add alpha annotations support to the PodSecurityPolicy provider 2016-08-17 10:14:36 -07:00
m1093782566 40f5d64411 update comment info when scheduler bind fails
Change-Id: Idce89003fe408b713431d07a3300e3acd1af87a9
2016-08-16 20:23:26 +08:00
m1093782566 458f5bd7f2 improve pod log output format
Change-Id: I415dd97f14b507ebb8340eb853f935e1e90b7a53
2016-08-16 17:59:58 +08:00
Kubernetes Submit Queue 69419a145a Merge pull request #29802 from jfrazelle/fix-go-vet-errors
Automatic merge from submit-queue

fix go vet errors

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
```

This fixes the `go vet` errors brought about by go 1.7 testing re (#28742).

The are all pretty trivial and mostly related to literal composites.

also related to #16086
2016-08-15 13:10:08 -07:00
m1093782566 8f607394ee remove duplicated nodeinfo.pods assignment
Change-Id: I8b15624e1cf146ab1693938bbd6ab1c6be030724
2016-08-14 16:43:45 +08:00
Kubernetes Submit Queue c73b96d66d Merge pull request #25526 from lavalamp/fix-generated-code
Automatic merge from submit-queue

Fix code generators-- make scheme building composable

I needed to make some changes to make my other refactoring possible and this got rather large. 

We now provide a "SchemeBuilder" to help all of the api packages provide their scheme-building functions (addKnownTypes and friends) in a standardized way. This also allows generated deepcopies & conversions to be entirely self contained, the project will now build without them being present (as they can add themselves to the SchemeBuilder). (Although if you actually build without them, you will get reduced performance!)

Previously, there was no way to construct your own runtime.Scheme (e.g., to test), you had to use the api.Scheme object, which has all sorts of non-hermetic cruft in it. Now you can get everything from a package by calling the scheme builder's AddToScheme, including the generated functions, if they are present.

Next steps are to allow for declaring dependencies, and to standardize the registration & install code. (#25434)

<!-- 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/25526)
<!-- Reviewable:end -->
2016-08-11 22:38:29 -07:00
Daniel Smith f1fd638962 fix register.go files up + add test import 2016-08-11 17:06:54 -07:00
derekwaynecarr 5cca4b07c6 Quota admission errors if usage is negative 2016-08-11 11:26:59 -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
Eric Chiang e5d7f01b91 x509 authenticator: get groups from subject's organization field 2016-08-10 12:32:28 -07:00
Kubernetes Submit Queue f53a35fb76 Merge pull request #29147 from caesarxuchao/cut-client-repo-staging
Automatic merge from submit-queue

Cut the client repo, staging it in the main repo

Tracking issue: #28559
ref: https://github.com/kubernetes/kubernetes/pull/25978#issuecomment-232710174

This PR implements the plan a few of us came up with last week for cutting client into its own repo:
1. creating "_staging" (name is tentative) directory in the main repo, using a script to copy the client and its dependencies to this directory
2. periodically publishing the contents of this staging client to k8s.io/client-go repo
3. converting k8s components in the main repo to use the staged client. They should import the staged client as if the client were vendored. (i.e., the import line should be `import "k8s.io/client-go/<pacakge name>`). This requirement is to ease step 4.
4. In the future, removing the staging area, and vendoring the real client-go repo.

The advantage of having the staging area is that we can continuously run integration/e2e tests with the latest client repo and the latest main repo, without waiting for the client repo to be vendored back into the main repo. This staging area will exist until our test matrix is vendoring both the client and the server.

In the above plan, the tricky part is step 3. This PR achieves it by creating a symlink under ./vendor, pointing to the staging area, so packages in the main repo can refer to the client repo as if it's vendored. To prevent the godep tool from messing up the staging area, we export the staged client to GOPATH in hack/godep-save.sh so godep will think the client packages are local and won't attempt to manage ./vendor/k8s.io/client-go.

This is a POC. We'll rearrange the directory layout of the client before merge.

@thockin @lavalamp @bgrant0607 @kubernetes/sig-api-machinery

<!-- 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/29147)
<!-- Reviewable:end -->
2016-08-09 17:12:14 -07:00
Chao Xu 51c0271e0a added a e2e test that uses the staged client; made necessary changes to gcp auth plugin to pass the gke tests 2016-08-09 14:07:54 -07:00
mksalawa 2749ec7555 Create PredicateFailureReason, modify scheduler predicate interface. 2016-08-09 14:01:46 +02:00
derekwaynecarr a672a986e3 Admission control errors should have consistent lower casing 2016-08-08 10:31:23 -04:00
Kubernetes Submit Queue faffbe4e18 Merge pull request #29622 from rootfs/rbd-ro
Automatic merge from submit-queue

allow a read-only rbd image mounted by multiple pods

allow pod to run read-only rbd volume 
fix #27725
2016-08-07 17:03:39 -07:00
Kubernetes Submit Queue e19ea41a5e Merge pull request #30136 from m1093782566/master
Automatic merge from submit-queue

remove useless value copy

Copy something to values in parameters won't change them in go. So, remove it to avoid making people confused.
2016-08-07 16:06:23 -07:00
Huamin Chen 730db45eab allow a read-only rbd image mounted by multiple pods
Signed-off-by: Huamin Chen <hchen@redhat.com>
2016-08-07 10:32:26 -04:00
Kubernetes Submit Queue 711b63e78b Merge pull request #28104 from ping035627/ping035627-patch-4
Automatic merge from submit-queue

SchedulerExtender: add failedPredicateMap in Filter() returns

Fix #25797. modify extender.Filter for adding extenders information to “failedPredicateMap” in findNodesThatFit.
When all the filtered nodes that passed "predicateFuncs" don’t pass the extenders filter, the failedPredicateMap hasn’t the extenders information, should add it, I think. So when the length of the “filteredNodes.Items” is 0, we can know the integral information. (The length of the “filteredNodes.Items” is 0, may be because the extenders filter failed.)
2016-08-06 20:50:33 -07:00
Chao Xu a771578a1c move pkg/util/ files to their own package to reduce client-go dependencies 2016-08-05 23:32:02 -07:00
Kubernetes Submit Queue 2537f66f0e Merge pull request #29230 from luxas/goimport
Automatic merge from submit-queue

Run goimport for the whole repo

While removing GOMAXPROC and running goimports, I noticed quite a lot of other files also needed a goimport format. Didn't commit `*.generated.go`, `*.deepcopy.go` or files in `vendor`

This is more for testing if it builds.
The only strange thing here is the gopkg.in/gcfg.v1 => github.com/scalingdata/gcfg replace.
cc @jfrazelle @thockin
2016-08-05 16:22:01 -07:00
deads2k 32920b5617 add subjectaccessreviews resource 2016-08-05 11:20:56 -04:00
m1093782566 91f6b7bc2b remove ineffective copy 2016-08-05 20:43:40 +08:00
Kubernetes Submit Queue 353df20854 Merge pull request #29926 from derekwaynecarr/ns_lifecycle_informer
Automatic merge from submit-queue

Move NamespaceLifecycle to use shared informers

This was a follow-up to https://github.com/kubernetes/kubernetes/pull/29634

Moves the `NamespaceLifecycle` plug-in to a shared infomer cache.

/cc @kubernetes/rh-cluster-infra @deads2k @hodovska
2016-08-04 19:22:59 -07:00
Kubernetes Submit Queue 5230bb7a8e Merge pull request #29860 from ericchiang/fix-openid-connect-provider-with-trailing-slash
Automatic merge from submit-queue

oidc authentication plugin: don't trim issuer URLs with trailing slashes

The issuer URL passed to the plugin must identically match the issuer
URL returned by OpenID Connect discovery. However, the plugin currently
trims all trailing slashes from issuer URLs, causing a mismatch. Since
the go-oidc client already handles this case correctly, don't trim the
path.

Closes #29749

cc @hanikesn @kubernetes/sig-auth
2016-08-04 16:25:49 -07:00
derekwaynecarr 4c37a813df Move NamespaceLifecycle to use shared informers 2016-08-04 11:01:09 -04:00
Kubernetes Submit Queue 2ff8280123 Merge pull request #29915 from wojtek-t/prepare_for_controller_ref_in_scheduler
Automatic merge from submit-queue

Prepare for using "ControllerRef" in scheduler

This is part of a PR that I already have to avoid a bunch of rebases in the future (controller ref probably won't happen in 1.4 release).

@davidopp
2016-08-04 02:23:31 -07:00
Kubernetes Submit Queue 5273ac9b94 Merge pull request #29912 from wojtek-t/enable_pod_affinity
Automatic merge from submit-queue

Enable PodAffinity by default in scheduler

Ref #26144

@gmarek - FYI
2016-08-04 01:51:17 -07:00
PingWang 4106eb70b0 modify extends.Filter
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

Add docs

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

add docs for ExtenderFilterResult.FailedNodes in types.go

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

Modify the extender.Filter test.

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

Update extender_test.go

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

modify the comments

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

gofmt -s scheduler_interface.go

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update the comments

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-04 14:03:32 +08:00
Kubernetes Submit Queue 544851a19f Merge pull request #29796 from deads2k/token-review
Automatic merge from submit-queue

Token review endpoint

Unrevert of #28788, which was rolled back because of https://github.com/kubernetes/kubernetes/issues/29375


@cjcullen @wojtek-t I'd like to remerge if possible.  Have we gotten the field checking mentioned here relaxed? https://github.com/kubernetes/kubernetes/pull/28788#discussion_r71918442
2016-08-03 20:48:31 -07:00
deads2k 60dd4a5d26 interesting changes to add tokenreviews endpoint to implement webhook 2016-08-03 08:37:45 -04:00
deads2k 1e7adaa5c0 allow restricting subresource access 2016-08-03 08:19:57 -04:00
Wojciech Tyczynski c092e15edf SelectorSpreading using controllerRef. 2016-08-02 16:24:48 +02:00
k8s-merge-robot ac3e8303f5 Merge pull request #29634 from derekwaynecarr/fix-flake-in-admission
Automatic merge from submit-queue

Fix usage of namespace shared informers in existing admission controllers

Fixes https://github.com/kubernetes/kubernetes/issues/29473

/cc @liggitt @ncdc
2016-08-02 06:51:17 -07:00
Wojciech Tyczynski 022719b323 Enable PodAffinity by default in scheduler 2016-08-02 15:06:45 +02:00
Lucas Käldström c88a07ce1a Run goimports 2016-08-02 15:12:39 +03:00
Wojciech Tyczynski 4bc410e47a Speedup pod affintiy predicate function 2016-08-02 08:01:04 +02:00
Eric Chiang bc3dc12203 oidc authentication plugin: don't trim issuer URLs with trailing slashes
The issuer URL passed to the plugin must identically match the issuer
URL returned by OpenID Connect discovery. However, the plugin currently
trims all trailing slashes from issuer URLs, causing a mismatch. Since
the go-oidc client already handles this case correctly, don't trim the
path.
2016-08-01 11:23:05 -07:00
derekwaynecarr 0339ef7961 Fix usage of shared informer in namespace admission controllers 2016-08-01 13:40:34 -04:00
k8s-merge-robot 821ff657f9 Merge pull request #27199 from derekwaynecarr/disk_eviction
Automatic merge from submit-queue

Initial support for pod eviction based on disk

This PR adds the following:

1. node reports disk pressure condition based on configured thresholds
1. scheduler does not place pods on nodes reporting disk pressure
1. kubelet will not admit any pod when it reports disk pressure
1. kubelet ranks pods for eviction when low on disk
1. kubelet evicts greediest pod

Follow-on PRs will need to handle:

1. integrate with new image gc PR (https://github.com/kubernetes/kubernetes/pull/27199)
1. container gc policy should always run (will not be launched from eviction, tbd who does that)
  1. this means kill pod is fine for all eviction code paths since container gc will remove dead container
1. min reclaim support will just poll summary provider (derek will do follow-on)
1. need to know if imagefs is same device as rootfs from summary (derek follow-on)

/cc @vishh @kubernetes/sig-node
2016-07-28 20:18:54 -07:00
k8s-merge-robot 27af240d4f Merge pull request #29539 from wojtek-t/optimize_pod_affinity_3
Automatic merge from submit-queue

Optimize PodAffinity priority function
2016-07-28 16:59:30 -07:00
derekwaynecarr 0de1e62b30 modify fsStats to fsStatsType to avoid confusion with cadvisor types 2016-07-28 16:01:38 -04:00
derekwaynecarr 9604b47c13 Scheduler does not place pods on nodes that have disk pressure 2016-07-28 16:01:38 -04:00
Wojciech Tyczynski d3b9d583a2 Optimize PodAffinity priority function. 2016-07-28 16:57:28 +02:00
Wojciech Tyczynski 898a6444e3 Return pointer for Affinity in api helper 2016-07-28 16:57:28 +02:00
k8s-merge-robot e008087e0a Merge pull request #29457 from derekwaynecarr/service-node-port-quota-fix
Automatic merge from submit-queue

Quota was not counting services with multiple nodeports properly

```release-note
If a service of type node port declares multiple ports, quota on "services.nodeports" will charge for each port in the service.
```

Fixes https://github.com/kubernetes/kubernetes/issues/29456

/cc @kubernetes/rh-cluster-infra @sdminonne
2016-07-27 18:09:40 -07:00
k8s-merge-robot 3301f6d14f Merge pull request #29356 from smarterclayton/init_containers
Automatic merge from submit-queue

LimitRanger and PodSecurityPolicy need to check more on init containers

Container limits not applied to init containers. HostPorts not checked on podsecuritypolicy

@pweil- @derekwaynecarr
2016-07-27 16:09:34 -07:00
Wojciech Tyczynski a63cccfafc Cache pods with pod (anti)affinity constraints 2016-07-27 17:31:53 +02:00
derekwaynecarr 09c97a2acc Disable flaky unit test in admission plugin in NamespaceAutoProvision 2016-07-26 17:36:14 -04:00
k8s-merge-robot df2cf16ddb Merge pull request #26709 from hodovska/master
Automatic merge from submit-queue

Allow shareable resources for admission control plugins.

Changes allow admission control plugins to share resources. This is done via new PluginInitialization structure. The structure can be extended for other resources, for now it is an shared informer for namespace plugins (NamespiceLifecycle, NamespaceAutoProvisioning, NamespaceExists).

If a plugins needs some kind of shared resource e.g. client, the client shall be added to PluginInitializer and Wants methods implemented to every plugin which will use it.
2016-07-22 11:07:05 -07:00
derekwaynecarr 305411b59b Fix bug in node port counting in quota not counting multi-node ports 2016-07-22 13:56:55 -04:00
k8s-merge-robot 6fd685b54b Merge pull request #29207 from fgrzadkowski/ha_master_leader_elect
Automatic merge from submit-queue

Add default leader election for scheduler and controller manager.

#21124
2016-07-22 04:49:44 -07:00
Wojciech Tyczynski fad876b6f9 PodAffinity code refinements 2016-07-22 08:49:28 +02:00
Dominika Hodovska 037d116add Factory for SharedIndexInformers 2016-07-21 14:04:48 +02:00
k8s-merge-robot 9b1f3efab4 Merge pull request #29261 from wojtek-t/improve_scheduler_throughput
Automatic merge from submit-queue

Improve scheduler throughput

Ref #28590

This improves scheduler throughput by another 10-15%.

@davidopp @kubernetes/sig-scheduling
2016-07-21 03:16:15 -07:00
Wojciech Tyczynski 4d0d115690 Revert "add tokenreviews endpoint to implement webhook" 2016-07-21 09:40:35 +02:00
Wojciech Tyczynski fc6d38baa2 Avoid locking when computing predicates. 2016-07-21 08:21:07 +02:00
Wojciech Tyczynski cab7db3a64 Use []*api.Node instead of NodeLister in priority functions. 2016-07-21 08:21:07 +02:00
Clayton Coleman 522930b39d
Init containers are not respected in initial resources
Seeds init containers just like regular containers
2016-07-20 23:19:38 -04:00
Clayton Coleman 51f4d7c5fb
Container limits are not applied to InitContainers
InitContainers should be checked against limit rangers
2016-07-20 23:19:38 -04:00
Clayton Coleman affd79fdc0
InitContainers are not checked for hostPort ranges
PodSecurityPolicy must verify that host port ranges are guarded on init
containers.
2016-07-20 23:19:34 -04:00
deads2k 2c4a9f2e8d interesting changes to add tokenreviews endpoint to implement webhook 2016-07-20 15:11:56 -04:00
mksalawa fea8d0aebf Fix generic scheduler test 2016-07-20 14:47:44 +02:00
Dominika Hodovska fc0a3c6dcb Allow shareable resources for admission control plugins 2016-07-20 12:53:52 +02:00
Filip Grzadkowski 69e9786383 Change defaults for leader election for scheduler and controller manager 2016-07-20 11:36:15 +02:00
Davanum Srinivas ee8507a5ae Use Infof/Warningf when appropriate
When we use a format string, we should use Infof/Warningf instead
of Info/Warning
2016-07-19 12:10:53 -04:00
k8s-merge-robot 4466531382 Merge pull request #29094 from luxas/gomaxproc
Automatic merge from submit-queue

Remove GOMAXPROCS() calls because they are unnecessary


Now we're setting GOMAXPROCS when every binary starts up, but we don't have to do that anymore, since we've upgraded to Go 1.6

Documentation for it:

> func GOMAXPROCS(n int) int

> GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously and returns the previous setting. If n < 1, it does not change the current setting. The number of logical CPUs on the local machine can be queried with NumCPU. This call will go away when the scheduler improves. 

A simple program to prove it's unnecessary:

```go
package main
import (
    "fmt"
    "runtime"
)
func main(){
    numCPUBefore := runtime.GOMAXPROCS(runtime.NumCPU())
    numCPUAfter := runtime.GOMAXPROCS(runtime.NumCPU())
    fmt.Println(numCPUBefore, numCPUAfter)
}
```

Output with Go 1.4.2: `1 4`
Output with Go 1.6.2: `4 4`

So I think we should remove calls to GOMAXPROCS now, and it should be pretty straightforward

@thockin @wojtek-t @gmarek @lavalamp @vishh
2016-07-19 08:11:24 -07:00
k8s-merge-robot 9a7507c4db Merge pull request #29186 from wojtek-t/cleanup_resource_request
Automatic merge from submit-queue

Reuse existing Resource struct instead of new resourceRequest

@davidopp
2016-07-19 07:31:19 -07:00
k8s-merge-robot b0bcb8f7b2 Merge pull request #29100 from wojtek-t/pods_can_never_be_scheduled_again
Automatic merge from submit-queue

Fix disappearing pods in scheduler

Fix #29098
2016-07-19 03:26:16 -07:00
Wojciech Tyczynski dcb5a6d1a6 Reuse existing Resource struct instead of new resourceRequest 2016-07-19 12:21:09 +02:00
Lucas Käldström 88ea80b572 Remove GOMAXPROCS() calls because they are unnecessary 2016-07-19 11:08:21 +03:00
Wojciech Tyczynski 66009877bc Fix disappearing pods in scheduler 2016-07-19 08:18:04 +02:00
k8s-merge-robot a049a97820 Merge pull request #28803 from lukaszo/ds
Automatic merge from submit-queue

Make Daemonset use GeneralPredicates

fixes: #21454 #22205
2016-07-18 22:12:14 -07:00
k8s-merge-robot 8d46d9b0c7 Merge pull request #28281 from nhlfr/authorize-return-bool
Automatic merge from submit-queue

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 21:40:26 -07:00
k8s-merge-robot 6d09ba41e9 Merge pull request #29044 from lixiaobing10051267/masterWebHook
Automatic merge from submit-queue

Func note not consistent with real fun name

File "plugin\pkg\webhook.go", line #41 :
"// New creates a new GenericWebhook from the provided kubeconfig file."
Here "New" not consistant with real fun name "NewGenericWebhook" in line #42 :
"func NewGenericWebhook(kubeConfigFile string, groupVersions []unversioned.GroupVersion, initialBackoff time.Duration) (*GenericWebhook, error) {"
2016-07-18 10:13:05 -07: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
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
Clayton Coleman e2afc97587
Add init containers to PSP admission
Treat them just like regular containers.
2016-05-18 22:32:22 -04:00
Bobby Rullo f575f89cd7 add tests for the OIDC WrapTransport
tests that tokens gets refreshed, passed along as bearers, etc.
2016-05-18 17:03:12 -07:00
Bobby Rullo 94ffa344a8 OIDC authprovider more testable, and add backoff
* Use an interface for OIDC Client, so that we're testing the behavior
  of the client, not the go-oidc package itself
* add backoff and retry when server rejects token
2016-05-18 17:03:12 -07:00
Bobby Rullo e85940ed17 add tests for newOIDCAuthProvider 2016-05-18 17:03:11 -07:00
Bobby Rullo c990462d0f Refactor test oidc provider into its own package
This makes it easier to test other OIDC code.
2016-05-18 17:03:11 -07:00
Bobby Rullo f2135bdf90 Implement new OIDC client AuthProvider
This commit handles:
     * Passing ID Token as Bearer token
     * Refreshing of tokens using refresh-tokens
     * Persisting refreshed tokens
     * ability to add arbitrary extra scopes via config
       * this is what enables the cross-client/azp stuff
2016-05-18 17:02:48 -07:00
CJ Cullen 57f96a932f Add expiration LRU cache for webhook token authenticator. 2016-05-18 11:58:11 -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 66d0d87829 Make IsValidLabelValue return error strings 2016-05-17 21:36:10 -07:00
root 74901ae150 No need to log empty string 2016-05-17 10:01:37 -04:00
Filip Grzadkowski 9cba3fc5ae Stop setting Message when updating PodScheduled condition 2016-05-17 15:27:43 +02:00
Clayton Coleman f2008152f4
Update limit ranging to handle init containers 2016-05-17 00:29:54 -04:00
Clayton Coleman 1b6591312d
Update the scheduler to handle init containers 2016-05-17 00:29:54 -04:00
k8s-merge-robot c20dcfc406 Merge pull request #25641 from ping035627/master
Automatic merge from submit-queue

Improve fatal error description in plugins.go of scheduler

The PR add more information for the fatal error in plugins.go of scheduler.
2016-05-16 01:45:58 -07:00
PingWang cefaa06a43 Improve fatal error description in plugins.go of scheduler
The PR add more information to fatal error in plugins.go of scheduler.
2016-05-16 10:58:07 +08: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
Jeff Lowdermilk 1661df4554 Merge pull request #25487 from derekwaynecarr/verify_resources
pod constraints func for quota validates resources
2016-05-13 15:07:23 -07:00
PingWang 82009eb5db A optimization for “RegisterCustomFitPredicate” function, avoiding redundancy
In RegisterCustomFitPredicate, when policy.Argument is nil and fitPredicateMap has the policy.Name, it can return the policy.Name directly. Subsequent operations are redundant.
2016-05-13 12:40:13 +08: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
k8s-merge-robot 667f586083 Merge pull request #25196 from luxas/auto_create_kube_system
Automatic merge from submit-queue

Automatically create the kube-system namespace

At the same time we ensure that the `default` namespace is present, it also creates `kube-system` if it doesn't exist.

`kube-system` will now exist from the beginning, and will be recreated every 10s if deleted, in the same manner as the `default` ns

This makes UX much better, no need for `kubectl`ing a `kube-system.yaml` file anymore for a function that is essential to Kubernetes (addons). For instance, this makes dashboard deployment much easier when there's no need to check for the `kube-system` ns first.

A follow up in the future may remove places where logic to manually create the kube-system namespace is present.

Also fixed a small bug where `CreateNamespaceIfNeeded` ignored the `ns` parameter and was hardcoded to `api.NamespaceDefault`.

@davidopp @lavalamp @thockin @mikedanese @bryk @cheld @fgrzadkowski @smarterclayton @wojtek-t @dlorenc @vishh @dchen1107 @bgrant0607 @roberthbailey

<!-- 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/25196)
<!-- Reviewable:end -->
2016-05-12 11:17:09 -07:00
k8s-merge-robot 132ebb091a Merge pull request #24459 from fgrzadkowski/unschedulable_pod
Automatic merge from submit-queue

Add pod condition PodScheduled to detect situation when scheduler tried to schedule a Pod, but failed

Set `PodSchedule` condition to `ConditionFalse` in `scheduleOne()` if scheduling failed and to `ConditionTrue` in `/bind` subresource.

Ref #24404

@mml (as it seems to be related to "why pending" effort)

<!-- 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/24459)
<!-- Reviewable:end -->
2016-05-12 05:54:06 -07:00
Filip Grzadkowski a80b1798c4 Add pod condition PodScheduled to detect situation
when scheduler tried to schedule a Pod, but failed.

Ref #24404
2016-05-12 10:21:21 +02:00
k8s-merge-robot 0ef4c6407b Merge pull request #24902 from cjcullen/webhookAuthn
Automatic merge from submit-queue

Webhook Token Authenticator

Add a webhook token authenticator plugin to allow a remote service to make authentication decisions.
2016-05-11 22:08:58 -07:00
Paul Weil 4970f0c02d PSP admission 2016-05-11 18:07:36 -04:00
Paul Weil 56193b7140 PSP types 2016-05-11 18:07:35 -04:00
derekwaynecarr 8b8a22b143 pod constraints func for quota validates resources 2016-05-11 14:30:46 -04:00
derekwaynecarr fc3e71894d Improve quota integration test to not use events, reduce number of pods provisioned 2016-05-10 19:50:36 -04:00
CJ Cullen eb3b0e78b4 Add a webhook token authenticator plugin. 2016-05-10 14:54:35 -07:00
CJ Cullen 1d096d29cb Pull common webhook code into generic webhook plugin. 2016-05-10 14:41:14 -07:00
Tim Hockin 72955770f3 Make IsQualifiedName return error strings 2016-05-10 11:23:23 -07:00
k8s-merge-robot dee24333ff Merge pull request #25161 from derekwaynecarr/format_quota_error
Automatic merge from submit-queue

Sort resources in quota errors to avoid duplicate events

Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1333122

Errors describing why a request was rejected to quota would get variable responses (cpu=x,memory=y or memory=x,cpu=y) which caused duplicate events for the same root cause.

/cc @ncdc @jwforres
2016-05-10 04:39:11 -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
Kevin b7014561c1 Add admission controller to limit pod anti affinity topologykey to node level 2016-05-09 12:23:41 +00:00
k8s-merge-robot f40fe7173b Merge pull request #24304 from cjcullen/cacheauth
Automatic merge from submit-queue

Support persisting config from kubecfg AuthProvider plugins

Plumbs through an interface to the plugin that can persist a `map[string]string` config for just that plugin. Also adds `config` to the AuthProvider serialization type, and `Login()` to the AuthProvider plugin interface.
Modified the gcp AuthProvider to cache short-term access tokens in the kubecfg file.

Builds on #23066 
@bobbyrullo @deads2k @jlowdermilk @erictune
2016-05-08 13:27:57 -07:00
k8s-merge-robot 5988080396 Merge pull request #23795 from mqliang/rc-ns-index
Automatic merge from submit-queue

add namespace index for cache

@wojtek-t 

Implement in this approach make the change of lister.go small, but we should replace all `NewInformer()` to `NewIndexInformer()`, even when someone not want to filter by namespace(eg. gc_controller and scheduler). Any suggestion?
2016-05-08 12:09:01 -07:00
CJ Cullen 13a7d92d0f Add a ConfigPersister for AuthProvider plugins in kubectl/clients. 2016-05-07 18:15:18 -07:00
David Oppenheimer b0bd3ff167 Move inter-pod affinity predicate and priority functions from default to
non-default due to negative performance effects even when not using
the feature.
2016-05-07 16:57:07 -07:00
derekwaynecarr ca7a8b50e6 Sort resources in quota errors to avoid duplicate events 2016-05-06 17:44:28 -04:00
Wojciech Tyczynski a51f266ebf Remove nodeName from predicate signature. 2016-05-06 11:23:37 +02:00
mqliang 9011207f18 add namespace index to rc and pod 2016-05-06 17:12:36 +08:00
Kevin 82ba4f077e implement inter pod topological affinity and anti-affinity 2016-05-06 06:46:23 +00:00
Lucas Käldström 8ea3a9319c Automatically create the kube-system namespace 2016-05-05 22:27:49 +03:00
Clayton Coleman e0ebcf4216
Split the storage and negotiation parts of Codecs
The codec factory should support two distinct interfaces - negotiating
for a serializer with a client, vs reading or writing data to a storage
form (etcd, disk, etc). Make the EncodeForVersion and DecodeToVersion
methods only take Encoder and Decoder, and slight refactoring elsewhere.

In the storage factory, use a content type to control what serializer to
pick, and use the universal deserializer. This ensures that storage can
read JSON (which might be from older objects) while only writing
protobuf. Add exceptions for those resources that may not be able to
write to protobuf (specifically third party resources, but potentially
others in the future).
2016-05-05 12:08:23 -04:00
Wojciech Tyczynski 3aadafd411 Use NegotiatedSerializer in client 2016-05-04 10:57:36 +02:00
Clayton Coleman fdb110c859
Fix the rest of the code 2016-04-29 17:12:10 -04:00
k8s-merge-robot 2347d0f047 Merge pull request #24601 from deads2k/qualify-admission-attributes
Automatic merge from submit-queue

fully qualify admission resources and kinds

Fully qualifies the `Kind` and `Resource` fields for admission attributes.  The information was getting filtered at the `RESTHandler` before.

@derekwaynecarr
2016-04-28 05:12:28 -07:00
k8s-merge-robot 00308f7a9f Merge pull request #24598 from wojtek-t/improve_scheduler_predicates
Automatic merge from submit-queue

Store node information in NodeInfo

This is significantly improving scheduler throughput.

On 1000-node cluster:
- empty cluster: ~70pods/s
- full cluster: ~45pods/s
Drop in throughput is mostly related to priority functions, which I will be looking into next (I already have some PR #24095, but we need for more things before).

This is roughly ~40% increase.
However, we still need better understanding of predicate function, because in my opinion it should be even faster as it is now. I'm going to look into it next week.

@gmarek @hongchaodeng @xiang90
2016-04-28 02:17:59 -07:00
k8s-merge-robot d0b887e4e0 Merge pull request #24595 from zhouhaibing089/httpserverclose
Automatic merge from submit-queue

Uncomment the code that caused by #19254

Fix https://github.com/kubernetes/kubernetes/issues/24546.

@lavalamp
2016-04-28 01:41:16 -07:00
k8s-merge-robot c7d1637a0b Merge pull request #24525 from wojtek-t/scheduler_traces
Automatic merge from submit-queue

Add traces to scheduler

This will simplify performance debugging of scheduler.

@davidopp @hongchaodeng @xiang90
2016-04-27 07:16:07 -07:00
deads2k 0061479890 fully qualify admission resources and kinds 2016-04-26 07:55:33 -04:00
zhouhaibing089 bf1a3f99c0 Uncomment the code that cause by #19254 2016-04-25 23:21:31 +08:00
deads2k d3c6363093 use single writer to improve quota performance 2016-04-25 10:42:26 -04:00
Wojciech Tyczynski 1835c8528d Store node information in NodeInfo 2016-04-25 10:08:05 +02:00
k8s-merge-robot c5df0bf23e Merge pull request #24502 from cjcullen/subresource
Automatic merge from submit-queue

Add Subresource & Name to webhook authorizer.

Pass through the Subresource and Name fields from the `authorization.Attributes` to the `SubjectAccessReviewSpec.ResourceAttributes`.
2016-04-24 01:14:43 -07:00
k8s-merge-robot 733832c15a Merge pull request #24377 from hongchaodeng/sched
Automatic merge from submit-queue

schedulercache: remove bind() from AssumePod

Due to #24197, we make bind() asynchronous and don't need it anymore.
Submit this PR to clean it up.
2016-04-23 02:19:48 -07:00
gmarek e0712f7e57 Fix MaxPods feature in scheduler 2016-04-22 22:49:50 +02:00
k8s-merge-robot f4beccf000 Merge pull request #23066 from cjcullen/clientplugin
Automatic merge from submit-queue

Client auth provider plugin framework

Allows client plugins to modify the underlying transport to, for example, add custom authorization headers.
2016-04-21 17:30:28 -07:00
k8s-merge-robot 34fc7f0401 Merge pull request #24461 from wojtek-t/enable_components_to_use_protobufs
Automatic merge from submit-queue

Allow components to use protobufs while talking to apiserver.
2016-04-21 12:46:17 -07:00
Wojciech Tyczynski d6896fa45a Allow setting content-type in binaries 2016-04-21 14:12:13 +02:00
Chao Xu 8537095415 use fully qualified resource in fake clients actions 2016-04-20 19:44:40 -07:00
Wojciech Tyczynski 80901a5542 Add traces to scheduler 2016-04-20 15:19:19 +02:00
Wojciech Tyczynski a4b3f47347 Add RC and container pors to scheduler benchmark 2016-04-20 15:10:57 +02:00
CJ Cullen e53aa93836 Add Subresource & Name to webhook authorizer. 2016-04-19 21:43:40 -07:00
HaiyangDING a5efb009c5 change predicate error format. 2016-04-17 08:48:03 +08:00
k8s-merge-robot 7664509c73 Merge pull request #24248 from wojtek-t/parallel_predicates
Automatic merge from submit-queue

Parallelize computing predicates in scheduler

@davidopp
2016-04-16 09:51:45 -07:00
Hongchao Deng 1eb331e009 schedulercache: remove bind() from AssumePod 2016-04-16 20:30:28 +08:00
CJ Cullen 03f9b5adc0 Add client auth plugin framework for kubectl with GCP auth plugin. 2016-04-14 17:49:16 -07:00
Wojciech Tyczynski 5a73a9d235 Parallelize computing predicates 2016-04-14 16:32:52 +02:00
Wojciech Tyczynski 545bf184ef Simplify FailedPredicateMap 2016-04-14 10:58:35 +02:00
Wojciech Tyczynski 254b05761f Asynchronous bindings 2016-04-14 09:52:25 +02:00
goltermann a3104ba96c Final vet fixes; enabling vet checks in verify scripts. 2016-04-13 13:51:51 -07:00
k8s-merge-robot 8eb19c7889 Merge pull request #22154 from sdminonne/service_nodeports_quotas
Automatic merge from submit-queue

Adding nodeports services to quota

To fix #21677
@derekwaynecarr
2016-04-13 05:50:27 -07:00
k8s-merge-robot e93c0d727f Merge pull request #20204 from HaiyangDING/predlib
Automatic merge from submit-queue

Move predicates into library

This PR tries to implement #12744 

Any suggestions/ideas are welcome. @davidopp 

current state: integration test fails if including podCount check in Kubelet.
    
DONE:
    1. refactor all predicates: predicates return fitOrNot(bool) and error(Error) in which the latter is of type PredicateFailureError or InsufficientResourceError
    2. GeneralPredicates() is a predicate function, which includes serveral other predicate functions (PodFitsResource, PodFitsHost, PodFitsHostPort). It is registered as one of the predicates in DefaultAlgorithmProvider, and is also called in canAdmitPod() in Kubelet and should be called by other components (like rescheduler, etc if necessary. See discussion in issue #12744
TODO:
    1. determine which predicates should be included in GeneralPredicates()
    2. separate GeneralPredicates() into: a.) GeneralPredicatesEvictPod() and b.) GeneralPredicatesNotEvictPod()
    3. DaemonSet should use GeneralPredicates()
2016-04-12 07:44:45 -07:00
Salvatore Dario Minonne 15b7577454 Adding nodeports services to quota 2016-04-12 11:09:16 +02:00
k8s-merge-robot bf0e6e0047 Merge pull request #23261 from hongchaodeng/sched
Automatic merge from submit-queue

kube-scheduler: cleanup duplicate GetAlgorithmProvider()

See [here](ae88f08af0/plugin/pkg/scheduler/factory/factory.go (L177-L180)).
The check is duplicate since CreateFromProvider will also do it.
2016-04-11 10:01:16 -07:00
HaiyangDING 41ed85479a move predicates into library (address #12744)
DONE:
1. refactor all predicates: predicates return fitOrNot(bool) and error(Error) in which the latter is of type
	PredicateFailureError or InsufficientResourceError. (For violation of either MaxEBSVolumeCount or
        MaxGCEPDVolumeCount, returns one same error type as ErrMaxVolumeCountExceeded)
2. GeneralPredicates() is a predicate function, which includes serveral other predicate functions (PodFitsResource,
        PodFitsHost, PodFitsHostPort). It is registered as one of the predicates in DefaultAlgorithmProvider, and
        is also called in canAdmitPod() in Kubelet and should be called by other components (like rescheduler, etc)
        if necessary. See discussion in issue #12744
3. remove podNumber check from GeneralPredicates
4. HostName is now verified in Kubelet's canAdminPod(). add TestHostNameConflicts in kubelet_test.go
5. add getNodeAnyWay() method in Kubelet to get node information in standaloneMode

TODO:
1. determine which predicates should be included in GeneralPredicates()
2. separate GeneralPredicates() into:
	a. GeneralPredicatesEvictPod() and
	b. GeneralPredicatesNotEvictPod()
3. DaemonSet should use GeneralPredicates()
2016-04-11 00:57:03 +08:00
Jeff Lowdermilk 524bfde377 Merge pull request #23883 from liggitt/attis
Externalize immortal namespaces
2016-04-08 20:56:04 -07:00
Jeff Lowdermilk 2fb745f01d Merge pull request #23661 from spxtr/oidc
Remove retries from most oidc tests.
2016-04-08 14:33:34 -07:00
Joe Finney ae79677fd0
Remove global var for OIDC retry/backoff, and remove retries from unit tests. 2016-04-07 14:18:29 -07:00
Jordan Liggitt bef1d6e82e Externalize immortal namespaces 2016-04-05 16:28:00 -04:00
Wojciech Tyczynski 2699be2e7e Switch api.ObjetaMetaFor to meta.Accessor 2016-03-31 17:52:31 +02:00
k8s-merge-robot 1ad3049ed6 Merge pull request #23288 from smarterclayton/refactor_codec
Auto commit by PR queue bot
2016-03-26 10:47:58 -07:00
goltermann 32d569d6c7 Fixing all the "composite literal uses unkeyed fields" Vet errors. 2016-03-25 15:25:09 -07:00
k8s-merge-robot 79d1e53b94 Merge pull request #23428 from wojtek-t/fix_scheduler_test
Auto commit by PR queue bot
2016-03-25 06:17:19 -07:00
k8s-merge-robot 4e4ad61260 Merge pull request #23366 from goltermann/vet
Auto commit by PR queue bot
2016-03-24 21:50:56 -07:00
Wojciech Tyczynski 1471a5b96b Fix scheduler_test race 2016-03-24 12:31:57 +01:00
k8s-merge-robot 4bfd42bbc2 Merge pull request #23240 from zhouhaibing089/keystone_fix
Auto commit by PR queue bot
2016-03-24 00:17:18 -07:00
Clayton Coleman 54eaa56b92 Add a streaming and "raw" abstraction to codec factory 2016-03-23 17:25:20 -04:00
k8s-merge-robot 76369c42be Merge pull request #22939 from resouer/util-sub-dir
Auto commit by PR queue bot
2016-03-23 03:34:33 -07:00
k8s-merge-robot 6441e1fc33 Merge pull request #23280 from pweil-/limitrange-supportsfunc
Auto commit by PR queue bot
2016-03-22 22:00:47 -07:00
goltermann 34d4eaea08 Fixing several (but not all) go vet errors. Most are around string formatting, or unreachable code. 2016-03-22 17:26:50 -07:00
zhouhaibing089 83248a9783 move keystone package to password since it is a password authenticator 2016-03-22 23:27:28 +08:00
Wojciech Tyczynski ebcc8f737c Parallelize computing selector spreading priority in scheduler. 2016-03-22 14:09:58 +01:00
Paul Weil 14620447c1 allow supported resource overrides in the limitranger plugin 2016-03-21 13:03:18 -04:00
harry b0900bf0d4 Refactor diff into sub pkg 2016-03-21 20:21:39 +08:00
Harry Zhang a4d04095d0 Refactor crlf & crypto 2016-03-21 20:20:05 +08:00
Hongchao Deng dc91b82a3f kube-scheduler: cleanup duplicate GetAlgorithmProvider() 2016-03-20 14:29:10 -07:00
k8s-merge-robot e4dd8c1e1f Merge pull request #22852 from miminar/no-admit-without-namespace
Auto commit by PR queue bot
2016-03-18 16:09:28 -07:00
deads2k ab03317d96 support CIDRs in NO_PROXY 2016-03-16 16:22:54 -04:00
Phillip Wittrock 8a952748a1 Merge pull request #22942 from jsafrane/devel/aws-more-devices
Allow up to 39 PVs attached to AWS node
2016-03-15 12:41:15 -07:00
Jan Safranek f270cb1b9b Allow 39 atached EBS devices.
AWS has soft support limit for 40 attached EBS devices. Assuming there is just
one root device, use the rest for persistent volumes.

The devices will have name /dev/xvdba - /dev/xvdcm, leaving /dev/sda - /dev/sdz
to the system.

Also, add better error handling and propagate error
"Too many EBS volumes attached to node XYZ" to a pod.
2016-03-15 17:28:59 +01:00
Michal Minar 2601ee56ab Set a missing namespace on object to admit
Custom quota evaluators may need to query a target namespace of an input
object during quota admission check. For this, namespace needs to be
known.

Signed-off-by: Michal Minar <miminar@redhat.com>
2016-03-15 17:03:55 +01:00