{{- if .Values.keycloakIntegration.enabled -}}
{{- if not .Values.keycloakIntegration.client.public -}}
{{- $secret := (lookup "v1" "Secret" .Release.Namespace .Values.keycloakIntegration.client.secretName) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Values.keycloakIntegration.client.secretName }}
  annotations:
    "helm.sh/resource-policy": keep
  labels:
  {{- include "gerrit-operator.metaLabels" . | nindent 4 }}
type: Opaque
  {{- if $secret }}
data:
  clientSecret: {{ $secret.data.clientSecret }}
  {{- else }}
stringData:
  {{- $clientSecret := uuidv4 | quote }}
  clientSecret: {{ $clientSecret }}
{{- end -}}
{{- end -}}
{{- end -}}