Repository navigation
ApplicationSet found, but no diff rendered + SSH Authentication issues 聽#64
Copy link
Copy link
Closed
Description
Hey!
Thanks for a wonderful initiative.
I'm having trouble rendering my ApplicationSets. It seems like they are found, but not used in diff generation, or loaded to ArgoCD. See here:
馃 Fetching all files in dir: base-branch
馃 Found 10 applications
馃 Patching applications for branch: main
馃 Patching 10 Argo CD Application[Sets] for branch: main
馃 Fetching all files in dir: target-branch
馃 Found 10 applications
馃 Patching applications for branch: target-branch
馃 Patching 10 Argo CD Application[Sets] for branch: target-branch
馃殌 Creating cluster...
馃殌 Cluster created successfully
馃し No secrets found in ./secrets
馃 Installing Argo CD Helm Chart version: 'latest'
馃 Waiting for Argo CD to start...
馃 Argo CD is now available
馃 Logging in to Argo CD through CLI...
馃 Argo CD installed successfully
馃寶 Getting resources from base-branch
馃寶 Got all resources from 0 applications for base
馃Ъ Removing applications
馃Ъ Removed applications successfully
馃寶 Getting resources from target-branch
馃寶 Got all resources from 0 applications for target
馃挜 Deleting cluster...
馃敭 Generating diff between main and target-branch
馃檹 Please check the ./output/diff.md file for differences
馃帀 Done in 101 seconds
Here is an example of an ApplicationSet:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: metadata-name
namespace: my-namespace
spec:
goTemplate: true
goTemplateOptions: [ "missingkey=error" ]
generators:
- git:
repoURL: git@github.com:my-repo.git
revision: HEAD
directories:
- path: envs/appsets/*
template:
metadata:
name: '{{.path.basename}}-prod'
namespace: my-name-space
spec:
project: my-project
sources:
- repoURL: git@github.com:juliankock/my-repo.git
ref: local-files
- repoURL: git@github.com:juliankock/my-repo.git
targetRevision: HEAD
path: 'apps/{{.path.basename}}'
helm:
valueFiles:
- '$local-files/envs/values-k8s.yaml'
destination:
server: https://kubernetes.default.svc
namespace: my-namespace
syncPolicy:
automated:
prune: true # Specifies if resources should be pruned during auto-syncing ( false by default ).
selfHeal: true # Specifies if partial app sync should be executed when resources are changed only in target Kubernetes cluster and no git change detected ( false by default ).
I did look into the codebase, and I do not immediately see any overwrite of spec.template.spec.destination.namespace. May that be it?
update: tried to remove spec.template.spec.destination.namespace didn't fix it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
dag-andersen commentedon Nov 14, 2024
Hi @juliankock,
Thank you so much!
Is your repository private?
I noticed that the tool isn't being provided with any secrets for repository access (
馃し No secrets found in ./secrets), which could prevent it from creating applications based on the git generator.I hope this helps! If not, let me know, and we can investigate further.
seanturner026 commentedon Nov 20, 2024
I wonder if this only affects deploying a new directory ("
Application") via anApplicationSet? I am seeing similar behavior:Adding a new directory doesn't cause a diff in the PR Comment:
馃挙 1 Applications timed out.in the logs?Removing an existing directory actually caused an error:
Modifying an existing directory had the desired behavior (diff rendered):
ApplicationSet is here: https://github.com/seanturner026/argocd-applicationset/blob/8b2ad93e8c3cf920f073f4c79520d39251559d86/clusters/staging/infra-appset.yaml
And is deployed by this Application: https://github.com/seanturner026/argocd-applicationset/blob/8b2ad93e8c3cf920f073f4c79520d39251559d86/clusters/staging/argocd-app.yaml
Seems to be the case on 0.0.18 and 0.0.24? Please let me know if I should make separate Issues here. Also having a look on my end.
dag-andersen commentedon Nov 21, 2024
Thank you for the examples and investigation, @seanturner026.
I now realize that the git-generators do not work properly! The tool is not updating the git-generator-
revision-field to match the Pull request branch. I will have to fix that 馃殌 Sorry for the inconvenience.seanturner026 commentedon Nov 21, 2024
No inconvenience at all!
dag-andersen commentedon Dec 22, 2024
Hi @juliankock,
This issue should now be fixed in version
0.0.26! You can check it out here: [release] 馃殌Here鈥檚 a working example: #80.
Please let me know if you鈥檙e still encountering this issue 馃檹馃徎 It鈥檚 possible that the behavior you鈥檙e seeing is caused by something else
dag-andersen commentedon Jan 7, 2025
Hi @juliankock, Just wanted to follow up on this - have you had a chance to check out the new version? :) The issue you experienced might also be related to: issues 85
juliankock commentedon Jan 8, 2025
@dag-andersen
It seems like it now finds the ApplicationSets. However, since I use SSH AUTH reference to the repository, I now get the following failing GitHub action:
I do mount the secrets as specified here: https://dag-andersen.github.io/argocd-diff-preview/github-actions-workflow/
So maybe I need to add an SSH key to the container?
This is only a local constraint for our running ArgoCD instance. So if possible, the library here could just change to an HTTP repoURL.
dag-andersen commentedon Jan 12, 2025
@juliankock
How does your current real Argo CD instance authenticate with GitHub? Can't you use the same credentials/authentication method from the argocd-diff-preview cluster? :)
myanello-rescale commentedon Jan 14, 2025
I'm having the same issue as Julian. We currently authenticate to our repos by manually adding a key via the UI in argocd. I suppose the correct fix would be to gitops those keys, but is there a way to avoid needing to do that?
dag-andersen commentedon Jan 14, 2025
Hi @myanello-rescale,
I recommend avoiding checking your keys into Git.
Instead, you can create an ephemeral secret within your pipeline, as explained here: [link].
Since you're using SSH, your secret should look something like this 猬囷笍. You can verify the correct format by checking your real ArgoCD cluster with the following command:
kubectl get secret -n argocd -o yamlLet me know if that helps :)
[-]ApplicationSet found, but no diff rendered[/-][+]ApplicationSet found, but no diff rendered + SSH Authentication issues [/+]dag-andersen commentedon Jan 26, 2025
Hi @juliankock and @myanello-rescale,
Did this solve your problem? If so, I鈥檒l go ahead and close the issue. :)
myanello-rescale commentedon Jan 26, 2025
I haven't had a chance to really dig into this again yet, so feel free to close as my free time comes and goes. Thank you for the tip forward though
juliankock commentedon Mar 17, 2025
@dag-andersen
I finally gave it a shot, I'm now hitting:
I'm using a private GitHub App SSH key which is installed in the repo. Any ideas?
dag-andersen commentedon Mar 17, 2025
@juliankock
Would you mind sharing your pipeline with me?
Someone else had SSH issues last week [link], and they updated the [docs] with their solution :)
Let me know if that helps - otherwise, we鈥檒l have to dig a bit deeper.
juliankock commentedon Mar 17, 2025
@dag-andersen
I updated it to follow the links, thanks!
The workflow looks like this:
Now I get this error:
It seems like my SSH key is not scoped correctly. I'm using GitHub Apps to do this, which is installed to the GitHub repository. It should have READ contents set.
EDIT:
I think I might be hitting this: argoproj/argo-cd#9122
I will try to generate a deploy key instead, since GitHub apps make a
.pemkey.juliankock commentedon Mar 17, 2025
Using a deploy key worked! I would recommend adding this reference to the docs: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys if you want to use SSH access.
Thanks for the help! :)
This issue can be closed, but I will let you close it @dag-andersen so you can see this.