Open maheswarasunil opened 5 years ago
I've done a quick investigation on why this might happen and the culprit seems to be https://github.com/deepmind/kapitan/blob/v0.27.0/kapitan/resources.py#L234, called first at https://github.com/deepmind/kapitan/blob/v0.27.0/kapitan/targets.py#L312. Calls of inventory_reclass()
are cached as it's a pretty expensive operation (~2s for 100 targets), so we've already done some optimisation on our side.
This seems to be a side effect of reclass as it can only load all targets in the inventory - AFAIK you can't load single targets, checked reclass docs and couldn't find anything.
When you specify -t <targets>
it will only pass the specific target objects around (post-reclass) and compile just those, so it works as expected on those terms. Worst case scenario, your compilation is delayed by 1-2s because of a large inventory, which is an acceptable cost in my view. Additionally, this is only a problem if your single target compilation takes less than a few seconds, which in not the case in most production targets.
So we have a few options here:
-t <targets>
.This issue is stale because it has been open for 1 year with no activity. Remove the stale label or comment if this issue is still relevant for you. If not, please close it yourself.
Describe the feature During kapitan compile for the specific target using option -t, we are observing kapitan is processing the entire inventory and generating compiled output for that specific target. Due to this, compile time is very high even though we need to compile one target.
To Reproduce Steps to reproduce the behavior:
time kapitan compile -t inventory/targets/target01.yml
time kapitan compile