{{- if index .Values "argo-cd" "kubezero" "repoUrl" }}
apiVersion: v1
kind: Secret
metadata:
  name: kubezero-git-sync
  namespace: argocd
  labels:
    argocd.argoproj.io/secret-type: repository
    {{- include "kubezero-lib.labels" . | nindent 4 }}
type: Opaque
stringData:
  name: kubezero-git-sync
  type: git
  url: {{ index .Values "argo-cd" "kubezero" "repoUrl" }}
  {{- if hasPrefix "https" (index .Values "argo-cd" "kubezero" "repoUrl") }}
  username: {{ index .Values "argo-cd" "kubezero" "username" }}
  password: {{ index .Values "argo-cd" "kubezero" "password" }}
  {{- else }}
  sshPrivateKey: {{ index .Values "argo-cd" "kubezero" "sshPrivateKey" }}
  {{- end }}
{{- end }}
