kubernetes/pkg/controller
Kubernetes Submit Queue 673d061c56 Merge pull request #40838 from kow3ns/ss-fixes
Automatic merge from submit-queue (batch tested with PRs 40796, 40878, 36033, 40838, 41210)

StatefulSet hardening

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

This PR contains the following changes to StatefulSet. Only one change effects the semantics of how the controller operates (This is described in #38418), and this change only brings the controller into conformance with its documented behavior.

1. pcb and pcb controller are removed and their functionality is encapsulated in StatefulPodControlInterface. This class modules the design contoller.PodControlInterface and provides an abstraction to clientset.Interface which is useful for testing purposes.
2. IdentityMappers has been removed to clarify what properties of a Pod are mutated by the controller. All mutations are performed in the UpdateStatefulPod method of the StatefulPodControlInterface.
3. The statefulSetIterator and petQueue classes are removed. These classes sorted Pods by CreationTimestamp. This is brittle and not resilient to clock skew. The current control loop, which implements the same logic, is in stateful_set_control.go. The Pods are now sorted and considered by their ordinal indices, as is outlined in the documentation.
4. StatefulSetController now checks to see if the Pods matching a StatefulSet's Selector also match the Name of the StatefulSet. This will make the controller resilient to overlapping, and will be enhanced by the addition of ControllerRefs.
5. The total lines of production code have been reduced, and the total number of unit tests has been increased. All new code has 100% unit coverage giving the module 83% coverage. Tests for StatefulSetController have been added, but it is not practical to achieve greater coverage in unit testing for this code (the e2e tests for StatefulSet cover these areas).
6. Issue #38418 is fixed in that StaefulSet will ensure that all Pods that are predecessors of another Pod are Running and Ready prior to launching a new Pod. This removes the potential for deadlock when a Pod needs to be rescheduled while its predecessor is hung in Pending or Initializing.
7. All reference to pet have been removed from the code and comments.

**Which issue this PR fixes**
 fixes #38418,#36859
**Special notes for your reviewer**:

**Release note**:

```release-note
Fixes issue #38418 which, under circumstance, could cause StatefulSet to deadlock. 
Mediates issue #36859. StatefulSet only acts on Pods whose identity matches the StatefulSet, providing a partial mediation for overlapping controllers.
```
2017-02-10 00:04:49 -08:00
..
certificates Switch CSR controller to use shared informer 2017-02-08 11:01:34 -05:00
cloud Replace hand-written informers with generated ones 2017-02-06 13:49:27 -05:00
cronjob Update owners file for job and cronjob controller 2017-02-07 11:24:51 +01:00
daemon Merge pull request #40385 from ncdc/shared-informers-02-swap-existing 2017-02-06 16:25:42 -08:00
deployment Merge pull request #41145 from kargakis/cleanup-test-fix 2017-02-09 13:34:24 -08:00
disruption move client/record 2017-01-31 19:14:13 -05:00
endpoint move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
garbagecollector install authorization.k8s.io/v1, add tests 2017-02-06 18:16:51 -05:00
informers make tools/cache authoritative 2017-01-25 08:29:45 -05:00
job Update owners file for job and cronjob controller 2017-02-07 11:24:51 +01:00
namespace Autogenerated bazel changes 2017-02-06 10:50:40 -08:00
node Merge pull request #36592 from andrewsykim/36273-set-all-node-conditions-unknown-when-node-unreachable 2017-02-09 23:10:47 -08:00
podautoscaler move client/record 2017-01-31 19:14:13 -05:00
podgc Replace hand-written informers with generated ones 2017-02-06 13:49:27 -05:00
replicaset Replace hand-written informers with generated ones 2017-02-06 13:49:27 -05:00
replication Replace hand-written informers with generated ones 2017-02-06 13:49:27 -05:00
resourcequota move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
route Merge pull request #40449 from deads2k/client-15-types 2017-01-26 14:23:42 -08:00
service move client/record 2017-01-31 19:14:13 -05:00
serviceaccount Update generated files 2017-02-03 08:15:46 +01:00
statefulset StatefulSet refactoring and semantics fix 2017-02-09 08:42:28 -08:00
ttl Add integration test for ttlcontroller. 2017-02-09 14:50:24 +01:00
volume Merge pull request #40385 from ncdc/shared-informers-02-swap-existing 2017-02-06 16:25:42 -08:00
.import-restrictions add import restrictions 2016-10-13 16:10:24 -07:00
BUILD Implement ttl controller 2017-02-09 13:53:32 +01:00
client_builder.go move client/record 2017-01-31 19:14:13 -05:00
controller_ref_manager.go Merge pull request #39366 from zdj6373/manager-log 2017-01-31 15:49:43 -08:00
controller_utils_test.go move client/record 2017-01-31 19:14:13 -05:00
controller_utils.go move client/record 2017-01-31 19:14:13 -05:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
lookup_cache.go Move APIs and core code to use metav1.ObjectMeta 2017-01-17 16:17:18 -05:00
OWNERS Add janetkuo to approvers for controllers 2017-02-08 14:37:25 -08:00