@@ -390,6 +390,54 @@ Besides being reported in Events, the reconciliation errors are also logged by
390
390
the controller. The Flux CLI offer commands for filtering the logs for a
391
391
specific HelmChart, e.g. `flux logs --level=error --kind=HelmChart --name=<chart-name>`.
392
392
393
+ # ## Improving Resource Consumption Using The Cache
394
+
395
+ When using a Helm Repository as source for a Helm chart and dependencies, the
396
+ controller loads the Helm Repository index in-memory to find the latest version
397
+ of the chart.
398
+
399
+ The controller can be configured to cache a Helm Repository indexes in-memory.
400
+ The cache is used to avoid loading Helm Repository indexes for every Helm chart
401
+ reconciliation.
402
+
403
+ Three fields are provided to enable and configure the cache :
404
+ - `helm-cache-max-size` : The maximum size of the cache in number of indexes.
405
+ If `0`, then the cache is disabled.
406
+ - `helm-cache-ttl` : The TTL of an index in the cache.
407
+ - `helm-cache-purge-interval` : The interval at which the cache is purged of
408
+ expired items.
409
+
410
+ The caching strategy is to pull a Helm Repository index from the cache if it is
411
+ available, otherwise to load the index, to retrieve and build the chart,
412
+ then cache the index. The cached index ttl is refreshed every time the
413
+ Helm Repository index is loaded with the `helm-cache-ttl` value.
414
+
415
+ The cache is purged of expired items every `helm-cache-purge-interval`.
416
+
417
+ When the cache is full, no more items can be added to the cache, the
418
+ source-controller will report a warning event instead.
419
+
420
+ In order to use the cache, set the related flags in the source-controller
421
+ deployment config :
422
+
423
+ ` ` ` yaml
424
+ spec:
425
+ containers:
426
+ - args:
427
+ - --watch-all-namespaces
428
+ - --log-level=info
429
+ - --log-encoding=json
430
+ - --enable-leader-election
431
+ - --storage-path=/data
432
+ - --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
433
+ ## Helm Cache with up to 10 items, i.e. 10 indexes.
434
+ - --helm-cache-max-size=10
435
+ ## TTL of an index is 1 hour.
436
+ - --helm-cache-ttl=1h
437
+ ## Purge expired index every 10 minutes.
438
+ - --helm-cache-purge-interval=10m
439
+ ` ` `
440
+
393
441
# # HelmChart Status
394
442
395
443
# ## Artifact
0 commit comments