mirror of https://github.com/fluxcd/cli-utils.git
Skip InventoryPolicyApplyFilter for the `AdoptAll` inventory policy to
improve the performance Running InventoryPolicyApplyFilter involves getting every object in the current inventory from the live cluster, which can be expensive if the inventory includes lots of objects. If the inventory policy is `AdoptAll`, the current inventory can take ownership of any objects. Therefore, it is not necessary to run InventoryPolicyApplyFilter.
This commit is contained in:
parent
231f3f4a69
commit
97b02cd107
|
|
@ -173,14 +173,16 @@ func (a *Applier) Run(ctx context.Context, invInfo inventory.InventoryInfo, obje
|
|||
InventoryPolicy: options.InventoryPolicy,
|
||||
}
|
||||
// Build list of apply validation filters.
|
||||
applyFilters := []filter.ValidationFilter{
|
||||
filter.InventoryPolicyApplyFilter{
|
||||
applyFilters := []filter.ValidationFilter{}
|
||||
if options.InventoryPolicy != inventory.AdoptAll {
|
||||
applyFilters = append(applyFilters, filter.InventoryPolicyApplyFilter{
|
||||
Client: client,
|
||||
Mapper: mapper,
|
||||
Inv: invInfo,
|
||||
InvPolicy: options.InventoryPolicy,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// Build list of prune validation filters.
|
||||
pruneFilters := []filter.ValidationFilter{
|
||||
filter.PreventRemoveFilter{},
|
||||
|
|
|
|||
Loading…
Reference in New Issue