mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	Fixed potential OutOfSync of nodeInfo.
This commit is contained in:
		| @@ -82,6 +82,19 @@ func (r *Resource) ResourceList() v1.ResourceList { | |||||||
| 	return result | 	return result | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (r *Resource) Clone() *Resource { | ||||||
|  | 	res := &Resource{ | ||||||
|  | 		MilliCPU:  r.MilliCPU, | ||||||
|  | 		Memory:    r.Memory, | ||||||
|  | 		NvidiaGPU: r.NvidiaGPU, | ||||||
|  | 	} | ||||||
|  | 	res.OpaqueIntResources = make(map[v1.ResourceName]int64) | ||||||
|  | 	for k, v := range r.OpaqueIntResources { | ||||||
|  | 		res.OpaqueIntResources[k] = v | ||||||
|  | 	} | ||||||
|  | 	return res | ||||||
|  | } | ||||||
|  |  | ||||||
| func (r *Resource) AddOpaque(name v1.ResourceName, quantity int64) { | func (r *Resource) AddOpaque(name v1.ResourceName, quantity int64) { | ||||||
| 	// Lazily allocate opaque integer resource map. | 	// Lazily allocate opaque integer resource map. | ||||||
| 	if r.OpaqueIntResources == nil { | 	if r.OpaqueIntResources == nil { | ||||||
| @@ -186,9 +199,9 @@ func (n *NodeInfo) AllocatableResource() Resource { | |||||||
| func (n *NodeInfo) Clone() *NodeInfo { | func (n *NodeInfo) Clone() *NodeInfo { | ||||||
| 	clone := &NodeInfo{ | 	clone := &NodeInfo{ | ||||||
| 		node:                    n.node, | 		node:                    n.node, | ||||||
| 		requestedResource:       &(*n.requestedResource), | 		requestedResource:       n.requestedResource.Clone(), | ||||||
| 		nonzeroRequest:          &(*n.nonzeroRequest), | 		nonzeroRequest:          n.nonzeroRequest.Clone(), | ||||||
| 		allocatableResource:     &(*n.allocatableResource), | 		allocatableResource:     n.allocatableResource.Clone(), | ||||||
| 		allowedPodNumber:        n.allowedPodNumber, | 		allowedPodNumber:        n.allowedPodNumber, | ||||||
| 		taintsErr:               n.taintsErr, | 		taintsErr:               n.taintsErr, | ||||||
| 		memoryPressureCondition: n.memoryPressureCondition, | 		memoryPressureCondition: n.memoryPressureCondition, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Klaus Ma
					Klaus Ma