{{- if and (.Values.gitea.metrics.enabled) (.Values.gitea.metrics.serviceMonitor.enabled) (.Values.gitea.metrics.token) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "gitea.metrics-secret-name" . }}
  namespace: {{ .Values.namespace | default .Release.Namespace }}
  labels:
    {{- include "gitea.labels" . | nindent 4 }}
type: Opaque
data:
  token: {{ .Values.gitea.metrics.token  | b64enc }}
{{- end }}