ArgoCD: Multiple Chart & Values sources across repos"

I am trying to deploy an application using ArgoCD which requires two sources. The Chart itself will be deployed from https://charts.bitnami.com/bitnami, while the values.yaml will be pulled from a private GitHub repository. According to ArgoCD documentation, multiple sources are supported. However, I am running into an issue where our GitLab is using 2FA, and I am unable to add credentials for the private repository. Is there a workaround for this?

Yes, there is a workaround for using 2FA with ArgoCD and private repositories.

Instead of directly configuring the GitLab repository as a source in ArgoCD, you can use a Kubernetes secret to store the GitLab access token and then mount it as a volume in your ArgoCD deployment.

Here are the steps to follow:

  1. Create a Kubernetes secret to store your GitLab access token. Replace YOUR_ACCESS_TOKEN and YOUR_NAMESPACE with your actual values.

    kubectl create secret generic argocd-gitlab-secret --from-literal=token=YOUR_ACCESS_TOKEN -n YOUR_NAMESPACE
    
  2. Modify your ArgoCD deployment YAML file and add a volume and volume mount to reference the created secret. Replace YOUR_NAMESPACE with your actual value.

    spec:
      template:
        spec:
          volumes:
            - name: gitlab-secret
              secret:
                secretName: argocd-gitlab-secret
          containers:
            - name: argocd-server
              volumeMounts:
                - name: gitlab-secret
                  mountPath: /app/config/credentials
                  readOnly: true
    
  3. Update the repository configuration in ArgoCD to use the mounted secret as the credentials. Replace YOUR_REPO_URL with your private GitLab repository URL.

    argocd repo add YOUR_REPO_URL --type git --name YOUR_REPO_NAME --username git --password-file /app/config/credentials/token
    
  4. Now you can deploy your application using ArgoCD, and it should be able to access the private repository using the secret for authentication.

This workaround allows you to use GitLab repositories with 2FA enabled in ArgoCD.