{{- if and .Values.kustomizeController.secret.create }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Values.kustomizeController.secret.name }}
  namespace:  {{ .Release.Namespace }}
  labels:
    app.kubernetes.io/instance: {{ .Release.Namespace | quote }}
    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
    app.kubernetes.io/version: {{ .Chart.AppVersion | quote  }}
    app.kubernetes.io/part-of: flux
    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
type: Opaque
data:
  {{- range $key, $value := .Values.kustomizeController.secret.data }}
  {{ $key }}: {{ $value | toString | b64enc | quote }}
  {{- end }}
{{- end }}
