mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	ControllerRef creation through factory function
This commit is contained in:
		@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user