Skip to content

Commit

Permalink
Update the docs with a section regarding the cache usage
Browse files Browse the repository at this point in the history
Signed-off-by: Soule BA <soule@weave.works>
  • Loading branch information
souleb committed Mar 31, 2022
1 parent 15ab075 commit 3a633e4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/spec/v1beta2/helmcharts.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,3 +624,41 @@ reconcile](#triggering-a-reconcile).

[typical-status-properties]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
[kstatus-spec]: https://github.com/kubernetes-sigs/cli-utils/tree/master/pkg/kstatus


## Using The Helm Index

When using a Helm Repository as source for a Helm chart and dependencies, the controller loads the Helm Repository index in-memory to find the latest version of the chart.

The controller can be configured to cache a Helm Repository indexes in-memory. The cache is used to avoid loading Helm Repository indexes for every Helm chart reconciliation.

Three fields are provided to enable and configure the cache:
- `helm-cache-max-size`: The maximum size of the cache in number of items. If `0`, then the cache is disabled.
- `helm-cache-ttl`: The TTL of an item in the cache.
- `helm-cache-purge-interval`: The interval at which the cache is purged of expired items.

The caching strategy is to pull a Helm Repository index from the cache if it is available, otherwise to load the index, to retrieve and build the chart, then cache the index. The cached index ttl is refreshed every time the Helm Repository index is loaded with the `helm-cache-ttl` value.

The cache is purged of expired items every `helm-cache-purge-interval`.

When the cache is full, no more items can be added to the cache, the source-controller will report a warning event instead.

In order to use the cache, set the related flags in the source-controller deployment config:

```yaml
spec:
containers:
- args:
- --watch-all-namespaces
- --log-level=info
- --log-encoding=json
- --enable-leader-election
- --storage-path=/data
- --storage-adv-addr=source-controller.$(RUNTIME_NAMESPACE).svc.cluster.local.
## Helm Cache with up to 10 items, i.e. 10 indexes.
- --helm-cache-max-size=10
## TTL of an item is 1 hour.
- --helm-cache-ttl=1h
## Purge expired items every 10 minutes.
- --helm-cache-purge-interval=10m
```

0 comments on commit 3a633e4

Please sign in to comment.