fix(inventory): Fix inventory source caching

Fix inventory source caching by separating the fetching of objects and
populating the inventory. This way objects can be fetched from the K8S
API or from a configured cached and the cache related parameters on the
plugin now actually work.

The inventory source cache was tested with the ansible.builtin.jsonfile
cache plugin and 100k hosts (~2G JSON file). Though it took a noticeable
amount of time for the inventory plugin to run it worked fine and no
failures could be observed.

Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
This commit is contained in:
Felix Matouschek
2024-07-08 17:25:28 +02:00
parent a228fe2c26
commit 060ac97b68
13 changed files with 408 additions and 218 deletions

3
.gitignore vendored
View File

@@ -145,7 +145,10 @@ kubevirt.core
/tests/output/
/tests/integration/inventory
/tests/integration/targets/inventory_kubevirt/all.yml
/tests/integration/targets/inventory_kubevirt/cache_after.yml
/tests/integration/targets/inventory_kubevirt/cache_before.yml
/tests/integration/targets/inventory_kubevirt/empty.yml
/tests/integration/targets/inventory_kubevirt/label.yml
/tests/integration/targets/inventory_kubevirt/net.yml
/tests/integration/targets/kubevirt_vm/files
kubevirt-cache