{{- if (include "solr.createSecret" .) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "common.names.fullname" . }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: solr
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
  namespace: {{ .Release.Namespace | quote }}
type: Opaque
data:
  solr-password: {{ include "solr.password" . | b64enc | quote }}
---
{{- end }}
{{- if (include "solr.createTlsPasswordsSecret" .) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ printf "%s-tls-pass" (include "common.names.fullname" .) }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: solr
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
  namespace: {{ .Release.Namespace | quote }}
type: Opaque
data:
  keystore-password: {{ default (randAlphaNum 10) .Values.tls.keystorePassword | b64enc | quote }}
  truststore-password: {{ default (randAlphaNum 10) .Values.tls.truststorePassword | b64enc | quote }}
---
{{- end }}
