Merge pull request #120125 from kerthcet/cleanup/write-to-cycle
Make sure skipped score plugins always returned
This commit is contained in:
		@@ -969,10 +969,11 @@ func (f *frameworkImpl) RunPreScorePlugins(
 | 
				
			|||||||
	nodes []*v1.Node,
 | 
						nodes []*v1.Node,
 | 
				
			||||||
) (status *framework.Status) {
 | 
					) (status *framework.Status) {
 | 
				
			||||||
	startTime := time.Now()
 | 
						startTime := time.Now()
 | 
				
			||||||
 | 
						skipPlugins := sets.New[string]()
 | 
				
			||||||
	defer func() {
 | 
						defer func() {
 | 
				
			||||||
 | 
							state.SkipScorePlugins = skipPlugins
 | 
				
			||||||
		metrics.FrameworkExtensionPointDuration.WithLabelValues(metrics.PreScore, status.Code().String(), f.profileName).Observe(metrics.SinceInSeconds(startTime))
 | 
							metrics.FrameworkExtensionPointDuration.WithLabelValues(metrics.PreScore, status.Code().String(), f.profileName).Observe(metrics.SinceInSeconds(startTime))
 | 
				
			||||||
	}()
 | 
						}()
 | 
				
			||||||
	skipPlugins := sets.New[string]()
 | 
					 | 
				
			||||||
	logger := klog.FromContext(ctx)
 | 
						logger := klog.FromContext(ctx)
 | 
				
			||||||
	logger = klog.LoggerWithName(logger, "PreScore")
 | 
						logger = klog.LoggerWithName(logger, "PreScore")
 | 
				
			||||||
	// TODO(knelasevero): Remove duplicated keys from log entry calls
 | 
						// TODO(knelasevero): Remove duplicated keys from log entry calls
 | 
				
			||||||
@@ -991,7 +992,6 @@ func (f *frameworkImpl) RunPreScorePlugins(
 | 
				
			|||||||
			return framework.AsStatus(fmt.Errorf("running PreScore plugin %q: %w", pl.Name(), status.AsError()))
 | 
								return framework.AsStatus(fmt.Errorf("running PreScore plugin %q: %w", pl.Name(), status.AsError()))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	state.SkipScorePlugins = skipPlugins
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -952,6 +952,7 @@ func TestRunPreScorePlugins(t *testing.T) {
 | 
				
			|||||||
					inj:  injectedResult{PreScoreStatus: int(framework.Error)},
 | 
										inj:  injectedResult{PreScoreStatus: int(framework.Error)},
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
								wantSkippedPlugins: sets.New("skip"),
 | 
				
			||||||
			wantStatusCode:     framework.Error,
 | 
								wantStatusCode:     framework.Error,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user