{{- if .Values.master.useSecurity -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "jenkins.fullname" . }}
  namespace: {{ template "jenkins.namespace" . }}
  labels:
    "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
    "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}"
    "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
    "app.kubernetes.io/instance": "{{ .Release.Name }}"
    "app.kubernetes.io/component": "{{ .Values.master.componentName }}"
type: Opaque
data:
  {{ if .Values.master.adminPassword -}}
  jenkins-admin-password: {{ .Values.master.adminPassword | b64enc | quote }}
  {{ else -}}
  jenkins-admin-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{ end -}}
  jenkins-admin-user: {{ .Values.master.adminUser | b64enc | quote }}
{{- end }}
