{{- $secret_name := printf "%s-secrets" (include "rawfile-localpv.fullname" .) }}
apiVersion: v1
kind: Secret
metadata:
  labels:
    {{- include "rawfile-localpv.labels" . | nindent 4 }}
  name: {{ $secret_name }}
type: Opaque
data:
  {{- $old_sec := lookup "v1" "Secret" .Release.Namespace $secret_name }}
  {{- if not .Values.auth.token }}
  {{- if or (not $old_sec) (not $old_sec.data) }}
  internal-signature: {{ randAlphaNum 32 | b64enc }}
  {{- else }}
  internal-signature: {{ index $old_sec.data "internal-signature" }}
  {{- end }}
  {{- else }}
  internal-signature: {{ .Values.auth.token }}
  {{- end }}
