Commit Graph

488 Commits (7319aced08bec8845bbe262cee25849861ce9e35)

Author SHA1 Message Date
zouyee eedf638072 sync code from copy destination 2018-01-20 14:38:16 +08:00
Jordan Liggitt b4fb25261e
return reason for allowed rbac authorizations
includes the binding, role, and subject that allowed a request so audit can make use of it
2018-01-19 14:32:39 -05:00
Kubernetes Submit Queue 621f3f3c0a
Merge pull request #58360 from liggitt/csi-node-authorizer
Automatic merge from submit-queue (batch tested with PRs 58488, 58360). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add get volumeattachment to the node authorizer

Fixes #58355

Adds `get volumeattachment` authorization for nodes to the node authorizer when the CSI feature is enabled

```release-note
NONE
```
2018-01-18 20:55:34 -08:00
Gavin f653d02b05 create auto-gen files 2018-01-17 16:23:03 +08:00
Gavin bb5e156aba Add generic Bootstrap Token constants and helpers to client-go 2018-01-17 16:22:37 +08:00
Jordan Liggitt ecfd18e2a6
Add get volumeattachments support to Node authorizer 2018-01-17 00:00:18 -05:00
Kubernetes Submit Queue 81b43401a9
Merge pull request #57128 from liggitt/kubelet-admin
Automatic merge from submit-queue (batch tested with PRs 57702, 57128). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Define default role for full kubelet API access

This makes sense to define uniformly so integrators can grant this to the `--kubelet-client-certificate` credential given to the apiserver. Mirrors the role GCE sets up.

```release-note
RBAC: The system:kubelet-api-admin cluster role can be used to grant full access to the kubelet API
```
2018-01-03 08:30:33 -08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
Brendan Burns 20bb9edff4
Update cluster-roles.yaml 2017-12-20 10:44:55 -08:00
Brendan Burns 519d0cde7b
Update policy.go 2017-12-20 10:44:07 -08:00
Brendan Burns ec53238901 Add '/version/*' to the system:discovery role, since that's what the open
api spec says.
2017-12-19 21:47:20 -08:00
Kubernetes Submit Queue 7a23bbb024
Merge pull request #57177 from liggitt/rbac-log
Automatic merge from submit-queue (batch tested with PRs 56386, 57204, 55692, 57107, 57177). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Raise RBAC DENY log level

Fixes #46877 
Fixes https://github.com/kubernetes/kubernetes/issues/55821

Can still be logged verbosely with `--vmodule=rbac*=5` if desired

```release-note
NONE
```
2017-12-17 04:19:47 -08:00
Kubernetes Submit Queue 7f87337b8b
Merge pull request #56650 from danwinship/networkpolicy-rbac
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add RBAC policies for NetworkPolicy

**What this PR does / why we need it**:
When using RBAC, none of the namespace-level roles currently have permission to do anything with NetworkPolicy. (Only cluster-admin does, by virtue of having permission on "*".) This fixes it so "admin" and "edit" have read/write permission, and "view" has read-only permission.

I added permission for both the extensions and networking objects, which I believe is correct as long as both of them exist?

(This would be nice to fix in 1.9, although it's not a regression. It's always been broken.)

**Release note**:
```release-note
When using Role-Based Access Control, the "admin", "edit", and "view" roles now have the expected permissions on NetworkPolicy resources.
```
2017-12-16 12:09:11 -08:00
Jordan Liggitt 13854c46a7
Raise RBAC DENY log level 2017-12-14 00:06:23 -05:00
Jordan Liggitt d073c10dbc
Refactor flex pv to allow secret namespace 2017-12-13 23:32:16 -05:00
Jordan Liggitt 0682372bae
Define default role for full kubelet API access 2017-12-13 00:44:24 -05:00
Kubernetes Submit Queue 3fef902161
Merge pull request #56709 from gnufied/cluster-role-for-cloud-provider
Automatic merge from submit-queue (batch tested with PRs 56785, 56709). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

cloud-provider needs cluster-role to apply taint to the node

When volume is stuck in attaching state on AWS, cloud-provider
needs to taint the node. But the node can not be tainted
without proper access. Without this change https://github.com/kubernetes/kubernetes/pull/55558 will not work.

xref - https://github.com/kubernetes/kubernetes/issues/56819

cc @jsafrane @liggitt 

/sig storage

```release-note
none
```
2017-12-04 17:14:14 -08:00
Hemant Kumar 514f219c22 cloud-provider needs cluster-role to apply taint to the node
When volume is stuck in attaching state on AWS, cloud-provider
needs to taint the node. But the node can not be tainted
without proper access.
2017-12-04 10:57:21 -05:00
Vladimir Vivien 179d8e108e CSI - feature gate fix, gated RBAC rules, csi nodeID label
This commit tracks chages to fix blocking bugs such as feature gates, rbac rules, usage
of csi nodeID to derive attachment ID.
2017-12-02 05:54:54 -05:00
Dan Winship ac336a6eb2 Add rbac policies for NetworkPolicy 2017-11-30 17:09:52 -05:00
pospispa b1b1d31247 Add policy for the PVC Protection Controller
It watches PVCs and Pods and updates PVCs.
2017-11-23 12:25:14 +01:00
Kubernetes Submit Queue 7dd41577e3
Merge pull request #55815 from gnufied/implement-node-fs-resize
Automatic merge from submit-queue (batch tested with PRs 55545, 55548, 55815, 56136, 56185). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Implement node fs resize

Implement kubelet side resizing of file system.

xref - https://github.com/kubernetes/features/issues/284 

```release-note
Implement kubelet side file system resizing. Also implement GCE PD resizing
```
2017-11-22 16:52:29 -08:00
Hemant Kumar 1b76b0b2ff Allow node to update PVC's status
Implement node policy feature gates
Add tests for node policy update
2017-11-22 14:32:50 -05:00
Michelle Au 01a8772111 Scheduler volume cache plumbing and predicate invalidation 2017-11-21 23:19:43 -08:00
Eric Chiang 21ab4d0c9b rbac bootstrap policy: add selfsubjectrulesreviews to basic-user 2017-11-20 14:39:05 -08:00
David Eads f34fb9b0ab handle clusterrole migration 2017-11-13 08:18:00 -05:00
Dr. Stefan Schimanski bec617f3cc Update generated files 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski 012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Kubernetes Submit Queue 648cc300b9
Merge pull request #54854 from kawych/hpa_roles
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Allow HPA to get custom metrics

**What this PR does / why we need it**:
This PR allows HPA to read custom metrics.

**Release note**:
```release-note
Allow HPA to read custom metrics.
```
2017-11-08 13:16:37 -08:00
Mike Danese 12125455d8 move authorizers over to new interface 2017-11-03 13:46:28 -07:00
Karol Wychowaniec 69d81c926a Allow HPA to get custom metrics 2017-10-31 11:46:07 +01:00
Kubernetes Submit Queue 6a444673b9 Merge pull request #53914 from bsalamat/pdb
Automatic merge from submit-queue (batch tested with PRs 53903, 53914, 54374). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add PodDisruptionBudget to scheduler cache.

**What this PR does / why we need it**:
This is the first step to add support for PodDisruptionBudget during preemption. This PR adds PDB to scheduler cache.

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

**Special notes for your reviewer**: None

**Release note**:

```release-note
Add PodDisruptionBudget to scheduler cache.
```

ref/ #53913
2017-10-23 12:27:06 -07:00
Bobby (Babak) Salamat 9a5d058e5e Add PodDisruptionBudget to scheduler cache. 2017-10-20 23:22:02 -07:00
Bobby (Babak) Salamat ffa9ed60a8 Fix scheduler permission to patch pods 2017-10-20 18:04:37 -07:00
Kubernetes Submit Queue 10cafb8390 Merge pull request #54309 from liggitt/replicaset-permissions
Automatic merge from submit-queue (batch tested with PRs 52147, 54309). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Update bootstrap policy with replicaset/daemonset permissions in the apps API group

Resolves #54310

Bootstrap policy was not updated when replicasets and daemonsets got promoted to the apps group

```release-note
Resolves forbidden error when accessing replicasets and daemonsets via the apps API group
```
2017-10-20 14:58:14 -07:00
Jordan Liggitt 3789051726
Update bootstrap policy with replicaset/daemonset permissions in the apps API group 2017-10-20 12:59:39 -04:00
Kubernetes Submit Queue 900c0761e3 Merge pull request #53722 from deads2k/rbac-01-allow-star
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

allow */subresource in rbac policy rules

xref #29698
xref #38756
xref #49504
xref #38810

Allow `*/subresource` format in RBAC policy rules to support polymorphic subresources like `*/scale` for HPA.

@DirectXMan12 fyi

```release-note
RBAC PolicyRules now allow resource=`*/<subresource>` to cover `any-resource/<subresource>`.   For example, `*/scale` covers `replicationcontroller/scale`.
```
2017-10-18 14:02:05 -07:00
Kubernetes Submit Queue 2d914ee703 Merge pull request #53984 from sttts/sttts-legacyscheme
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

pkg/api: extract Scheme/Registry/Codecs into pkg/api/legacyscheme

This serves as

- a preparation for the pkg/api->pkg/apis/core move
- and makes the dependency to the scheme explicit when vizualizing
  left depenncies.

The later helps with our our efforts to split up the monolithic repo
into self-contained sub-repos, e.g. for kubectl, controller-manager
and kube-apiserver in the future.
2017-10-18 10:49:10 -07:00
Dr. Stefan Schimanski cad0364e73 Update bazel 2017-10-18 17:24:04 +02:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Kubernetes Submit Queue 0e21ac81c0 Merge pull request #51416 from justinsb/fix_nodeidentitifer_godocs
Automatic merge from submit-queue (batch tested with PRs 51416, 53535). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix NodeIdentifier godocs: IdentifyNode -> NodeIdentity
2017-10-17 08:44:13 -07:00
David Eads e8a703b651 allow */subresource in rbac policy rules 2017-10-16 16:17:51 -04:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Jordan Liggitt d657261f9b
Add /swagger.json and /swagger-2.0.0.pb-v1 to discovery role 2017-10-02 21:52:13 -04:00
Jordan Liggitt 83b71b6dfe
Add pod disruption budgets to admin/edit/view roles 2017-09-18 10:15:24 -04:00
Solly Ross 8cbbbac27d Add bootstrap policy for HPA metrics REST clients
Since we weren't running the HPA with metrics REST clients by default,
we had no bootstrap policy enabling the HPA controller to talk to the
metrics APIs.

This adds permissions for the HPA controller to talk list
pods.metrics.k8s.io, and list any resource in custom.metrics.k8s.io.
2017-09-15 17:27:38 -04:00
Kubernetes Submit Queue f695a3120a Merge pull request #50949 from bsalamat/preemption_eviction
Automatic merge from submit-queue

Add pod preemption to the scheduler

**What this PR does / why we need it**:
This is the last of a series of PRs to add priority-based preemption to the scheduler. This PR connects the preemption logic to the scheduler workflow.

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

**Special notes for your reviewer**:
This PR includes other PRs which are under review (#50805, #50405, #50190). All the new code is located in 43627afdf9.

**Release note**:

```release-note
Add priority-based preemption to the scheduler.
```

ref/ #47604

/assign @davidopp 

@kubernetes/sig-scheduling-pr-reviews
2017-09-08 14:19:42 -07:00
Bobby (Babak) Salamat c0b718373b Fix RBAC rules to allow scheduler update annotations of pods. 2017-09-07 15:31:55 -07:00
David Eads 2572ea50e0 add permissions to workload controllers to block owners 2017-09-05 13:47:49 -04:00
Hemant Kumar 530ae4b3b5 Add rbac policy change for expand controller 2017-09-04 09:02:34 +02:00
Kubernetes Submit Queue a4ff702a13 Merge pull request #51818 from liggitt/controller-roles
Automatic merge from submit-queue (batch tested with PRs 51819, 51706, 51761, 51818, 51500)

Build controller roles/bindings on demand

As we start to have alpha gated features that involve policy changes, we need to conditionally include roles/bindings in policy based on feature enablement.

Examples:
 * https://github.com/kubernetes/kubernetes/pull/49727/files#diff-a066255fca075e2bdcfe045e7ca352f7
 * https://github.com/kubernetes/kubernetes/pull/51202/files#diff-eee450e334a11e0b683ce965f584c3c4R137

This moves the policy building from an init() func to be on demand, so that feature gates set at the point we set up the post-start reconcile take effect
2017-09-03 15:00:11 -07:00
Jordan Liggitt b7fe9ff18a
Build controller roles/bindings on demand 2017-09-01 15:18:13 -04:00
xilabao f14c138438 add selfsubjectrulesreview api 2017-09-01 19:09:43 +08:00
Kubernetes Submit Queue 915b772f9b Merge pull request #50933 from mattmoyer/bootstrap-token-groups
Automatic merge from submit-queue (batch tested with PRs 49861, 50933, 51380, 50688, 51305)

Add configurable groups to bootstrap tokens.

**What this PR does / why we need it**:
This change adds support for authenticating bootstrap tokens into a configurable set of extra groups in addition to `system:bootstrappers`. Previously, bootstrap tokens could only ever authenticate to the `system:bootstrappers` group.

Groups are specified as a comma-separated list in the `auth-extra-groups` key of the `bootstrap.kubernetes.io/token` Secret, and must begin with the prefix `system:bootstrapper:` (and match a validation regex that checks against our normal convention). Whether or not any extra groups are configured, `system:bootstrappers` will still be added.

This also adds a `--groups` flag for `kubeadm token create`, which sets the `auth-extra-groups` key on the resulting Secret. The default is to not set the key.

`kubeadm token list` is also updated to include a `EXTRA GROUPS` output column.

**Which issue this PR fixes**: fixes #49306

**Special notes for your reviewer**: 
The use case for this is in https://github.com/kubernetes/kubernetes/issues/49306. Comments on the feature itself are probably better over there. It will be part of how HA/self-hosting kubeadm bootstraps new master nodes (post 1.8).

**Release note**:
```release-note
Add support for configurable groups for bootstrap token authentication.
```

cc @luxas @kubernetes/sig-cluster-lifecycle-api-reviews @kubernetes/sig-auth-api-reviews 

/kind feature
2017-08-27 22:20:48 -07:00
Justin Santa Barbara bc66c6187c Fix NodeIdentifier godocs: IdentifyNode -> NodeIdentity
The godocs had an older name for the NodeIdentity function.
2017-08-26 15:56:33 -04:00
Matt Moyer fd5c00b38d Implement `auth-extra-groups` in bootstrap token authenticator.
This implements support for the new `auth-extra-groups` key in `bootstrap.kubernetes.io/token` secrets by adding extra groups to the user info returned for valid bootstrap tokens.
2017-08-25 16:23:01 -05:00
Matt Moyer 33e02aff60 Add extra group constants and validation to `pkg/bootstrap/api`.
This adds constants and validation for a new `auth-extra-groups` key on `bootstrap.kubernetes.io/token` secrets. This key allows a bootstrap token to authenticate to extra groups in addition to the `system:bootstrappers` group.

Extra groups are always applied in addition to the `system:bootstrappers` group, must begin with a `system:bootstrappers:` prefix, are limited in length, and are limited to a restricted set of characters (alphanumeric, colons, and dashes without a trailing colon/dash).
2017-08-25 16:04:53 -05:00
Jordan Liggitt c59c54b247
Update fixture data 2017-08-25 15:01:08 -04:00
Chen Rong f0f06a3d1e remove deprecated rbac rule 2017-08-24 15:14:20 +08:00
Chen Rong a9f57e90a4 update to rbac v1 in bootstrappolicy test 2017-08-22 09:28:14 +08:00
Monis Khan dd06794bc2
Add enj as reviewer to OWNERS
Adding myself as a reviewer for the following areas:

- API
- auth
- registry
- storage (etcd)

Signed-off-by: Monis Khan <mkhan@redhat.com>
2017-08-17 20:42:46 -04:00
Monis Khan 8e7893e541
Refactor RBAC authorizer entry points
This change refactors various RBAC authorizer functions to be more
flexible in their inputs.  This makes it easier to reuse the various
components that make up the authorizer.

Signed-off-by: Monis Khan <mkhan@redhat.com>
2017-08-16 11:43:39 -04:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
Jeff Grafton cf55f9ed45 Autogenerate BUILD files 2017-08-11 09:30:23 -07:00
Maciej Szulik 0cb8bae6ac
Generated changes after removing ScheduledJobs 2017-08-08 15:57:03 +02:00
Maciej Szulik e465962bf7
Remove ScheduledJobs support 2017-08-08 15:22:26 +02:00
Kubernetes Submit Queue 0a4903b0e0 Merge pull request #46685 from xilabao/fix-err-message-in-namespace_policy
Automatic merge from submit-queue

fix err message in namespace_policy

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

**Which issue this PR fixes**: fixes #49541

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-03 23:59:05 -07:00
Kubernetes Submit Queue 2c521d7d9a Merge pull request #49284 from luxas/csr_cluster_roles
Automatic merge from submit-queue (batch tested with PRs 49284, 49555, 47639, 49526, 49724)

Add clusterroles for approving CSRs easily

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

Adds ClusterRoles for CSR approving. Currently consumers like kubeadm and GKE have to create these rules by themselves, but are doing it slightly differently which leads to sprawl. Instead, the ClusterRoles are created by core, and the actual bindings created by respective deployment method.

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

fixes https://github.com/kubernetes/kubernetes/issues/48191

**Special notes for your reviewer**:

**Release note**:

```release-note
The API Server now automatically creates RBAC ClusterRoles for CSR approving. 
Each deployment method should bind users/groups to the ClusterRoles if they are using this feature.
```
cc @kubernetes/sig-auth-pr-reviews @kubernetes/sig-cluster-lifecycle-pr-reviews
2017-08-01 01:41:53 -07:00
Lucas Käldström e0ff623db0
Add clusterroles for approving CSRs easily 2017-07-31 23:44:50 +03:00
Jordan Liggitt d65610bf2f
Remove default binding of system:node role to system:nodes group 2017-07-26 13:53:14 -04:00
Anirudh c7a25a3786 DS: Api Machinery Fixes 2017-07-25 13:33:21 -07:00
foxish ef7203563b DS: RBAC changes 2017-07-25 11:51:22 -07:00
Daniel Fernandes Martins 81ba522bbe Make NodeRestriction admission allow evictions for bounded pods 2017-07-20 14:20:03 -03:00
Eric Chiang f719b2670c bootstrap token auth: don't accept deleted tokens 2017-07-17 15:22:18 -07:00
Kubernetes Submit Queue 9548fbd514 Merge pull request #47955 from CaoShuFeng/trivial
Automatic merge from submit-queue

[trivial]fix function name in comment

**Release note**:

```
NONE
```
2017-07-13 18:50:19 -07:00
Kubernetes Submit Queue 80a0f555db Merge pull request #48748 from liggitt/node-restriction-message
Automatic merge from submit-queue (batch tested with PRs 48405, 48742, 48748, 48571, 48482)

Improve node restriction message

Help debug https://github.com/kubernetes/kubernetes/issues/48687#issuecomment-314224531

/assign @luxas
2017-07-12 08:05:20 -07:00
Jordan Liggitt e3e25df5df
Improve node restriction message 2017-07-10 22:44:24 -04:00
Tim Allclair a2f2e1d491 Name change: s/timstclair/tallclair/ 2017-07-10 14:05:46 -07:00
Faraaz Khan 7b6727f7f7 allow heapster clusterrole to see deployments 2017-06-30 19:17:01 +00:00
Cao Shufeng fad8b45667 [trivial]fix function name in comment 2017-06-23 17:53:35 +08:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu cde4772928 run ./root-rewrite-all-other-apis.sh, then run make all, pkg/... compiles 2017-06-22 11:30:52 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Simon Croome 5e2503e71f Add StorageOS volume plugin 2017-06-09 13:19:27 +01:00
Kenneth Owens 1b55f57391 Implements StatefulSet update
Implements history utilities for ControllerRevision in the controller/history package
StatefulSetStatus now has additional fields for consistency with DaemonSet and Deployment
StatefulSetStatus.Replicas now represents the current number of createdPods and StatefulSetStatus.ReadyReplicas is the current number of ready Pods
2017-06-06 12:00:28 -07:00
Kubernetes Submit Queue 0cff839317 Merge pull request #46771 from n-marton/46770-permission-for-volume-binder
Automatic merge from submit-queue (batch tested with PRs 46734, 46810, 46759, 46259, 46771)

Added node to persistent-volume-binder clusterrole

**What this PR does / why we need it**: Added missing permission to volume-binder clusterrole

**Which issue this PR fixes**: fixes #46770

**Special notes for your reviewer**: Non

**Release note**: Non
2017-06-05 06:51:32 -07:00
Kubernetes Submit Queue 4c7e1590ee Merge pull request #40760 from mikedanese/gce
Automatic merge from submit-queue (batch tested with PRs 40760, 46706, 46783, 46742, 46751)

enable kubelet csr bootstrap in GCE/GKE

@jcbsmpsn @pipejakob 

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

```release-note
Enable kubelet csr bootstrap in GCE/GKE
```
2017-06-03 18:30:38 -07:00
Janet Kuo d02f40a5e7 Implement DaemonSet history logic in controller
1. Create controllerrevisions (history) and label pods with template
   hash for both RollingUpdate and OnDelete update strategy
2. Clean up old, non-live history based on revisionHistoryLimit
3. Remove duplicate controllerrevisions (the ones with the same template)
   and relabel their pods
4. Update RBAC to allow DaemonSet controller to manage
   controllerrevisions
5. In DaemonSet controller unit tests, create new pods with hash labels
2017-06-03 00:44:23 -07:00
Mike Danese f533bf729f allow sarapprover to create subject access reviews 2017-06-01 09:43:11 -07:00
n-marton a6a9fc12a9 Added node to persistent-volume-binder clusterrole 2017-06-01 13:07:52 +02:00
Jordan Liggitt fc8e915a4b
Add Node authorization mode based on graph of node-related objects 2017-05-30 16:53:03 -04:00
Jordan Liggitt d278a80a67
Separate system:node rules 2017-05-30 15:14:09 -04:00
Kubernetes Submit Queue 61693bf676 Merge pull request #46489 from xilabao/de-duplication-of-verb
Automatic merge from submit-queue (batch tested with PRs 46489, 46281, 46463, 46114, 43946)

De-duplication of verb in policy.go

**What this PR does / why we need it**:
https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go#L224 contains `get` verb. 

**Which issue this PR fixes**:

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2017-05-30 11:58:59 -07:00
xilabao 35acfdea89 De-duplication of verb 2017-05-26 13:16:38 +08:00
Timothy St. Clair 1fb55a567d Update RBAC policy for configmap locked leader leasing. 2017-05-24 16:32:12 -05:00
Kubernetes Submit Queue c1c7365e7c Merge pull request #46147 from nicksardo/gce-cluster-id
Automatic merge from submit-queue (batch tested with PRs 45891, 46147)

Watching ClusterId from within GCE cloud provider

**What this PR does / why we need it**:
Adds the ability for the GCE cloud provider to watch a config map for `clusterId` and `providerId`.

WIP - still needs more testing

cc @MrHohn @csbell @madhusudancs @thockin @bowei @nikhiljindal 

**Release note**:
```release-note
NONE
```
2017-05-24 00:42:58 -07:00
Nick Sardo 729303f0de Watching ClusterId from within GCE cloud provider 2017-05-23 14:11:24 -07:00
xilabao a319019417 fix err message in namespace_policy 2017-05-23 17:51:01 +08:00
Andy Goldstein 2480f2ceb6 Use shared informers in gc controller if possible 2017-05-22 12:51:37 -04:00
Kubernetes Submit Queue dc5744b6a1 Merge pull request #45112 from liggitt/quote-log-message
Automatic merge from submit-queue

Quote groups in deny log message

Helps distinguish cases where an external authenticator is incorrectly combining multiple groups into one.

Before:
> RBAC DENY: user "bob" groups [system:masters view system:authenticated] cannot "list" resource "pods" cluster-wide

After:
> RBAC DENY: user "bob" groups ["system:masters view" "system:authenticated"] cannot "list" resource "pods" cluster-wide
2017-04-28 19:18:22 -07:00
Jordan Liggitt e87bce1f8a
Quote groups in deny log message 2017-04-28 12:40:38 -04:00
Eric Chiang f5fa115536 kube-apiserver: improve bootstrap token authentication error messages 2017-04-25 12:59:48 -07:00
Kubernetes Submit Queue 7b43f922aa Merge pull request #42176 from enisoc/controller-ref-job
Automatic merge from submit-queue (batch tested with PRs 42177, 42176, 44721)

Job: Respect ControllerRef

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

This is part of the completion of the [ControllerRef](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/controller-ref.md) proposal. It brings Job into full compliance with ControllerRef. See the individual commit messages for details.

**Which issue this PR fixes**:

This ensures that Job does not fight with other controllers over control of Pods.

Ref: #24433

**Special notes for your reviewer**:

**Release note**:

```release-note
Job controller now respects ControllerRef to avoid fighting over Pods.
```
cc @erictune @kubernetes/sig-apps-pr-reviews
2017-04-20 12:57:06 -07:00
Kubernetes Submit Queue f25a657574 Merge pull request #42177 from enisoc/controller-ref-cronjob
Automatic merge from submit-queue (batch tested with PRs 42177, 42176, 44721)

CronJob: Respect ControllerRef

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

This is part of the completion of the [ControllerRef](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/controller-ref.md) proposal. It brings CronJob into compliance with ControllerRef. See the individual commit messages for details.

**Which issue this PR fixes**:

This ensures that other controllers do not fight over control of objects that a CronJob owns.

**Special notes for your reviewer**:

**Release note**:

```release-note
CronJob controller now respects ControllerRef to avoid fighting with other controllers.
```
cc @erictune @kubernetes/sig-apps-pr-reviews
2017-04-20 12:57:03 -07:00
Jordan Liggitt 67360883bc
Switch to pointer to policy rule, visit and short circuit during authorization 2017-04-20 10:52:53 -04:00
Anthony Yeh be1fe95534 CronJob: Use PATCH to adopt Jobs. 2017-04-19 15:42:34 -07:00
Anthony Yeh aa7bc25812 Job: Add PATCH Pods permission.
This is needed to update ControllerRef during adopt/release.
2017-04-19 14:03:36 -07:00
Mike Danese 32735173df allow the token controller to get, update secrets
we need this on secret rotation here:

2c1c0f3f72/pkg/controller/serviceaccount/tokens_controller.go (L478-L481)
2017-04-18 17:40:42 -07:00
Mike Danese a05c3c0efd autogenerated 2017-04-14 10:40:57 -07:00
Bowei Du f61590c221 Adds support for PodCIDR allocation from the GCE cloud provider
If CIDRAllocatorType is set to `CloudCIDRAllocator`, then allocation
of CIDR allocation instead is done by the external cloud provider and
the node controller is only responsible for reflecting the allocation
into the node spec.

- Splits off the rangeAllocator from the cidr_allocator.go file.
- Adds cloudCIDRAllocator, which is used when the cloud provider allocates
  the CIDR ranges externally. (GCE support only)
- Updates RBAC permission for node controller to include PATCH
2017-04-11 14:07:54 -07:00
Kubernetes Submit Queue dc2b0ee2cf Merge pull request #43034 from enisoc/statefulset-patch
Automatic merge from submit-queue (batch tested with PRs 43034, 43066)

Allow StatefulSet controller to PATCH Pods.

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

StatefulSet now needs the PATCH permission on Pods since it calls into ControllerRefManager to adopt and release. This adds the permission and the missing e2e test that should have caught this.

**Which issue this PR fixes**:

**Special notes for your reviewer**:

This is based on #42925.

**Release note**:
```release-note
```
cc @kubernetes/sig-apps-pr-reviews
2017-03-14 11:44:37 -07:00
Anthony Yeh 53a6f4402f Allow StatefulSet controller to PATCH Pods.
Also add an e2e test that should have caught this.
2017-03-14 09:27:33 -07:00
Joe Beda c46d6bb825
Use constant time compare for bootstrap tokens
Signed-off-by: Joe Beda <joe.github@bedafamily.com>
2017-03-14 14:06:33 +00:00
Janet Kuo b6e3993c96 Allow daemonset controller to patch pods for ControllerRef management 2017-03-13 11:37:17 -07:00
Kubernetes Submit Queue 346c0ba993 Merge pull request #42351 from liggitt/scheduler-statefulset
Automatic merge from submit-queue (batch tested with PRs 41919, 41149, 42350, 42351, 42285)

Add read permissions for statefulsets for kube-scheduler

https://github.com/kubernetes/kubernetes/issues/41708 added statefulset awareness to the scheduler. This adds the corresponding permission to the scheduler role.
2017-03-03 16:44:43 -08:00
Kubernetes Submit Queue 01bfbb5fa0 Merge pull request #42259 from deads2k/rbac-07-reconcile-binding
Automatic merge from submit-queue

Add RBAC roles for bootstrap controllers

Supercedes https://github.com/kubernetes/kubernetes/pull/42221

When locking down controllers to individual RBAC roles we need to make sure that the bootstrap controllers have the right permissions.

This adds the roles and bindings at the correct namespace scopes for the bootstrap-signer and token-cleaner controllers.

@liggitt ptal
@jbeda @luxas you got a good way to test this?  It must not be covered in normal e2e or we'd've seen the issue before.
2017-03-01 16:57:51 -08:00
Jordan Liggitt 4525e042fc
Add read permissions for statefulsets for kube-scheduler 2017-03-01 15:08:48 -05:00
Maciej Szulik 6173c4bbab Generated changes for apps/v1beta1.deployments 2017-03-01 15:14:41 +01:00
Maciej Szulik c272630b1b Deployments under apps/v1beta1 with new defaults 2017-03-01 15:14:41 +01:00
deads2k 1cb582a03a add roles and bindings for bootstrap controllers 2017-02-28 13:14:58 -05:00
deads2k e24b1c0c25 add namespaced role bindings 2017-02-28 13:04:23 -05:00
Kubernetes Submit Queue 452420484c Merge pull request #41982 from deads2k/agg-18-ca-permissions
Automatic merge from submit-queue

Add namespaced role to inspect particular configmap for delegated authentication

Builds on https://github.com/kubernetes/kubernetes/pull/41814 and https://github.com/kubernetes/kubernetes/pull/41922 (those are already lgtm'ed) with the ultimate goal of making an extension API server zero-config for "normal" authentication cases.

This part creates a namespace role in `kube-system` that can *only* look the configmap which gives the delegated authentication check.  When a cluster-admin grants the SA running the extension API server the power to run delegated authentication checks, he should also bind this role in this namespace.

@sttts Should we add a flag to aggregated API servers to indicate they want to look this up so they can crashloop on startup?  The alternative is sometimes having it and sometimes not.  I guess we could try to key on explicit "disable front-proxy" which may make more sense.

@kubernetes/sig-api-machinery-misc 

@ncdc I spoke to @liggitt about this before he left and he was ok in concept.  Can you take a look at the details?
2017-02-26 12:12:49 -08:00
gmarek 6637592b1d generated 2017-02-24 09:24:33 +01:00
gmarek d88af7806c NodeController sets NodeTaints instead of deleting Pods 2017-02-24 09:24:33 +01:00
Kubernetes Submit Queue 46dda7e32a Merge pull request #41821 from deads2k/apiserver-15-healthz
Automatic merge from submit-queue

redact detailed errors from healthz and expose in default policy

Makes `/healthz` less sensitive and exposes it by default.

@kubernetes/sig-auth-pr-reviews @kubernetes/sig-api-machinery-misc @liggitt
2017-02-24 00:22:55 -08:00
Kubernetes Submit Queue 51f498f6f3 Merge pull request #41645 from ncdc/shared-informers-12-admission
Automatic merge from submit-queue (batch tested with PRs 41667, 41820, 40910, 41645, 41361)

Switch admission to use shared informers

Originally part of #40097

cc @smarterclayton @derekwaynecarr @deads2k @liggitt @sttts @gmarek @wojtek-t @timothysc @lavalamp @kubernetes/sig-scalability-pr-reviews @kubernetes/sig-api-machinery-pr-reviews
2017-02-23 20:57:31 -08:00
Kubernetes Submit Queue b799bbf0a8 Merge pull request #38816 from deads2k/rbac-23-switch-kubedns-sa
Automatic merge from submit-queue

move kube-dns to a separate service account

Switches the kubedns addon to run as a separate service account so that we can subdivide RBAC permission for it.  The RBAC permissions will need a little more refinement which I'm expecting to find in https://github.com/kubernetes/kubernetes/pull/38626 .

@cjcullen @kubernetes/sig-auth since this is directly related to enabling RBAC with subdivided permissions
 @thockin @kubernetes/sig-network since this directly affects now kubedns is added.  


```release-note
`kube-dns` now runs using a separate `system:serviceaccount:kube-system:kube-dns` service account which is automatically bound to the correct RBAC permissions.
```
2017-02-23 12:06:13 -08:00
deads2k da3da29223 add kube-system local roles 2017-02-23 11:33:12 -05:00
Andy Goldstein 022bff7fbe Switch admission to use shared informers 2017-02-23 11:16:09 -05:00
deads2k 4cd0b7cdbe redact detailed errors from healthz and expose in default policy 2017-02-22 07:52:13 -05:00
Eric Chiang a0df658b20 kube-apiserver: add a bootstrap token authenticator for TLS bootstrapping 2017-02-21 08:43:55 -08:00
Kubernetes Submit Queue af41d2f57c Merge pull request #41661 from liggitt/satoken
Automatic merge from submit-queue

Make controller-manager resilient to stale serviceaccount tokens

Now that the controller manager is spinning up controller loops using service accounts, we need to be more proactive in making sure the clients will actually work.

Future additional work:
* make a controller that reaps invalid service account tokens (c.f. https://github.com/kubernetes/kubernetes/issues/20165)
* allow updating the client held by a controller with a new token while the controller is running (c.f. https://github.com/kubernetes/kubernetes/issues/4672)
2017-02-20 08:39:31 -08:00
deads2k 36b586d5d7 move kube-dns to a separate service account 2017-02-20 07:35:08 -05:00
Jordan Liggitt b83e6f7d91
Make controller-manager resilient to stale serviceaccount tokens 2017-02-17 23:59:00 -05:00
Matthew Wong 33f98d4db3 Switch pv controller to shared informers 2017-02-16 10:08:23 -05:00
Kubernetes Submit Queue 1ad5cea24e Merge pull request #41261 from ncdc/shared-informers-07-resourcequota
Automatic merge from submit-queue

Switch resourcequota controller to shared informers

Originally part of #40097 

I have had some issues with this change in the past, when I updated `pkg/quota` to use the new informers while `pkg/controller/resourcequota` remained on the old informers. In this PR, both are switched to using the new informers. The issues in the past were lots of flakey test failures in the ResourceQuota e2es, where it would randomly fail to see deletions and handle replenishment. I am hoping that now that everything here is consistently using the new informers, there won't be any more of these flakes, but it's something to keep an eye out for.

I also think `pkg/controller/resourcequota` could be cleaned up. I don't think there's really any need for `replenishment_controller.go` any more since it's no longer running individual controllers per kind to replenish. It instead just uses the shared informer and adds event handlers to it. But maybe we do that in a follow up.

cc @derekwaynecarr @smarterclayton @wojtek-t @deads2k @sttts @liggitt @timothysc @kubernetes/sig-scalability-pr-reviews
2017-02-15 11:37:04 -08:00
Jordan Liggitt 34782b203d
Add detailed RBAC deny logging 2017-02-15 01:05:43 -05:00
Jordan Liggitt 9f8b803de8
Create bootstrap system:kube-scheduler role 2017-02-15 01:05:42 -05:00
Kubernetes Submit Queue ef042450fd Merge pull request #41155 from liggitt/reconcile
Automatic merge from submit-queue (batch tested with PRs 41378, 41413, 40743, 41155, 41385)

Reconcile bootstrap clusterroles on server start

Currently, on server start, bootstrap roles and bindings are only created if there are no existing roles or rolebindings.

Instead, we should look at each bootstrap role and rolebinding, and ensure it exists and has required permissions and subjects at server start. This allows seamless upgrades to new versions that define roles for new controllers, or add permissions to existing roles.

```release-note
Default RBAC ClusterRole and ClusterRoleBinding objects are automatically updated at server start to add missing permissions and subjects (extra permissions and subjects are left in place). To prevent autoupdating a particular role or rolebinding, annotate it with `rbac.authorization.kubernetes.io/autoupdate=false`.
```
2017-02-14 19:54:14 -08:00
Kubernetes Submit Queue 7332baf9a3 Merge pull request #39636 from liggitt/proxy-subresource
Automatic merge from submit-queue (batch tested with PRs 41382, 41407, 41409, 41296, 39636)

Update to use proxy subresource consistently

Proxy subresources have been in place since 1.2.0 and improve the ability to put policy in place around proxy access.

This PR updates the last few clients to use proxy subresources rather than the root proxy
2017-02-14 13:04:33 -08:00
Jordan Liggitt 26b42d350d
Reconcile bootstrap clusterroles on server start 2017-02-14 12:33:05 -05:00
Andy Goldstein d820e3928c Switch resourcequota controller to shared informers 2017-02-14 12:20:27 -05:00
Kubernetes Submit Queue 1f4e2efc5b Merge pull request #41184 from liggitt/subject-apigroup
Automatic merge from submit-queue (batch tested with PRs 41357, 41178, 41280, 41184, 41278)

Switch RBAC subject apiVersion to apiGroup in v1beta1

Referencing a subject from an RBAC role binding, the API group and kind of the subject is needed to fully-qualify the reference.

The version is not, and adds complexity around re-writing the reference when returning the binding from different versions of the API, and when reconciling subjects.

This PR:
* v1beta1: change the subject `apiVersion` field to `apiGroup` (to match roleRef)
* v1alpha1: convert apiVersion to apiGroup for backwards compatibility
* all versions: add defaulting for the three allowed subject kinds
* all versions: add validation to the field so we can count on the data in etcd being good until we decide to relax the apiGroup restriction

```release-note
RBAC `v1beta1` RoleBinding/ClusterRoleBinding subjects changed `apiVersion` to `apiGroup` to fully-qualify a subject. ServiceAccount subjects default to an apiGroup of `""`, User and Group subjects default to an apiGroup of `"rbac.authorization.k8s.io"`.
```

@deads2k @kubernetes/sig-auth-api-reviews @kubernetes/sig-auth-pr-reviews
2017-02-13 21:07:10 -08:00
Jordan Liggitt 88a876b1d0
Update to use proxy subresource consistently 2017-02-13 22:05:00 -05:00
Kubernetes Submit Queue 4e01d1d141 Merge pull request #41345 from liggitt/node-update-delete
Automatic merge from submit-queue

give nodes update/delete permissions

delete permission is logically paired with create permission (and is used during self-registration scenarios when a node has been restarted and an existing node object has a mismatched externalID)

we already need to scope update nodes/status permission to only let a node update itself, and we would scope these at the same time.

fixes https://github.com/kubernetes/kubernetes/issues/41224
2017-02-13 13:36:27 -08:00
Jordan Liggitt 2a76fa1c8f
Switch RBAC subject apiVersion to apiGroup in v1beta1 2017-02-13 15:33:09 -05:00
Jordan Liggitt 967d4fb5f7
give nodes update/delete permissions 2017-02-13 13:14:47 -05:00
Andy Goldstein 9947216abd Allow controller manager to list/watch CSRs 2017-02-13 12:02:34 -05:00
Andy Goldstein d11aa98c29 Switch hpa controller to shared informer 2017-02-10 09:53:41 -05:00