mirror of https://github.com/k3s-io/k3s
![]() Automatic merge from submit-queue [GarbageCollector] Fix kubectl rolling-update to work with GC This changes the order of the [Rename()](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L532) function. After the change, Rename() first deletes the old RC and orphans its pods, then creates the new RC, which will then have a chance to adopt the orphaned pods. This also fixes the "should support rolling-update to same image" [test](https://github.com/kubernetes/kubernetes/blob/master/test/e2e/kubectl.go#L915) when the garbage collector is on. Here is the detailed explanation on why the test would have failed: `kubectl rolling-update` will [rename](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/rolling_updater.go#L532-L546) the RC. It first creates the an identical RC (including spec.selectors) with the new name, then it deletes the existing RC. When GC is turned on, the newly created RC cannot adopt the existing pod, because it has a controllerRef pointing to the exising RC, so the new RC will create new pods and expect to see the creation. However, the new RC and the old RC have the same selector, so sometimes the old RC, instead of the new RC, has its [expectation lowered](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/replication/replication_controller.go#L346-L362), the new RC's expectation will stuck forever. The e2e test then times out when executing `kubectl delete newRC`, because there is the new RC will not scale down as its expectation is not fulfilled. A side-note, we should fix [rm.getPodController()](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/replication/replication_controller.go#L346) to respect pod's controllerref, that will prevent similar bugs. Also note that an old version `kubectl rolling-update` will not work with the GC. We cannot fix that. |
||
---|---|---|
.. | ||
auth | ||
client | ||
configmap | ||
framework | ||
garbagecollector | ||
kubectl | ||
master | ||
metrics | ||
openshift | ||
persistentvolumes | ||
pods | ||
quota | ||
replicaset | ||
replicationcontroller | ||
scheduler | ||
secrets | ||
serviceaccount | ||
storageclasses | ||
benchmark-controller.json | ||
doc.go | ||
utils.go |