mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
scheduler: fix assume cache with no index
The assume cache in the volumbinding plugin can be created with no separate index, but List then failed because it tried to use the empty index name instead of using the store's List function.
This commit is contained in:
parent
bf7fcfdc7f
commit
eb1470d60d
@ -283,10 +283,16 @@ func (c *assumeCache) List(indexObj interface{}) []interface{} {
|
||||
defer c.rwMutex.RUnlock()
|
||||
|
||||
allObjs := []interface{}{}
|
||||
objs, err := c.store.Index(c.indexName, &objInfo{latestObj: indexObj})
|
||||
if err != nil {
|
||||
c.logger.Error(err, "List index error")
|
||||
return nil
|
||||
var objs []interface{}
|
||||
if c.indexName != "" {
|
||||
o, err := c.store.Index(c.indexName, &objInfo{latestObj: indexObj})
|
||||
if err != nil {
|
||||
c.logger.Error(err, "List index error")
|
||||
return nil
|
||||
}
|
||||
objs = o
|
||||
} else {
|
||||
objs = c.store.List()
|
||||
}
|
||||
|
||||
for _, obj := range objs {
|
||||
|
Loading…
Reference in New Issue
Block a user