Skip to content

Commit b9b84cd

Browse files
authored
Add redis cache backend configuration options (#784)
You can now specify redis as caching as backend. The default is still the filesystem. In case redis is added as caching backend, the cache-dir is still used for the vulnerability database. Fixes #781 Signed-off-by: Christian Zunker <[email protected]>
1 parent e517bcc commit b9b84cd

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

helm/trivy/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: trivy
3-
version: 0.2.0
4-
appVersion: "0.14.0"
3+
version: 0.3.0
4+
appVersion: "0.15.0"
55
description: Trivy helm chart
66
keywords:
77
- scanner

helm/trivy/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ The following table lists the configurable parameters of the Trivy chart and the
5555
| `trivy.debugMode` | The flag to enable or disable Trivy debug mode | `false` |
5656
| `trivy.gitHubToken` | The GitHub access token to download Trivy DB | |
5757
| `trivy.skipUpdate` | The flag to enable or disable Trivy DB downloads from GitHub | `false` |
58+
| `trivy.cache.redis.enabled` | Enable Redis as caching backend | `false` |
59+
| `trivy.cache.redis.url` | Specify redis connection url, e.g. redis://redis.redis.svc:6379 | `` |
5860
| `service.type` | Kubernetes service type | `ClusterIP` |
5961
| `service.port` | Kubernetes service port | `4954` |
6062
| `httpProxy` | The URL of the HTTP proxy server | |
@@ -74,4 +76,9 @@ $ helm install my-release . \
7476

7577
## Storage
7678

77-
This chart uses a PersistentVolumeClaim to reduce the number of database downloads between POD restarts or updates. The storageclass should have the reclaim policy `Retain`.
79+
This chart uses a PersistentVolumeClaim to reduce the number of database downloads between POD restarts or updates. The storageclass should have the reclaim policy `Retain`.
80+
81+
## Caching
82+
83+
You can specify a Redis server as cache backend. This Redis server has to be already present. You can use the [bitname chart](https://bitnami.com/stack/redis/helm).
84+
More Information about the caching backends can be found [here](https://github.com/aquasecurity/trivy#specify-cache-backend).

helm/trivy/templates/statefulset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ spec:
5151
value: "0.0.0.0:{{ .Values.service.port | default 4954 }}"
5252
- name: "TRIVY_CACHE_DIR"
5353
value: "/home/scanner/.cache/trivy"
54+
{{- if .Values.trivy.cache.redis.enabled }}
55+
- name: "TRIVY_CACHE_BACKEND"
56+
value: {{ .Values.trivy.cache.redis.url | quote }}
57+
{{- end }}
5458
- name: "TRIVY_DEBUG"
5559
value: {{ .Values.trivy.debugMode | default false | quote }}
5660
- name: "TRIVY_SKIP_UPDATE"

helm/trivy/values.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fullnameOverride: ""
44
image:
55
registry: docker.io
66
repository: aquasec/trivy
7-
tag: 0.14.0
7+
tag: 0.15.0
88
pullPolicy: IfNotPresent
99

1010
replicaCount: 1
@@ -61,6 +61,18 @@ trivy:
6161
# If the flag is enabled you have to manually download the `trivy.db` file and mount it in the
6262
# `/home/scanner/.cache/trivy/db/trivy.db` path (see `cacheDir`).
6363
skipUpdate: false
64+
# Trivy supports filesystem and redis as caching backend
65+
# https://github.com/aquasecurity/trivy#specify-cache-backend
66+
# This location is only used for the cache, not the db storage: https://github.com/aquasecurity/trivy/issues/765#issue-756010345
67+
#
68+
# In case you specify redis as backend, make sure you installed a redis server yourself, e.g.
69+
# https://bitnami.com/stack/redis/helm
70+
#
71+
# In case redis is not enabled, the filesystem will be used
72+
cache:
73+
redis:
74+
enabled: false
75+
url: "" # e.g. redis://redis.redis.svc:6379
6476

6577
service:
6678
# type Kubernetes service type

0 commit comments

Comments
 (0)