{{- if not .Values.trivy.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "trivy.fullname" . }}
  labels:
{{ include "trivy.labels" . | indent 4 }}
type: Opaque
data:
  GITHUB_TOKEN: {{ .Values.trivy.gitHubToken | default "" | b64enc | quote }}
  TRIVY_TOKEN: {{ .Values.trivy.serverToken | default "" | b64enc | quote }}
{{- if not .Values.trivy.registryCredentialsExistingSecret }}
  TRIVY_USERNAME: {{ .Values.trivy.registryUsername | default "" | b64enc | quote }}
  TRIVY_PASSWORD: {{ .Values.trivy.registryPassword | default "" | b64enc | quote }}
{{- end -}}
{{- end }}
