mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
ControllerRef creation through factory function
This commit is contained in:
parent
6796645672
commit
290101330e
@ -484,16 +484,7 @@ func (rsc *ReplicaSetController) manageReplicas(filteredPods []*v1.Pod, rs *apps
|
|||||||
// after one of its pods fails. Conveniently, this also prevents the
|
// after one of its pods fails. Conveniently, this also prevents the
|
||||||
// event spam that those failures would generate.
|
// event spam that those failures would generate.
|
||||||
successfulCreations, err := slowStartBatch(diff, controller.SlowStartInitialBatchSize, func() error {
|
successfulCreations, err := slowStartBatch(diff, controller.SlowStartInitialBatchSize, func() error {
|
||||||
boolPtr := func(b bool) *bool { return &b }
|
err := rsc.podControl.CreatePodsWithControllerRef(rs.Namespace, &rs.Spec.Template, rs, metav1.NewControllerRef(rs, rsc.GroupVersionKind))
|
||||||
controllerRef := &metav1.OwnerReference{
|
|
||||||
APIVersion: rsc.GroupVersion().String(),
|
|
||||||
Kind: rsc.Kind,
|
|
||||||
Name: rs.Name,
|
|
||||||
UID: rs.UID,
|
|
||||||
BlockOwnerDeletion: boolPtr(true),
|
|
||||||
Controller: boolPtr(true),
|
|
||||||
}
|
|
||||||
err := rsc.podControl.CreatePodsWithControllerRef(rs.Namespace, &rs.Spec.Template, rs, controllerRef)
|
|
||||||
if err != nil && errors.IsTimeout(err) {
|
if err != nil && errors.IsTimeout(err) {
|
||||||
// Pod is created but its initialization has timed out.
|
// Pod is created but its initialization has timed out.
|
||||||
// If the initialization is successful eventually, the
|
// If the initialization is successful eventually, the
|
||||||
|
Loading…
Reference in New Issue
Block a user