Achilleas Tzenetopoulos 5 年之前
父節點
當前提交
f57646fa14

+ 1 - 1
kubernetes-v1.15.4/pkg/scheduler/algorithm/priorities/custom_resource_allocation.go

@@ -122,7 +122,7 @@ func InvalidateCache() {
 
 func customResourceScorer(nodeName string) (float64, error) {
 
-	InvalidateCache()
+	//InvalidateCache()
 	//klog.Infof("The value of the Ticker: %v", customcache.LabCache.Timeout.C)
 	cores, _ := Cores[nodeName]
 

+ 13 - 11
kubernetes-v1.15.4/pkg/scheduler/scheduler.go

@@ -40,6 +40,8 @@ import (
 	"k8s.io/kubernetes/pkg/scheduler/core"
 
 	// "k8s.io/kubernetes/pkg/scheduler/customcache"
+	"github.com/iwita/kube-scheduler/customcache"
+
 	"k8s.io/kubernetes/pkg/scheduler/factory"
 	framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
 	internalcache "k8s.io/kubernetes/pkg/scheduler/internal/cache"
@@ -454,17 +456,17 @@ func (sched *Scheduler) scheduleOne() {
 	// default:
 	// }
 
-	// Check if the cache needs update
-	//klog.Infof("The value of the Ticker: %v", customcache.LabCache.Timeout.C)
-	// select {
-	// // clean the cache if 10 seconds are passed
-	// case <-customcache.LabCache.Timeout.C:
-	// 	klog.Infof("Time to erase: %v", time.Now())
-	// 	//customcache.LabCache.Timeout.Stop()
-	// 	customcache.LabCache.CleanCache()
-	// 	klog.Infof("Cache: %v", customcache.LabCache.Cache)
-	// default:
-	// }
+	//Check if the cache needs update
+	klog.Infof("The value of the Ticker: %v", customcache.LabCache.Timeout.C)
+	select {
+	// clean the cache if 10 seconds are passed
+	case <-customcache.LabCache.Timeout.C:
+		klog.Infof("Time to erase: %v", time.Now())
+		//customcache.LabCache.Timeout.Stop()
+		customcache.LabCache.CleanCache()
+		klog.Infof("Cache: %v", customcache.LabCache.Cache)
+	default:
+	}
 
 	fwk := sched.config.Framework