| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -289,12 +289,10 @@ func (f *framework) QueueSortFunc() LessFunc {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// anything but Success. If a non-success status is returned, then the scheduling
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// cycle is aborted.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunPreFilterPlugins(ctx context.Context, state *CycleState, pod *v1.Pod) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(preFilter, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(preFilter, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.preFilterPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						status = f.runPreFilterPlugin(ctx, pl, state, pod)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if !status.IsSuccess() {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -313,7 +311,7 @@ func (f *framework) RunPreFilterPlugins(ctx context.Context, state *CycleState,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPreFilterPlugin(ctx context.Context, pl PreFilterPlugin, state *CycleState, pod *v1.Pod) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.PreFilter(ctx, state, pod)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -332,12 +330,10 @@ func (f *framework) RunPreFilterExtensionAddPod(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					podToAdd *v1.Pod,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					nodeInfo *schedulernodeinfo.NodeInfo,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(preFilterExtensionAddPod, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(preFilterExtensionAddPod, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.preFilterPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if pl.PreFilterExtensions() == nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							continue
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -355,7 +351,7 @@ func (f *framework) RunPreFilterExtensionAddPod(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPreFilterExtensionAddPod(ctx context.Context, pl PreFilterPlugin, state *CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.PreFilterExtensions().AddPod(ctx, state, podToSchedule, podToAdd, nodeInfo)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -374,12 +370,10 @@ func (f *framework) RunPreFilterExtensionRemovePod(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					podToRemove *v1.Pod,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					nodeInfo *schedulernodeinfo.NodeInfo,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(preFilterExtensionRemovePod, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(preFilterExtensionRemovePod, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.preFilterPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if pl.PreFilterExtensions() == nil {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							continue
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -397,7 +391,7 @@ func (f *framework) RunPreFilterExtensionRemovePod(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPreFilterExtensionRemovePod(ctx context.Context, pl PreFilterPlugin, state *CycleState, podToSchedule *v1.Pod, podToAdd *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.PreFilterExtensions().RemovePod(ctx, state, podToSchedule, podToAdd, nodeInfo)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -417,12 +411,10 @@ func (f *framework) RunFilterPlugins(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					nodeInfo *schedulernodeinfo.NodeInfo,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				) PluginToStatus {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					var firstFailedStatus *Status
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(filter, firstFailedStatus, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(filter, firstFailedStatus.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					statuses := make(PluginToStatus)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.filterPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						pluginStatus := f.runFilterPlugin(ctx, pl, state, pod, nodeInfo)
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -448,7 +440,7 @@ func (f *framework) RunFilterPlugins(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runFilterPlugin(ctx context.Context, pl FilterPlugin, state *CycleState, pod *v1.Pod, nodeInfo *schedulernodeinfo.NodeInfo) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.Filter(ctx, state, pod, nodeInfo)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -467,12 +459,10 @@ func (f *framework) RunPostFilterPlugins(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					nodes []*v1.Node,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					filteredNodesStatuses NodeToStatusMap,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(postFilter, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(postFilter, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.postFilterPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						status = f.runPostFilterPlugin(ctx, pl, state, pod, nodes, filteredNodesStatuses)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if !status.IsSuccess() {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -486,7 +476,7 @@ func (f *framework) RunPostFilterPlugins(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPostFilterPlugin(ctx context.Context, pl PostFilterPlugin, state *CycleState, pod *v1.Pod, nodes []*v1.Node, filteredNodesStatuses NodeToStatusMap) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.PostFilter(ctx, state, pod, nodes, filteredNodesStatuses)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -500,12 +490,10 @@ func (f *framework) runPostFilterPlugin(ctx context.Context, pl PostFilterPlugin
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// It also returns *Status, which is set to non-success if any of the plugins returns
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// a non-success status.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunScorePlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodes []*v1.Node) (ps PluginToNodeScores, status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(score, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(score, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					pluginToNodeScores := make(PluginToNodeScores, len(f.scorePlugins))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.scorePlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						pluginToNodeScores[pl.Name()] = make(NodeScoreList, len(nodes))
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -581,7 +569,7 @@ func (f *framework) RunScorePlugins(ctx context.Context, state *CycleState, pod
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runScorePlugin(ctx context.Context, pl ScorePlugin, state *CycleState, pod *v1.Pod, nodeName string) (int64, *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.Score(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -591,7 +579,7 @@ func (f *framework) runScorePlugin(ctx context.Context, pl ScorePlugin, state *C
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runScoreExtension(ctx context.Context, pl ScorePlugin, state *CycleState, pod *v1.Pod, nodeScoreList NodeScoreList) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.ScoreExtensions().NormalizeScore(ctx, state, pod, nodeScoreList)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -604,12 +592,10 @@ func (f *framework) runScoreExtension(ctx context.Context, pl ScorePlugin, state
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// failure (bool) if any of the plugins returns an error. It also returns an
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// error containing the rejection message or the error occurred in the plugin.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunPreBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(preBind, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(preBind, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.preBindPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						status = f.runPreBindPlugin(ctx, pl, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if !status.IsSuccess() {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -622,7 +608,7 @@ func (f *framework) RunPreBindPlugins(ctx context.Context, state *CycleState, po
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPreBindPlugin(ctx context.Context, pl PreBindPlugin, state *CycleState, pod *v1.Pod, nodeName string) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.PreBind(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -633,12 +619,10 @@ func (f *framework) runPreBindPlugin(ctx context.Context, pl PreBindPlugin, stat
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// RunBindPlugins runs the set of configured bind plugins until one returns a non `Skip` status.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(bind, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(bind, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if len(f.bindPlugins) == 0 {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return NewStatus(Skip, "")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -658,7 +642,7 @@ func (f *framework) RunBindPlugins(ctx context.Context, state *CycleState, pod *
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runBindPlugin(ctx context.Context, bp BindPlugin, state *CycleState, pod *v1.Pod, nodeName string) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return bp.Bind(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -669,19 +653,17 @@ func (f *framework) runBindPlugin(ctx context.Context, bp BindPlugin, state *Cyc
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// RunPostBindPlugins runs the set of configured postbind plugins.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunPostBindPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(postBind, nil, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(postBind, Success.String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.postBindPlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						f.runPostBindPlugin(ctx, pl, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPostBindPlugin(ctx context.Context, pl PostBindPlugin, state *CycleState, pod *v1.Pod, nodeName string) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						pl.PostBind(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -694,12 +676,10 @@ func (f *framework) runPostBindPlugin(ctx context.Context, pl PostBindPlugin, st
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// plugins returns an error, it does not continue running the remaining ones and
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// returns the error. In such case, pod will not be scheduled.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunReservePlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(reserve, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(reserve, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.reservePlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						status = f.runReservePlugin(ctx, pl, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if !status.IsSuccess() {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -712,7 +692,7 @@ func (f *framework) RunReservePlugins(ctx context.Context, state *CycleState, po
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runReservePlugin(ctx context.Context, pl ReservePlugin, state *CycleState, pod *v1.Pod, nodeName string) *Status {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.Reserve(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -723,19 +703,17 @@ func (f *framework) runReservePlugin(ctx context.Context, pl ReservePlugin, stat
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// RunUnreservePlugins runs the set of configured unreserve plugins.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunUnreservePlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(unreserve, nil, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(unreserve, Success.String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.unreservePlugins {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						f.runUnreservePlugin(ctx, pl, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runUnreservePlugin(ctx context.Context, pl UnreservePlugin, state *CycleState, pod *v1.Pod, nodeName string) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						pl.Unreserve(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -752,12 +730,10 @@ func (f *framework) runUnreservePlugin(ctx context.Context, pl UnreservePlugin,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// Note that if multiple plugins asked to wait, then we wait for the minimum
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				// timeout duration.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) RunPermitPlugins(ctx context.Context, state *CycleState, pod *v1.Pod, nodeName string) (status *Status) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							f.metricsRecorder.observeExtensionPointDurationAsync(permit, status, metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					defer func() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						metrics.FrameworkExtensionPointDuration.WithLabelValues(permit, status.Code().String()).Observe(metrics.SinceInSeconds(startTime))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					pluginsWaitTime := make(map[string]time.Duration)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					statusCode := Success
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					for _, pl := range f.permitPlugins {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -809,7 +785,7 @@ func (f *framework) RunPermitPlugins(ctx context.Context, state *CycleState, pod
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				func (f *framework) runPermitPlugin(ctx context.Context, pl PermitPlugin, state *CycleState, pod *v1.Pod, nodeName string) (*Status, time.Duration) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordFrameworkMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					if !state.ShouldRecordPluginMetrics() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return pl.Permit(ctx, state, pod, nodeName)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					startTime := time.Now()
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |