Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 37 additions & 36 deletions helm/trivy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,43 @@ The command removes all the Kubernetes components associated with the chart and

The following table lists the configurable parameters of the Trivy chart and their default values.

| Parameter | Description | Default |
|---------------------------------------|-------------------------------------------------------------------------|----------------|
| `image.registry` | Image registry | `docker.io` |
| `image.repository` | Image name | `aquasec/trivy` |
| `image.tag` | Image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecret` | The name of an imagePullSecret used to pull trivy image from e.g. Docker Hub or a private registry | |
| `replicaCount` | Number of Trivy Pods to run | `1` |
| `trivy.debugMode` | The flag to enable or disable Trivy debug mode | `false` |
| `trivy.gitHubToken` | The GitHub access token to download Trivy DB. More info: https://trivy.dev/docs/latest/references/troubleshooting/#github-rate-limiting | |
| `trivy.registryUsername` | The username used to log in at dockerhub. More info: https://trivy.dev/docs/latest/advanced/private-registries/docker-hub/ | |
| `trivy.registryPassword` | The password used to log in at dockerhub. More info: https://trivy.dev/docs/latest/advanced/private-registries/docker-hub/ | |
| `trivy.registryCredentialsExistingSecret` | Name of Secret containing dockerhub credentials. Alternative to the 2 parameters above, has precedence if set. | |
| `trivy.serviceAccount.annotations` | Additional annotations to add to the Kubernetes service account resource | |
| `trivy.skipDBUpdate` | The flag to enable or disable Trivy DB downloads from GitHub | `false` |
| `trivy.dbRepository` | OCI repository to retrieve the trivy vulnerability database from | `ghcr.io/aquasecurity/trivy-db` |
| `trivy.cache.redis.enabled` | Enable Redis as caching backend | `false` |
| `trivy.cache.redis.url` | Specify redis connection url, e.g. redis://redis.redis.svc:6379 | `` |
| `trivy.cache.redis.ttl` | Specify redis TTL, e.g. 3600s or 24h | `` |
| `trivy.cache.redis.tls` | Enable Redis TLS with public certificates | `` |
| `trivy.serverToken` | The token to authenticate Trivy client with Trivy server | `` |
| `trivy.existingSecret` | existingSecret if an existing secret has been created outside the chart. Overrides gitHubToken, registryUsername, registryPassword, serverToken | `` |
| `trivy.podAnnotations` | Annotations for pods created by statefulset | `{}` |
| `trivy.extraEnvVars` | extraEnvVars to be set on the container | `{}` |
| `trivy.sslCertDir` | Can be used to override the system default locations for SSL certificate files directory, example: `/ssl/certs` | `` |
| `service.name` | If specified, the name used for the Trivy service | |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.port` | Kubernetes service port | `4954` |
| `service.sessionAffinity` | Kubernetes service session affinity | `ClientIP` |
| `httpProxy` | The URL of the HTTP proxy server | |
| `httpsProxy` | The URL of the HTTPS proxy server | |
| `noProxy` | The URLs that the proxy settings do not apply to | |
| `nodeSelector` | Node labels for pod assignment | |
| `affinity` | Affinity settings for pod assignment | |
| `tolerations` | Tolerations for pod assignment | |
| `podAnnotations` | Annotations for pods created by statefulset | `{}` |
| Parameter | Description | Default |
|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|
| `image.registry` | Image registry | `docker.io` |
| `image.repository` | Image name | `aquasec/trivy` |
| `image.tag` | Image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecret` | The name of an imagePullSecret used to pull trivy image from e.g. Docker Hub or a private registry | `` |
| `replicaCount` | Number of Trivy Pods to run | `1` |
| `trivy.customContainerArgs` | The custom container args in case of using an image with a different entrypoint | `[]` |
| `trivy.debugMode` | The flag to enable or disable Trivy debug mode | `false` |
| `trivy.gitHubToken` | The GitHub access token to download Trivy DB. More info: https://trivy.dev/docs/latest/references/troubleshooting/#github-rate-limiting | `` |
| `trivy.registryUsername` | The username used to log in at dockerhub. More info: https://trivy.dev/docs/latest/advanced/private-registries/docker-hub/ | `` |
| `trivy.registryPassword` | The password used to log in at dockerhub. More info: https://trivy.dev/docs/latest/advanced/private-registries/docker-hub/ | `` |
| `trivy.registryCredentialsExistingSecret` | Name of Secret containing dockerhub credentials. Alternative to the 2 parameters above, has precedence if set. | `` |
| `trivy.serviceAccount.annotations` | Additional annotations to add to the Kubernetes service account resource | `` |
| `trivy.skipDBUpdate` | The flag to enable or disable Trivy DB downloads from GitHub | `false` |
| `trivy.dbRepository` | OCI repository to retrieve the trivy vulnerability database from | `ghcr.io/aquasecurity/trivy-db` |
| `trivy.cache.redis.enabled` | Enable Redis as caching backend | `false` |
| `trivy.cache.redis.url` | Specify redis connection url, e.g. redis://redis.redis.svc:6379 | `` |
| `trivy.cache.redis.ttl` | Specify redis TTL, e.g. 3600s or 24h | `` |
| `trivy.cache.redis.tls` | Enable Redis TLS with public certificates | `` |
| `trivy.serverToken` | The token to authenticate Trivy client with Trivy server | `` |
| `trivy.existingSecret` | existingSecret if an existing secret has been created outside the chart. Overrides gitHubToken, registryUsername, registryPassword, serverToken | `` |
| `trivy.podAnnotations` | Annotations for pods created by statefulset | `{}` |
| `trivy.extraEnvVars` | extraEnvVars to be set on the container | `{}` |
| `trivy.sslCertDir` | Can be used to override the system default locations for SSL certificate files directory, example: `/ssl/certs` | `` |
| `service.name` | If specified, the name used for the Trivy service | `` |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.port` | Kubernetes service port | `4954` |
| `service.sessionAffinity` | Kubernetes service session affinity | `ClientIP` |
| `httpProxy` | The URL of the HTTP proxy server | `` |
| `httpsProxy` | The URL of the HTTPS proxy server | `` |
| `noProxy` | The URLs that the proxy settings do not apply to | `` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `affinity` | Affinity settings for pod assignment | `{}` |
| `tolerations` | Tolerations for pod assignment | `[]` |
| `podAnnotations` | Annotations for pods created by statefulset | `{}` |

The above parameters map to the env variables defined in [trivy](https://trivy.dev/docs/latest/configuration/#configuration).

Expand Down
11 changes: 11 additions & 0 deletions helm/trivy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ Return the proper imageRef as used by the container template spec.
{{- $tag := .Values.image.tag | default .Chart.AppVersion | toString -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}

{{/*
Return the proper customContainerArgs as used by the container template spec.
*/}}
{{- define "trivy.containerArgs" -}}
{{- if .Values.trivy.customContainerArgs -}}
{{- toYaml .Values.trivy.customContainerArgs -}}
{{- else -}}
- server
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion helm/trivy/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
{{ toYaml .Values.securityContext | indent 12 }}
{{- end }}
args:
- server
{{- include "trivy.containerArgs" . | nindent 12 }}
{{- if .Values.trivy.registryCredentialsExistingSecret }}
env:
- name: TRIVY_USERNAME
Expand Down
12 changes: 7 additions & 5 deletions helm/trivy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ tolerations: []
podAnnotations: {}

trivy:
# Define custom container args in case of using an image with a different entrypoint.
customContainerArgs: []
# debugMode the flag to enable Trivy debug mode
debugMode: false
# gitHubToken the GitHub access token to download Trivy DB
Expand Down Expand Up @@ -133,7 +135,7 @@ trivy:

service:
# If specified, the name used for the Trivy service.
name:
name: ""
# type Kubernetes service type
type: ClusterIP
# port Kubernetes service port
Expand All @@ -144,7 +146,7 @@ service:
ingress:
enabled: false
# From Kubernetes 1.18+ this field is supported in case your ingress controller supports it. When set, you do not need to add the ingress class as annotation.
ingressClassName:
ingressClassName: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
hosts:
Expand All @@ -158,8 +160,8 @@ ingress:
# - trivy.example.com

# httpProxy the URL of the HTTP proxy server
httpProxy:
httpProxy: ""
# httpsProxy the URL of the HTTPS proxy server
httpsProxy:
httpsProxy: ""
# noProxy the URLs that the proxy settings do not apply to
noProxy:
noProxy: ""