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
17 changes: 16 additions & 1 deletion templates/trivy/trivy-sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,21 @@ spec:
- name: api-server
containerPort: {{ template "harbor.trivy.containerPort" . }}
volumeMounts:
{{- if .Values.trivy.defaultDataVolumeMount.enabled }}
- name: data
mountPath: /home/scanner/.cache
subPath: {{ .Values.persistence.persistentVolumeClaim.trivy.subPath }}
readOnly: false
{{- end }}
{{- if .Values.internalTLS.enabled }}
- name: trivy-internal-certs
mountPath: /etc/harbor/ssl/trivy
{{- end }}
{{- if .Values.caBundleSecretName }}
{{ include "harbor.caBundleVolumeMount" . | indent 10 }}
{{- end }}
{{- with .Values.trivy.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
livenessProbe:
httpGet:
Expand Down Expand Up @@ -188,14 +193,24 @@ spec:
{{ include "harbor.caBundleVolume" . | indent 6 }}
{{- end }}
{{- if not .Values.persistence.enabled }}
{{- if .Values.trivy.defaultDataVolumeMount.enabled }}
- name: "data"
emptyDir: {}
{{- end }}
{{- else if $trivy.existingClaim }}
{{- if .Values.trivy.defaultDataVolumeMount.enabled }}
- name: "data"
persistentVolumeClaim:
claimName: {{ $trivy.existingClaim }}
{{- end }}
{{- end }}
{{- with .Values.trivy.extraVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- else if .Values.trivy.extraVolumes }}
volumes:
{{- toYaml .Values.trivy.extraVolumes | nindent 6 }}
{{- end }}
{{- with .Values.trivy.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand All @@ -211,7 +226,7 @@ spec:
{{- if .Values.trivy.priorityClassName }}
priorityClassName: {{ .Values.trivy.priorityClassName }}
{{- end }}
{{- if and .Values.persistence.enabled (not $trivy.existingClaim) }}
{{- if and .Values.persistence.enabled (not $trivy.existingClaim) .Values.trivy.defaultDataVolumeMount.enabled }}
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
Expand Down
7 changes: 7 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,13 @@ trivy:
failureThreshold: 3
successThreshold: 1
extraEnvVars: []
# defaultDataVolumeMount controls whether the default `data` volume is mounted at /home/scanner/.cache
# Set enabled to false when using extraVolumeMounts to override the cache and reports paths individually,
# to avoid mount conflicts with the parent path.
defaultDataVolumeMount:
enabled: true
extraVolumeMounts: []
extraVolumes: []
nodeSelector: {}
tolerations: []
affinity: {}
Expand Down
Loading