Commit Graph

435 Commits (9ea39419eb38de247148035c0d2a1592594d1b13)

Author SHA1 Message Date
David Eads fb7d137ea2 add debug handler capability for individual controllers 2018-07-26 13:24:36 -04:00
Dr. Stefan Schimanski 8686feea6d kube-controller-manager: add stopCh plumbing 2018-07-05 15:49:11 +02:00
Kubernetes Submit Queue 571b9beac5
Merge pull request #57932 from atlassian/cancellable-leader-election
Automatic merge from submit-queue (batch tested with PRs 65256, 64236, 64919, 64879, 57932). 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>.

Cancellable leader election

**What this PR does / why we need it**:
Adds ability to cancel leader election. Useful in integration tests where the whole app is started and stopped in each test.

**Special notes for your reviewer**:
I used the `context` package - it is impossible/hard to achieve the same behaviour with just channels without spawning additional goroutines but it is trivial with `context`. See `acquire()` and `renew()` methods.

**Release note**:

```release-note
NONE
```
/kind enhancement
/sig api-machinery
2018-06-20 17:22:22 -07:00
Jordan Liggitt dd5dccc740
Move service account key file arg to the service-account controller options 2018-06-18 09:51:10 -04:00
Mikhail Mazurskiy e458cfe02c
Rename context 2018-06-09 13:06:23 +10:00
Mikhail Mazurskiy 102090d1f1
Use context.TODO() to be explicit that cancellation is not implemented 2018-06-07 14:33:03 +10:00
Mikhail Mazurskiy dc32a341c0
Cancellable leader election with context 2018-06-07 14:24:02 +10:00
Mikhail Mazurskiy 1d99fff1ac
Cancellable leader election with channels 2018-06-07 14:24:01 +10:00
stewart-yu 956bbfd1a6 should not ignore err when convert controllermanagerconfiguration api 2018-05-23 13:14:04 +08:00
stewart-yu f21475ac95 modify kube-controller manager config struct to adapt option change 2018-05-18 10:23:38 +08:00
Kubernetes Submit Queue 5a54555f59
Merge pull request #63049 from andrewsykim/kcm-nodeipam
Automatic merge from submit-queue (batch tested with PRs 63049, 59731). 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>.

re-enable nodeipam in kube-controller-manager

**What this PR does / why we need it**:
Re-enables nodeipam controller for external clouds. Also does a small refactor so that we don't need to pass in `allocateNodeCidr` into the controller. 

In v1.10 we made a change (9187b343e1 (diff-f11913dc67d80d36b3d06a93f61c49cf) in https://github.com/kubernetes/kubernetes/pull/57492) where nodeipam would be disabled for any cluster that sets `--cloud-provider=external`. The original intention behind this was that the nodeipam controller is cloud specific for some clouds (only GCE at the moment) so it should be moved to the CCM (cloud controller manager). After some discussions with wg-cloud-provider it makes sense to re-enable nodeipam controller in KCM and have GCE CCM enable its own cloud-specific IPAM controller as part of [Initialize()](https://github.com/kubernetes/kubernetes/blob/master/pkg/cloudprovider/cloud.go#L33-L35). This would allow for GCE to run nodeipam in both KCM (by setting --cloud-provider=gce and --allocate-node-cidr) and in the CCM (once implemented in `Initialize()`) without disabling nodeipam in the KCM for all external clouds and avoids having to implement nodeipam in CCM. 

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

**Special notes for your reviewer**:


**Release note**:
```release-note
Re-enable nodeipam controller for external clouds. 
```
2018-05-11 11:07:12 -07:00
David Eads dd97a7bc59 move client based restmappers to client-go 2018-05-08 08:11:56 -04:00
hzxuzhonghu 7f93d11f9e Add RESTMapper to ControllerContext and make it generic for controllers 2018-04-28 09:58:43 +08:00
andrewsykim 0a164760dc renable nodeipam in kube-controller-manager 2018-04-23 22:28:37 -04:00
Kubernetes Submit Queue 0f3de97db9
Merge pull request #60270 from stewart-yu/splitFlag
Automatic merge from submit-queue (batch tested with PRs 61306, 60270, 62496, 62181, 62234). 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>.

split up the huge set of flags into smaller option structs

**What this PR does / why we need it**:
To make generic, we do following work:

1.  Spliting `KubeControllerManagerConfiguration` in kube-controller-manager and cloud-controller-manager into fewer smaller struct options order by controller, and modify relative flag. Also part of #59483.
2. Spliting `componentconfig` in controller-manager into fewer smaller config order by controller too.

All works follow #59582, using `option+config` logic.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-04-13 15:03:07 -07:00
stewart-yu ec6399be53 split up the component config into smaller config 2018-04-13 08:40:54 +08:00
hzxuzhonghu 540a1de161 Refactor controller-manager: turn Serve func into handlerchain builder 2018-03-06 09:37:25 +08:00
hzxuzhonghu 97be082fb1 cloud-controller-manager get /healthz instead of calling restclient.ServerAPIVersions to wait for apiserver being healthy 2018-02-28 17:24:59 +08:00
Davanum Srinivas 265e5ae085 Log the command line flags
With d7ddcca231, we lost the logging
of the flags. We should at least log what the command line flags
were used to start processes as those incredibly useful for trouble shooting.
2018-02-15 18:04:04 -05:00
Dr. Stefan Schimanski f4564ea0b8 controller-manager: add SecureServingOptions 2018-02-13 11:16:47 +01:00
stewart-yu 0cbe0a6034 controller-manager: switch to config/option struct pattern 2018-02-13 11:16:17 +01:00
Davanum Srinivas 3d43b446c4 Extract instantiation of cloud provider
Add a separate method in a new file for creating cloud providers.
Currently the code is all mixed into the controller manager. We
should actively control what is made available to the cloud provider
so list explicitly the parms needed and move the code out. This will
avoid linkages to sneak in as we will catch it better during reviews.
2018-02-08 08:15:41 -05:00
NickrenREN 3fee293607 Add PV protection controller 2018-01-31 20:18:54 +08:00
Kubernetes Submit Queue 49532f59a6
Merge pull request #58791 from mikedanese/jwt0
Automatic merge from submit-queue (batch tested with PRs 58626, 58791). 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>.

serviceaccount: check token is issued by correct iss before verifying

Right now if a JWT for an unknown issuer, for any subject hits the
serviceaccount token authenticator, we return a errors as if the token
was meant for us but we couldn't find a key to verify it. We should
instead return nil, false, nil.

This change helps us support multiple service account token
authenticators with different issuers.

https://github.com/kubernetes/kubernetes/issues/58790

```release-note
NONE
```
2018-01-25 14:06:37 -08:00
Mike Danese 057b7af798 serviceaccount: check token is issued by correct iss before verifying
Right now if a JWT for an unknown issuer, for any subject hits the
serviceaccount token authenticator, we return a errors as if the token
was meant for us but we couldn't find a key to verify it. We should
instead return nil, false, nil.

This change helps us support multiple service account token
authenticators with different issuers.
2018-01-24 20:21:59 -08:00
David Eads 25238441fd uniquify resource lock identities 2018-01-18 11:31:43 -05:00
David Eads d7db324c38 make the controller manager create and use a valid cobra command 2018-01-18 07:54:36 -05:00
Jordan Liggitt a371f3ba8e
Track run status explicitly rather than non-nil check on stopCh 2018-01-17 11:04:55 -05:00
David Eads f416e38a1e make controller port exposure optional 2018-01-09 15:54:39 -05:00
Walter Fender 9187b343e1 Split the NodeController into lifecycle and ipam pieces.
Prepatory work fpr removing cloud provider dependency from node
controller running in Kube Controller Manager. Splitting the node
controller into its two major pieces life-cycle and CIDR/IP
management. Both pieces currently need the the cloud system to do their work.
Removing lifecycles dependency on cloud will be fixed ina followup PR.

Moved node scheduler code to live with node lifecycle controller.
Got the IPAM/Lifecycle split completed. Still need to rename pieces.
Made changes to the utils and tests so they would be in the appropriate
package.
Moved the node based ipam code to nodeipam.
Made the relevant tests pass.
Moved common node controller util code to nodeutil.
Removed unneeded pod informer sync from node ipam controller.
Fixed linter issues.
Factored in  feedback from @gmarek.
Factored in feedback from @mtaufen.
Undoing unneeded change.
2018-01-04 12:48:08 -08:00
Kubernetes Submit Queue f4bfcba0c8
Merge pull request #56411 from supereagle/authentication-client-with-version
Automatic merge from submit-queue (batch tested with PRs 57651, 56411, 56779, 57523, 57624). 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>.

Use authentication client with explicit version

**What this PR does / why we need it**:
Authentication client without explicit version has been deprecated, change them to the one with explicit version.

**Which issue(s) this PR fixes**:
Fixes partially #55993

**Special notes for your reviewer**:
/cc @caesarxuchao @sttts

**Release note**:
```release-note
NONE
```
2018-01-02 14:09:43 -08:00
Kubernetes Submit Queue f5d5d18b2c
Merge pull request #57340 from jmcmeek/jmcmeek_57044
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>.

Fix garbage collector when leader-elect=false

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

In a 1.8.x master with --leader-elect=false, the garbage collector controller
does not work.

When deleting a deployment with v1meta.DeletePropagationForeground, the deployment
had its deletionTimestamp set and a foreground Deletion finalizer was added,
but the deployment, rs and pod were not deleted.

This is an issue with how the garbage collector graph_builder behaves when the
stopCh=nil.  This PR creates a dummy stop channel for the garbage collector controller (and other
controllers started by the controller-manager) so that they can work more like they do when
when the controller-manager is configured with --leader-elect=true.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fix garbage collection when the controller-manager uses --leader-elect=false
```
2018-01-02 11:45:25 -08:00
Walter Fender 070a7b5823 Seperate loop and plugin control
Seperate loop and plugin control in the kube-controller-manager.
Adding an "--external-plugin" flag to specify a plugin to load when
cloud-provider is set to "external". Flag has no effect currently
when the cloud-provider is not set to external. The expectation is
that the cloud provider and external plugin flags would go away once
all cloud providers are on stage 2 cloud-controller-manager solutions.

Managing the control loops more directly based on start up flags.
Addressing issue brought up by @wlan0

Switched to using the main node controller in CCM.
Changes to enable full NodeController to start in CCM.
Fix related tests.
Unifying some common code between KCM and CCM.
Fix related tests and comments.
Folded in feedback from @jhorwit2 and @wlan0
2017-12-18 10:58:45 -08:00
John McMeeking 880a68ade6 Fix garbage collector when leader-elect=false
**What this PR does / why we need it**:

In a 1.8.x master with --leader-elect=false, the garbage collector controller
does not work.

When deleting a deployment with v1meta.DeletePropagationForeground, the deployment
had its deletionTimestamp set and a foreground Deletion finalizer was added,
but the deployment, rs and pod were not deleted.

This is an issue with how the garbage collector graph_builder behaves when the
stopCh=nil.  This PR creates a dummy stop channel for the garbage collector controller (and other
controllers started by the controller-manager) so that they can work more like they do when
when the controller-manager is configured with --leader-elect=true.

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

**Special notes for your reviewer**:

**Release note**:
<!--  Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
```release-note
Garbage collection doesn't work when the controller-manager uses --leader-elect=false

```
2017-12-18 11:39:51 -06:00
supereagle 7dce7fe1eb use authentication client with explicit version 2017-11-27 22:13:19 +08:00
jsafrane 4ad4ee3153 Added PVC Protection Controller
This controller removes protection finalizer from PVCs that are being
deleted and are not referenced by any pod.
2017-11-23 11:46:34 +01:00
David Zhu e5aec8645d Changed GetAllZones to only get zones with nodes that are currently
running (renamed to GetAllCurrentZones). Added E2E test to confirm this
behavior.

Added node informer to cloud-provider controller to keep track of zones
with k8s nodes in them.
2017-11-20 16:04:18 -08:00
David Eads e52383c486 add clusterrole aggregation controller 2017-11-13 08:18:00 -05:00
Ferran Rodenas d67898b875 Check RegisterMetricAndTrackRateLimiterUsage error when starting controllers
Signed-off-by: Ferran Rodenas <rodenasf@vmware.com>
2017-11-01 12:46:07 +01:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Jacob Simpson 2a6099b8f9 New controller to GC CSRs. 2017-10-04 14:45:32 -07:00
Kubernetes Submit Queue 6cc1816c64 Merge pull request #51034 from wlan0/master
Automatic merge from submit-queue (batch tested with PRs 51034, 53239). 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 conditional for warning while starting KCM without secret file

@liggitt @spiffxp @lavalamp 

Fixes #53291

A small bug was introduced in this PR - https://github.com/kubernetes/kubernetes/pull/50288, where the warning message is printed when the file is specified, and it is not printed if it is left blank - exactly the opposite of the intended behavior. 

This fixes that.

```
release-note-none
```
2017-09-30 12:14:11 -07:00
Kubernetes Submit Queue 4a04d06cf1 Merge pull request #52380 from malc0lm/rm-repeat-import
Automatic merge from submit-queue (batch tested with PRs 52445, 52380, 52516, 52531, 52538). 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>..

remove repeated import'k8s.io/client-go/kubernetes' in controllermana…

**What this PR does / why we need it**:
There are duplicate importing "k8s.io/client-go/kubernetes", we just need  'clientset'. 

**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**:

**Release note**:

```release-note
```
2017-09-23 14:33:10 -07:00
Nick Sardo e73dfce32f Move cloudprovider initialization to after token controller and use
clientBuilder
2017-09-13 10:57:35 -07:00
Malcolm Lee 69ce9abf92 remove repeated import'k8s.io/client-go/kubernetes' in controllermanager.go 2017-09-13 11:22:50 +08:00
Hemant Kumar cd2a68473a Implement controller for resizing volumes 2017-09-04 09:02:34 +02:00
David Eads 253b047d89 update GC controller to wait until controllers have been initialized once 2017-08-31 09:01:38 -04:00
fisherxu c2c0d59676 simplify Run in controllermanager 2017-08-29 16:48:11 +08:00
wlan0 fb0b57ee47 fix conditional for warning while starting KCM without secret file 2017-08-21 10:51:47 -07:00
Robert Rati 926f070719 Make ClusterID required for AWS. #48954 2017-08-07 15:47:00 -04:00