mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 03:38:15 +00:00 
			
		
		
		
	Skip unnecessary copy of Selector
This commit is contained in:
		@@ -739,11 +739,6 @@ func AddDeploymentKeyToReplicationController(oldRc *corev1.ReplicationController
 | 
			
		||||
	if oldRc.Spec.Selector == nil {
 | 
			
		||||
		oldRc.Spec.Selector = map[string]string{}
 | 
			
		||||
	}
 | 
			
		||||
	// Copy the old selector, so that we can scrub out any orphaned pods
 | 
			
		||||
	selectorCopy := map[string]string{}
 | 
			
		||||
	for k, v := range oldRc.Spec.Selector {
 | 
			
		||||
		selectorCopy[k] = v
 | 
			
		||||
	}
 | 
			
		||||
	applyUpdate = func(rc *corev1.ReplicationController) {
 | 
			
		||||
		rc.Spec.Selector[deploymentKey] = deploymentValue
 | 
			
		||||
	}
 | 
			
		||||
@@ -755,7 +750,7 @@ func AddDeploymentKeyToReplicationController(oldRc *corev1.ReplicationController
 | 
			
		||||
	// Clean up any orphaned pods that don't have the new label, this can happen if the rc manager
 | 
			
		||||
	// doesn't see the update to its pod template and creates a new pod with the old labels after
 | 
			
		||||
	// we've finished re-adopting existing pods to the rc.
 | 
			
		||||
	selector = labels.SelectorFromSet(selectorCopy)
 | 
			
		||||
	selector = labels.SelectorFromSet(oldRc.Spec.Selector)
 | 
			
		||||
	options = metav1.ListOptions{LabelSelector: selector.String()}
 | 
			
		||||
	if podList, err = podClient.Pods(namespace).List(options); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user