mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-06 16:48:28 +00:00
Merge pull request #124223 from chenk008/fix_apf_countTracker
Fix: EtcdOptions.StorageObjectCountTracker is nil, APF estimator got ObjectCountNotFoundErr
This commit is contained in:
@@ -399,6 +399,10 @@ func (f *StorageFactoryRestOptionsFactory) GetRESTOptions(resource schema.GroupR
|
||||
StorageObjectCountTracker: f.Options.StorageConfig.StorageObjectCountTracker,
|
||||
}
|
||||
|
||||
if ret.StorageObjectCountTracker == nil {
|
||||
ret.StorageObjectCountTracker = storageConfig.StorageObjectCountTracker
|
||||
}
|
||||
|
||||
if f.Options.EnableWatchCache {
|
||||
sizes, err := ParseWatchCacheSizes(f.Options.WatchCacheSizes)
|
||||
if err != nil {
|
||||
|
||||
@@ -430,3 +430,18 @@ func healthChecksAreEqual(t *testing.T, want []string, healthChecks []healthz.He
|
||||
t.Errorf("%s checks are not equal, missing=%q, extra=%q", checkerType, wantSet.Difference(gotSet).List(), gotSet.Difference(wantSet).List())
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestOptionsStorageObjectCountTracker(t *testing.T) {
|
||||
serverConfig := server.NewConfig(codecs)
|
||||
etcdOptions := &EtcdOptions{}
|
||||
if err := etcdOptions.ApplyTo(serverConfig); err != nil {
|
||||
t.Fatalf("Failed to apply etcd options error: %v", err)
|
||||
}
|
||||
restOptions, err := serverConfig.RESTOptionsGetter.GetRESTOptions(schema.GroupResource{Group: "", Resource: ""})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if restOptions.StorageConfig.StorageObjectCountTracker != serverConfig.StorageObjectCountTracker {
|
||||
t.Errorf("There are different StorageObjectCountTracker in restOptions and serverConfig")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user