mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #112579 from SergeyKanzhelev/removePodOverhead
remove podOverhead feature gate as a feature is now GA since 1.24
This commit is contained in:
		@@ -27,7 +27,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodRequestsAndLimits returns a dictionary of all defined resources summed up for all
 | 
					// PodRequestsAndLimits returns a dictionary of all defined resources summed up for all
 | 
				
			||||||
// containers of the pod. If PodOverhead feature is enabled, pod overhead is added to the
 | 
					// containers of the pod. Pod overhead is added to the
 | 
				
			||||||
// total container resource requests and to the total container limits which have a
 | 
					// total container resource requests and to the total container limits which have a
 | 
				
			||||||
// non-zero quantity.
 | 
					// non-zero quantity.
 | 
				
			||||||
func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList) {
 | 
					func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList) {
 | 
				
			||||||
@@ -57,7 +57,7 @@ func podRequestsAndLimitsWithoutOverhead(pod *v1.Pod, reqs, limits v1.ResourceLi
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PodRequestsAndLimitsReuse returns a dictionary of all defined resources summed up for all
 | 
					// PodRequestsAndLimitsReuse returns a dictionary of all defined resources summed up for all
 | 
				
			||||||
// containers of the pod. If PodOverhead feature is enabled, pod overhead is added to the
 | 
					// containers of the pod. Pod overhead is added to the
 | 
				
			||||||
// total container resource requests and to the total container limits which have a
 | 
					// total container resource requests and to the total container limits which have a
 | 
				
			||||||
// non-zero quantity. The caller may avoid allocations of resource lists by passing
 | 
					// non-zero quantity. The caller may avoid allocations of resource lists by passing
 | 
				
			||||||
// a requests and limits list to the function, which will be cleared before use.
 | 
					// a requests and limits list to the function, which will be cleared before use.
 | 
				
			||||||
@@ -67,7 +67,7 @@ func PodRequestsAndLimitsReuse(pod *v1.Pod, reuseReqs, reuseLimits v1.ResourceLi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	podRequestsAndLimitsWithoutOverhead(pod, reqs, limits)
 | 
						podRequestsAndLimitsWithoutOverhead(pod, reqs, limits)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if PodOverhead feature is supported, add overhead for running a pod
 | 
						// Add overhead for running a pod
 | 
				
			||||||
	// to the sum of requests and to non-zero limits:
 | 
						// to the sum of requests and to non-zero limits:
 | 
				
			||||||
	if pod.Spec.Overhead != nil {
 | 
						if pod.Spec.Overhead != nil {
 | 
				
			||||||
		addResourceList(reqs, pod.Spec.Overhead)
 | 
							addResourceList(reqs, pod.Spec.Overhead)
 | 
				
			||||||
@@ -143,7 +143,7 @@ func GetResourceRequestQuantity(pod *v1.Pod, resourceName v1.ResourceName) resou
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if PodOverhead feature is supported, add overhead for running a pod
 | 
						// Add overhead for running a pod
 | 
				
			||||||
	// to the total requests if the resource total is non-zero
 | 
						// to the total requests if the resource total is non-zero
 | 
				
			||||||
	if pod.Spec.Overhead != nil {
 | 
						if pod.Spec.Overhead != nil {
 | 
				
			||||||
		if podOverhead, ok := pod.Spec.Overhead[resourceName]; ok && !requestQuantity.IsZero() {
 | 
							if podOverhead, ok := pod.Spec.Overhead[resourceName]; ok && !requestQuantity.IsZero() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -622,14 +622,6 @@ const (
 | 
				
			|||||||
	// sandbox creation and network configuration completes successfully
 | 
						// sandbox creation and network configuration completes successfully
 | 
				
			||||||
	PodHasNetworkCondition featuregate.Feature = "PodHasNetworkCondition"
 | 
						PodHasNetworkCondition featuregate.Feature = "PodHasNetworkCondition"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// owner: @egernst
 | 
					 | 
				
			||||||
	// alpha: v1.16
 | 
					 | 
				
			||||||
	// beta: v1.18
 | 
					 | 
				
			||||||
	// ga: v1.24
 | 
					 | 
				
			||||||
	//
 | 
					 | 
				
			||||||
	// Enables PodOverhead, for accounting pod overheads which are specific to a given RuntimeClass
 | 
					 | 
				
			||||||
	PodOverhead featuregate.Feature = "PodOverhead"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// owner: @liggitt, @tallclair, sig-auth
 | 
						// owner: @liggitt, @tallclair, sig-auth
 | 
				
			||||||
	// alpha: v1.22
 | 
						// alpha: v1.22
 | 
				
			||||||
	// beta: v1.23
 | 
						// beta: v1.23
 | 
				
			||||||
@@ -973,8 +965,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	PodHasNetworkCondition: {Default: false, PreRelease: featuregate.Alpha},
 | 
						PodHasNetworkCondition: {Default: false, PreRelease: featuregate.Alpha},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	PodOverhead: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	PodSecurity: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
 | 
						PodSecurity: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ProbeTerminationGracePeriod: {Default: true, PreRelease: featuregate.Beta}, // Default to true in beta 1.25
 | 
						ProbeTerminationGracePeriod: {Default: true, PreRelease: featuregate.Beta}, // Default to true in beta 1.25
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,8 +107,8 @@ func (r *resourceAllocationScorer) calculateResourceAllocatableRequest(nodeInfo
 | 
				
			|||||||
	return 0, 0
 | 
						return 0, 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// calculatePodResourceRequest returns the total non-zero requests. If Overhead is defined for the pod and the
 | 
					// calculatePodResourceRequest returns the total non-zero requests. If Overhead is defined for the pod
 | 
				
			||||||
// PodOverhead feature is enabled, the Overhead is added to the result.
 | 
					// the Overhead is added to the result.
 | 
				
			||||||
// podResourceRequest = max(sum(podSpec.Containers), podSpec.InitContainers) + overHead
 | 
					// podResourceRequest = max(sum(podSpec.Containers), podSpec.InitContainers) + overHead
 | 
				
			||||||
func (r *resourceAllocationScorer) calculatePodResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64 {
 | 
					func (r *resourceAllocationScorer) calculatePodResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64 {
 | 
				
			||||||
	var podRequest int64
 | 
						var podRequest int64
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -177,7 +177,7 @@ func recordMetricWithUnit(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// podRequestsAndLimitsByLifecycle returns a dictionary of all defined resources summed up for all
 | 
					// podRequestsAndLimitsByLifecycle returns a dictionary of all defined resources summed up for all
 | 
				
			||||||
// containers of the pod. If PodOverhead feature is enabled, pod overhead is added to the
 | 
					// containers of the pod. Pod overhead is added to the
 | 
				
			||||||
// total container resource requests and to the total container limits which have a
 | 
					// total container resource requests and to the total container limits which have a
 | 
				
			||||||
// non-zero quantity. The caller may avoid allocations of resource lists by passing
 | 
					// non-zero quantity. The caller may avoid allocations of resource lists by passing
 | 
				
			||||||
// a requests and limits list to the function, which will be cleared before use.
 | 
					// a requests and limits list to the function, which will be cleared before use.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user