Commit Graph

1029 Commits (e317af87cc4a4e085a2d08b9b443ce1f09e54c63)

Author SHA1 Message Date
deads2k cd5b6cc491 move StorageClass to its own group 2016-09-06 08:41:17 -04:00
Kubernetes Submit Queue dc8f384e3f Merge pull request #31627 from deads2k/quota-copy
Automatic merge from submit-queue

make deep copy of quota objects before mutations

The code currently makes shallow copies which ensures that we aren't accidentally reslicing anything in weird ways, but the usage maps are pointers, so they end up being shared.

This makes a couple copies when we know we're going to mutate to avoid changing shared maps.
2016-09-01 10:09:01 -07:00
Kubernetes Submit Queue be859b144d Merge pull request #30808 from smarterclayton/no_defaults
Automatic merge from submit-queue

ClientConfig should not default to http://localhost:8080

This changes clientcmd to skip the default cluster, but preserves the
behavior in kubectl. This prevents the possibility of an administrator
misconfiguration in kubelet or other server component from allowing a
third party who can bind to 8080 on that host from potentially
impersonating an API server and gaining root access.

@mikedanese @deads2k this removes the defaulting of http://localhost:8080 for server from everything except kubectl.



```release-note
Kubernetes server components using `kubeconfig` files no longer default to `http://localhost:8080`.  Administrators must specify a server value in their kubeconfig files.
```
2016-08-30 11:33:39 -07:00
Clayton Coleman 06cbb29e9e
ClientConfig should not default to http://localhost:8080
This changes clientcmd to skip the default cluster, but preserves the
behavior in kubectl. This prevents the possibility of an administrator
misconfiguration in kubelet or other server component from allowing a
third party who can bind to 8080 on that host from potentially
impersonating an API server and gaining root access.
2016-08-30 10:43:24 -04:00
deads2k 4317173d3f add names for workqueues to gather controller latency/depth metrics 2016-08-30 09:51:50 -04:00
deads2k f4380f6919 make deep copy of quota objects before mutations 2016-08-29 13:55:13 -04:00
Daniel Smith a291846cd1 Revert "Remove deprecated Namespace admission plug-ins" 2016-08-28 10:20:44 -07:00
derekwaynecarr c727fdc81f Remove deprecated namespace admission controllers 2016-08-26 11:14:55 -04:00
Piotr Szczesniak 2fb43eb68c Renamed influxdb to influxdata in Godeps 2016-08-26 14:07:51 +02:00
Kubernetes Submit Queue 785e9f24c5 Merge pull request #31122 from deads2k/add-quota-test
Automatic merge from submit-queue

add quota test for creating update requests

Adding a kube test for https://github.com/kubernetes/kubernetes/pull/30907 as requested in https://github.com/kubernetes/kubernetes/pull/30907#issuecomment-241139913 .
2016-08-25 08:21:50 -07:00
Kubernetes Submit Queue 4ddfc4849a Merge pull request #27180 from sttts/sysctl-implementation
Automatic merge from submit-queue

Add sysctl support

Implementation of proposal https://github.com/kubernetes/kubernetes/pull/26057, feature  https://github.com/kubernetes/features/issues/34

TODO:
- [x] change types.go
- [x] implement docker and rkt support
- [x] add e2e tests
- [x] decide whether we want apiserver validation
- ~~[ ] add documentation~~: api docs exist. Existing PodSecurityContext docs is very light and links back to the api docs anyway: 6684555ed9/docs/user-guide/security-context.md
- [x] change PodSecurityPolicy in types.go
- [x] write admission controller support for PodSecurityPolicy
- [x] write e2e test for PodSecurityPolicy
- [x] make sure we are compatible in the sense of https://github.com/kubernetes/kubernetes/blob/master/docs/devel/api_changes.md
- [x] test e2e with rkt: it only works with kubenet, not with no-op network plugin. The later has no sysctl support.
- ~~[ ] add RunC implementation~~ (~~if that is already in kube,~~ it isn't)
- [x] update whitelist
- [x] switch PSC fields to annotations
- [x] switch PSP fields to annotations
- [x] decide about `--experimental-whitelist-sysctl` flag to be additive or absolute
- [x] decide whether to add a sysctl node whitelist annotation

### Release notes:

```release-note
The pod annotation `security.alpha.kubernetes.io/sysctls` now allows customization of namespaced and well isolated kernel parameters (sysctls), starting with `kernel.shm_rmid_forced`, `net.ipv4.ip_local_port_range`, `net.ipv4.tcp_max_syn_backlog` and `net.ipv4.tcp_syncookies` for Kubernetes 1.4.

The pod annotation  `security.alpha.kubernetes.io/unsafeSysctls` allows customization of namespaced sysctls where isolation is unclear. Unsafe sysctls must be enabled at-your-own-risk on the kubelet with the `--experimental-allowed-unsafe-sysctls` flag. Future versions will improve on resource isolation and more sysctls will be considered safe.
```
2016-08-25 06:21:24 -07:00
Dr. Stefan Schimanski ed36baed20 Add sysctl PodSecurityPolicy support 2016-08-25 13:22:01 +02:00
Kubernetes Submit Queue d12b3429fe Merge pull request #30676 from m1093782566/improve-pod-log-output-format
Automatic merge from submit-queue

[Scheduler] Improve pod log output debuggability

Address issue is #30675

The result of my expirments shows that both `glog.Infof("%v", pod)` and `glog.Infof("%+v", pod)` can't output useful information of a pod, it can only output `kind:"" apiVersion:""`. 

`%#v` can output the whole content of pod, but it seems too much!

So, my opinion is output pod info use the format of `%v` to print`pod.Namespace/pod.Name` instead of the pod **object** in both [here](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/scheduler.go#L96) and [here](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/scheduler/scheduler.go#L100).

@wojtek-t
2016-08-25 04:05:24 -07:00
Kubernetes Submit Queue ef2718620c Merge pull request #30900 from jsafrane/pvc-admission
Automatic merge from submit-queue

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.

The marker of default class is annotation "volume.beta.kubernetes.io/storage-class", which must be set to "true" to work. All other values (or missing annotation) makes the class non-default.

Based on @thockin's code, added tests and made it not to reject a PVC when no class is marked as default.
. 
@kubernetes/sig-storage
2016-08-24 03:32:46 -07:00
Kubernetes Submit Queue 0b5547f462 Merge pull request #30183 from timstclair/aa-psp
Automatic merge from submit-queue

AppArmor PodSecurityPolicy support

Implements the AppArmor PodSecurityPolicy support based on the alpha API proposed [here](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/apparmor.md#pod-security-policy)

This implementation deviates from the original proposal in one way: it adds a separate option for specifying a default profile:
```
apparmor.security.alpha.kubernetes.io/defaultProfileName
```
This has several advantages over the original proposal:

- The default is explicit, rather than implicit on the ordering
- The default can be specified without constraining the allowed profiles
- The allowed profiles can be restricted without specifying a default (requires every pod to explicitly set a profile)

The E2E cluster does not currently enable the PodSecurityPolicy, so I will submit E2E tests in a separate PR.

/cc @dchen1107 @pweil- @sttts @jfrazelle @Amey-D
2016-08-23 03:06:05 -07:00
Matt Liggett c86b84ccc0 Add /eviction subresource.
This is for #12611.
2016-08-22 16:38:00 -07:00
deads2k 9913ebf079 add quota test for creating update requests 2016-08-22 10:36:41 -04:00
Jan Safranek 5f6efefc40 [squash] Rename and move to storageclass/ 2016-08-22 14:11:01 +02:00
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