{{- if and (not .Values.controller.admin.existingSecret) (.Values.controller.admin.createSecret) -}}

apiVersion: v1
kind: Secret
metadata:
  name: {{ template "jenkins.fullname" . }}
  namespace: {{ template "jenkins.namespace" . }}
  labels:
    "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
    {{- if .Values.renderHelmLabels }}
    "helm.sh/chart": "{{ template "jenkins.label" .}}"
    {{- end }}
    "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
    "app.kubernetes.io/instance": "{{ .Release.Name }}"
    "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
type: Opaque
data:
  jenkins-admin-password: {{ template "jenkins.password" . }}
  jenkins-admin-user: {{ .Values.controller.admin.username | b64enc | quote }}
{{- end }}
