Commit Graph

28 Commits

Author SHA1 Message Date
Manu Gupta
79a51090f9
fix: 81134: fix unsafe json for ReleaseControllerRevision (#104049)
* fix: 81134: fix unsafe json for ReleaseControllerRevision

1. Ensures that ReleaseControllerRevision returns a proper json by
marshalling an object into bytes. Otherwise, it returns an error.

2. Also, refactors the code to commonize the merge type
   GenerateDeleteOwnerRefStrategicMergeBytes that returns a byte and is
   used across ReleasePod, ReleaseControllerRevison
   ReleaseReplicaSet.

* Move GeneratePatchBytesForDelete to controller_ref_manager
2021-11-05 06:33:52 -07:00
Mike Danese
c58e69ec79 automated refactor 2020-03-05 14:59:46 -08:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
likakuli
10864d3366 fix a bug that orphan revision cannot be adopted and sts cannot be synced 2020-01-08 17:56:41 +08: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
Adrián
ca809b1d33
gofmt 2019-02-07 20:26:21 +01:00
Adrián
34099a9274
ControllerRef creation through factory function 2019-02-07 10:44:49 +01:00
Ryan McNamara
0aae852a3c Stably sort controllerrevisions
Fixes https://github.com/kubernetes/kubernetes/issues/61998

There are times when multiple "equal" controllerrevisions are created with
the same revision number. When this happens and this is the case for the
largest revision number, the statefulset controller will periodically
select one of the maximal controllerrevisions to be the target of the
underlying statefulset. The selection happens here: https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/statefulset/stateful_set_control.go#L212.
Prior to this change this selection was random as the sort was not
stable, which caused the pods of a stable set to continually roll.
2018-11-05 16:01:05 -08:00
linyouchong
b4c27a1501 Remove incorrect comment 2018-08-16 15:52:00 +08:00
Morten Torkildsen
31f1972c52 Fix for duplicate revisions created by StatefulSet 2018-08-13 09:42:53 -07:00
Janet Kuo
666a41c2ea Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
Ayush Pateria
a269491f18 Modify tests 2018-02-22 19:19:06 +05:30
Ayush Pateria
1beed0f4c6 Remove unused code and modify tests to include set based selector 2018-02-20 03:23:51 +05:30
Ayush Pateria
4f84a1cb7e Pass pod labels to controller revision 2018-02-09 14:54:18 +05:30
Ayush Pateria
8de89d9f74 Fix StatefulSet set selector bug 2018-02-06 01:12:50 +05:30
dhilipkumars
aba725a391 Promote SS to apps/v1 2018-01-18 13:48:52 +05:30
Kenneth Owens
313a8b304a Adds the rand.SafeEncodeString function and uses this function to
generate names for ReplicaSets and ControllerRevisions.
2017-08-30 14:01:11 -07:00
Dr. Stefan Schimanski
1d053c4f7c controllers: simplify deepcopy calls 2017-08-29 19:21:24 +02:00
Yinan Li
46c6aea1cf Use CollisionCount for collision avoidance in StatefulSet controller 2017-08-18 06:49:02 -07:00
ymqytw
7500b55ce4 move retry to client-go 2017-08-14 14:16:26 -07:00
Mikhail Mazurskiy
b28a83a4cf
Migrate to GetControllerOf from meta/v1 package 2017-08-06 22:41:58 +10:00
Jacob Simpson
29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Kubernetes Submit Queue
76103db5e4 Merge pull request #47709 from krmayankk/ss
Automatic merge from submit-queue (batch tested with PRs 47958, 46261, 46667, 47709, 47579)

use appsv1beta1 for statefulsets

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


**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/46922
2017-06-23 07:21:33 -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
Mayank Kumar
5ee1831fa9 use appsv1beta1 for statefulsets and controller
history
2017-06-18 02:16:47 -07: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