File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
vertical-pod-autoscaler/pkg/utils/limitrange Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
24
24
"k8s.io/apimachinery/pkg/labels"
25
25
"k8s.io/client-go/informers"
26
26
listers "k8s.io/client-go/listers/core/v1"
27
+ "k8s.io/client-go/tools/cache"
27
28
)
28
29
29
30
// LimitRangeCalculator calculates limit range items that has the same effect as all limit range items present in the cluster.
@@ -55,13 +56,11 @@ func NewLimitsRangeCalculator(f informers.SharedInformerFactory) (*limitsChecker
55
56
}
56
57
limitRangeLister := f .Core ().V1 ().LimitRanges ().Lister ()
57
58
stopCh := make (chan struct {})
58
- f .Start (stopCh )
59
- for _ , ok := range f .WaitForCacheSync (stopCh ) {
60
- if ! ok {
61
- if ! f .Core ().V1 ().LimitRanges ().Informer ().HasSynced () {
62
- return nil , fmt .Errorf ("informer did not sync" )
63
- }
64
- }
59
+ informer := f .Core ().V1 ().LimitRanges ().Informer ()
60
+ go informer .Run (stopCh )
61
+ ok := cache .WaitForCacheSync (stopCh , informer .HasSynced )
62
+ if ! ok {
63
+ return nil , fmt .Errorf ("informer did not sync" )
65
64
}
66
65
return & limitsChecker {limitRangeLister }, nil
67
66
}
You can’t perform that action at this time.
0 commit comments