Skip to content

Commit

Permalink
feat(helm): allows users to define an existing secret for tokens (#2587)
Browse files Browse the repository at this point in the history
Signed-off-by: cebidhem <[email protected]>
  • Loading branch information
cebidhem authored Jul 31, 2022
1 parent d0ba59a commit d0ca610
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions helm/trivy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: trivy
version: 0.4.16
appVersion: 0.29.2
version: 0.4.17
appVersion: 0.30.4
description: Trivy helm chart
keywords:
- scanner
Expand Down
1 change: 1 addition & 0 deletions helm/trivy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ The following table lists the configurable parameters of the Trivy chart and the
| `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.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 | `{}` |
| `service.name` | If specified, the name used for the Trivy service | |
| `service.type` | Kubernetes service type | `ClusterIP` |
Expand Down
2 changes: 2 additions & 0 deletions helm/trivy/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.trivy.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -12,3 +13,4 @@ data:
TRIVY_USERNAME: {{ .Values.trivy.registryUsername | default "" | b64enc | quote }}
TRIVY_PASSWORD: {{ .Values.trivy.registryPassword | default "" | b64enc | quote }}
{{- end -}}
{{- end }}
4 changes: 4 additions & 0 deletions helm/trivy/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ spec:
- configMapRef:
name: {{ include "trivy.fullname" . }}
- secretRef:
{{- if not .Values.trivy.existingSecret }}
name: {{ include "trivy.fullname" . }}
{{- else }}
name: {{ .Values.trivy.existingSecret }}
{{- end }}
ports:
- name: trivy-http
containerPort: {{ .Values.service.port }}
Expand Down
3 changes: 3 additions & 0 deletions helm/trivy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ trivy:
labels: {}
# serverToken is the token to authenticate Trivy client with Trivy server.
serverToken: ""
# existingSecret if an existing secret has been created outside the chart.
# Overrides gitHubToken, registryUsername, registryPassword, serverToken
existingSecret: ""

service:
# If specified, the name used for the Trivy service.
Expand Down

0 comments on commit d0ca610

Please sign in to comment.