Commit Graph

40 Commits

Author SHA1 Message Date
Mike Dame
41fcb95f2f Wire contexts to Apps controllers 2021-10-13 16:32:13 -04:00
Aldo Culquicondor
2dd2622188 Track Job Pods completion in status
Through Job.status.uncountedPodUIDs and a Pod finalizer

An annotation marks if a job should be tracked with new behavior

A separate work queue is used to remove finalizers from orphan pods.

Change-Id: I1862e930257a9d1f7f1b2b0a526ed15bc8c248ad
2021-07-08 17:48:05 +00:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
zouyee
a864fd2100 fix unsafe JSON construction
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-10-10 09:44:54 +08:00
Matt Matejczyk
01ccd2e19e Optimize GetControllerOf method
In addition create a similar method that doesn't copy objects.

Benchmark for the new no-copy method vs the old one:
```
benchmark                       old ns/op     new ns/op     delta
BenchmarkGetControllerOf-12     214           14.8          -93.08%

benchmark                       old allocs     new allocs     delta
BenchmarkGetControllerOf-12     1              0              -100.00%

benchmark                       old bytes     new bytes     delta
BenchmarkGetControllerOf-12     80            0             -100.00%
```

Benchamrk for the new (copy) method vs the old one:
```
benchmark                       old ns/op     new ns/op     delta
BenchmarkGetControllerOf-12     128           114           -10.94%

benchmark                       old allocs     new allocs     delta
BenchmarkGetControllerOf-12     1              1              +0.00%

benchmark                       old bytes     new bytes     delta
BenchmarkGetControllerOf-12     80            80            +0.00%

```

Overall there is a 10% improvement for the old vs new (copy) method and
huge improvent (x10) for the old vs new (no-copy).

I changed the IsControlledBy and a few other methods to use the new (no-copy) method.
2019-09-25 15:07:37 +02:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Anthony Yeh
e32a15558b
Use apps/v1 in Deployment controller. 2018-05-22 13:42:10 -07:00
Kenneth Owens
f52e7ef4bf Update the DaemonSet controller to use the apps/v1 API 2018-02-22 11:38:54 -08:00
Di Xu
48388fec7e fix all the typos across the project 2018-02-11 11:04:14 +08:00
Mikhail Mazurskiy
b28a83a4cf
Migrate to GetControllerOf from meta/v1 package 2017-08-06 22:41:58 +10:00
Tomas Nozicka
a887cd3434 Export BaseControllerRefManager 2017-07-17 22:36:51 +02:00
Chao Xu
31d0869f83 revert 45764 2017-06-25 21:41:10 -07: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
Mayank Kumar
ff503dbc32 delete dependent pods for rs when deleting deployments 2017-06-14 12:52:02 -07:00
Janet Kuo
0035d86248 Update adoption/release of DaemonSet controller history 2017-06-12 23:33:31 -07:00
Łukasz Oleś
b9611b95f4 Skip pods and replica sets marked for deletion
Fixes #44144
2017-04-23 00:29:48 +02:00
Anthony Yeh
b4b8fdbca3 GC: Fix re-adoption race when orphaning dependents.
The GC expects that once it sees a controller with a non-nil
DeletionTimestamp, that controller will not attempt any adoption.
There was a known race condition that could cause a controller to
re-adopt something orphaned by the GC, because the controller is using a
cached value of its own spec from before DeletionTimestamp was set.

This fixes that race by doing an uncached quorum read of the controller
spec just before the first adoption attempt. It's important that this
read occurs after listing potential orphans. Note that this uncached
read is skipped if no adoptions are attempted (i.e. at steady state).
2017-03-17 15:39:26 -07:00
Kubernetes Submit Queue
d306acca86 Merge pull request #42175 from enisoc/controller-ref-dep
Automatic merge from submit-queue

Deployment: Fully 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 Deployment into full compliance with ControllerRef. See the individual commit messages for details.

**Which issue this PR fixes**:

This ensures that Deployment does not fight with other controllers over control of Pods and ReplicaSets.

Ref: https://github.com/kubernetes/kubernetes/issues/24433

**Special notes for your reviewer**:

**Release note**:

```release-note
Deployment now fully respects ControllerRef to avoid fighting over Pods and ReplicaSets. At the time of upgrade, **you must not have Deployments with selectors that overlap**, or else [ownership of ReplicaSets may change](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/controller-ref.md#upgrading).
```
cc @erictune @kubernetes/sig-apps-pr-reviews
2017-03-07 20:44:36 -08:00
Anthony Yeh
37534b66df Deployment: Always set BlockOwnerDeletion in ControllerRef. 2017-03-06 15:12:07 -08:00
Anthony Yeh
b7163bdb75 ControllerRefManager: Allow matching by more than just selector. 2017-03-06 09:46:03 -08:00
Anthony Yeh
01d025a7cc ControllerRefManager: Don't always filter inactive Pods.
Some controllers, like DaemonSet, want to see all Pods.
2017-03-01 15:43:51 -08:00
Chao Xu
c3baf402f5 gc changes 2017-02-28 23:05:41 -08:00
Anthony Yeh
70bd5fdfe5 Refactor ControllerRefManager
To prepare for implementing ControllerRef across all controllers,
this pushes the common adopt/orphan logic into ControllerRefManager
so each controller doesn't have to duplicate it.

This also shares the adopt/orphan logic between Pods and ReplicaSets,
so it lives in only one place.
2017-02-16 15:09:17 -08:00
Kubernetes Submit Queue
36809e2c2e Merge pull request #39366 from zdj6373/manager-log
Automatic merge from submit-queue (batch tested with PRs 40527, 40738, 39366, 40609, 40748)

Log rectification

Log error, modify
2017-01-31 15:49:43 -08:00
Clayton Coleman
9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
deads2k
77b4d55982 mechanical 2017-01-16 09:35:12 -05:00
zdj6373
540f3bb7f8 Log rectification,review 2017-01-14 10:17:06 +08:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Wojciech Tyczynski
d1292a7397 Optimize memory allocations in controller manager 2016-12-27 16:11:11 +01:00
Mayank Kumar
777977612b ReplicaSet has owner ref of the Deployment that created it 2016-12-22 16:45:50 -08:00
Michail Kargakis
7ef3e6f7c9 controller: wait for all pods to be deleted before Recreating 2016-12-15 19:55:18 +01:00
Clayton Coleman
c52d510a24
refactor: generated 2016-12-10 18:05:53 -05:00
Clayton Coleman
3c72ee2189
Change references to OwnerReference 2016-12-10 18:05:36 -05:00
Clayton Coleman
35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Chao Xu
7eeb71f698 cmd/kube-controller-manager 2016-11-23 15:53:09 -08:00
Chao Xu
594234d61c fix tests; convert IsPodActive to operate on *Pod 2016-08-17 13:05:37 -07:00
Wojciech Tyczynski
331083727f Change podNamespacer API 2016-08-17 16:55:01 +02:00
Chao Xu
11a341de67 let RC manager utilize the GC 2016-07-14 19:59:31 -07:00